Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /config/trunk/install.sh
ViewVC logotype

Diff of /config/trunk/install.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 537, Fri Feb 18 17:20:16 2000 UTC revision 844, Wed Jun 20 20:39:15 2001 UTC
# Line 9  Line 9 
9  # by M.Blume (2/2000).  # by M.Blume (2/2000).
10  #  #
11    
12    this=$0
13    
14  #  #
15  # get the target list  # get the target list
16  #  #
17  if [ ! -r config/targets ]; then  if [ -r config/targets.customized ] ; then
18      echo "!!! File config/targets is missing."      . config/targets.customized
19    elif [ ! -r config/targets ]; then
20        echo "$this: !!! File config/targets is missing."
21      exit 1      exit 1
22  fi  else
23  . config/targets  . config/targets
24    fi
25    
26  #  #
27  # create the preloads.standard file  # create the preloads.standard file
28  #  #
29  if [ ! -r config/preloads ]; then  if [ ! -r config/preloads ]; then
30      echo "!!! File config/preloads is missing."      echo "$this: !!! File config/preloads is missing."
31      exit 1      exit 1
32  fi  fi
33  cp config/preloads preloads.standard  cp config/preloads preloads.standard
# Line 33  Line 38 
38  #  #
39  MAKE=make  MAKE=make
40    
41    #
42    # Make sure we don't have any unpleasant surprises due to the installing
43    # user's process environment:
44    #
45    unset CM_PATHCONFIG
46    
47  SHELL=/bin/sh  SHELL=/bin/sh
48  echo Using shell $SHELL.  echo $this: Using shell $SHELL.
49    
50  #  #
51  # set the SML root directory  # set the SML root directory
52  #  #
53  REAL_PWD=`pwd`  REAL_PWD=`pwd`
54  ROOT=${PWD:-$REAL_PWD}  ROOT=${PWD:-$REAL_PWD}
55  echo SML root is $ROOT.  echo $this: SML root is $ROOT.
56  echo Installation directory is ${INSTALLDIR:=$ROOT}.  echo $this: Installation directory is ${INSTALLDIR:=$ROOT}.
57    
58  #  #
59  # set the various directory and file pathname variables  # set the various directory and file pathname variables
# Line 54  Line 65 
65  SRCDIR=$ROOT/src                # where the source tree is rooted  SRCDIR=$ROOT/src                # where the source tree is rooted
66  LIBDIR=$INSTALLDIR/lib          # where libraries live  LIBDIR=$INSTALLDIR/lib          # where libraries live
67  LIBLIST=$ROOT/liblist           # list of commands to stabilize libraries  LIBLIST=$ROOT/liblist           # list of commands to stabilize libraries
68    LATESTANDALONES=$ROOT/latestandalones # standalone programs to be built late
69  LIBMOVESCRIPT=$ROOT/libmove     # a temporary script  LIBMOVESCRIPT=$ROOT/libmove     # a temporary script
70  LOCALPATHCONFIG=$INSTALLDIR/pathconfig # a temporary pathconfig file  LOCALPATHCONFIG=$INSTALLDIR/pathconfig # a temporary pathconfig file
71    
72    URLGETTER=unknown
73    
74  #  #
75  # the path to the dir where ml-yacc, ml-burg, ml-lex, and ml-build live  # the path to the dir where ml-yacc, ml-burg, ml-lex, ml-build, and
76    # ml-makedepend live
77  #  #
78  TOOLDIR=$BINDIR  TOOLDIR=$BINDIR
79    
80  #  #
81    # A temporary file for post-editing the pathconfig file...
82    #
83    PCEDITTMP=$INSTALLDIR/pcedittmp.$$
84    
85    #
86    # files to be deleted after we are done...
87    #
88    tmpfiles=""
89    tmpfiles="$tmpfiles $ROOT/preloads.standard"
90    tmpfiles="$tmpfiles $LIBLIST"
91    tmpfiles="$tmpfiles $LATESTANDALONES"
92    tmpfiles="$tmpfiles $LOCALPATHCONFIG"
93    tmpfiles="$tmpfiles $LIBMOVESCRIPT"
94    tmpfiles="$tmpfiles $PCEDITTMP"
95    #
96    # make sure we always clean up after ourselves...
97    #
98    trap 'rm -f $tmpfiles' 0 1 2 3 15
99    
100    
101    #
102  # set the CM configuration variables (these are environment variables  # set the CM configuration variables (these are environment variables
103  # that will be queried by the bootstrap code)  # that will be queried by the bootstrap code)
104  # Especially important is CM_PATHCONFIG_DEFAULT.  # Especially important is CM_PATHCONFIG_DEFAULT.
# Line 74  Line 110 
110  # the release version that we are installing  # the release version that we are installing
111  #  #
112  VERSION=`cat $CONFIGDIR/version`  VERSION=`cat $CONFIGDIR/version`
113  echo Installing version $VERSION.  echo $this: Installing version $VERSION.
114    
115    #
116    # the URL for the (usually remote) source archive
117    #
118    SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl`
119    echo $this: URL of source archive is $SRCARCHIVEURL.
120    
121  #  #
122  # Function to make a directory (and advertise such action).  # Function to make a directory including its ancestors.
123  #  #
124  makedir() {  makedir() {
125      if [ ! -d $1 ] ; then      if [ x$1 = x ] ; then
126          echo Making directory $1          :
127        elif [ -d $1 ] ; then
128            :
129        else
130            makedir `dirname $1`
131            echo "$this: Making directory $1"
132          if mkdir $1 ; then          if mkdir $1 ; then
133              : everything is fine              :
134          else          else
135              echo "!!! Unable to make directory $1!"              echo "$this: !!! Unable to make directory $1!"
136              exit 1              exit 1
137          fi          fi
138      fi      fi
139  }  }
140    
141  #  #
142    # Function for asking user to fetch source archive.
143    #   $1 - descriptive name
144    #   $2 - base name without extension, without version, and without dir
145    #   $3 - remote directory
146    #
147    askurl() {
148        echo "$this: Please, fetch $1 archive"
149        echo ' ('$2.'*' or $VERSION-$2.'*)'
150        echo " from $3"
151        echo " and then re-run this script!"
152        exit 1
153    }
154    
155    #
156    # Function for fetching source archives automatically using wget or lynx.
157    #   $1 - command to actually get the stuff
158    #   $2 - descriptive name
159    #   $3 - base name without extension and without dir
160    #   $4 - remote directory
161    #
162    fetchurl() {
163        getter=$1 ; shift
164        echo $this: Fetching $1 from $3. Please stand by...
165        fetched=no
166        for base in $2 $VERSION-$2 ; do
167            for ext in tar.gz tgz tar.Z tz tar tar.bz2 ; do
168                try=$base.$ext
169                echo $this: Trying $try ...
170                if $getter $3 $try $ROOT/$try ; then
171                    fetched=yes
172                    echo $this: Fetching $try was a success.
173                    break 2         # get out of both for-loops
174                else
175                    rm -f $ROOT/$try
176                fi
177            done
178        done
179        if [ $fetched = no ] ; then
180            echo $this: Fetching $try was no success.
181            echo '  ' You should try to do it manually now.
182            askurl "$1" "$2" "$3"
183        fi
184    }
185    
186    usewget() {
187        wget -nv -O $3 $1/$2
188    }
189    
190    uselynx() {
191        lynx -source $1/$2 >$3
192    }
193    
194    testurlgetter() {
195        (exec >/dev/null 2>&1 ; exec $*)
196    }
197    
198    #
199    # Function to check whether wget or lynx is available.
200    # Set URLGETTER accordingly.
201    #
202    urlgetter() {
203        if [ "$URLGETTER" = unknown ] ; then
204            if testurlgetter wget --help ; then
205                URLGETTER="fetchurl usewget"
206            elif testurlgetter lynx -help ; then
207                URLGETTER="fetchurl uselynx"
208            else
209                URLGETTER="askurl"
210            fi
211        fi
212    }
213    
214    un_tar() {
215        echo "$this: Un-TAR-ing $1 archive."
216        tar -xf $2
217    }
218    
219    un_tar_Z() {
220        echo "$this: Un-COMPRESS-ing and un-TAR-ing $1 archive."
221        zcat $2 | tar -xf -
222    }
223    
224    un_tar_gz() {
225        echo "$this: Un-GZIP-ing and un-TAR-ing $1 archive."
226        gunzip -c $2 | tar -xf -
227    }
228    
229    un_tar_bz2() {
230        echo "$this: Un-BZIP2-ing and un-TAR-ing $1 archive."
231        bunzip2 -c $2 | tar -xf -
232    }
233    
234    unarchive() {
235        # $1: descriptive string, $2: archive, $3: unpacker
236        if [ -r $ROOT/$2 ] ; then
237            $3 "$1" $ROOT/$2
238        elif [ -r $ROOT/$VERSION-$2 ]; then
239            $3 "$1" $ROOT/$VERSION-$2
240        else
241            return 1
242        fi
243    }
244    
245    #
246  # Function to unpack a source archive.  # Function to unpack a source archive.
247  #  #
248  # $1: descriptive name of the sources to be unpacked  # $1: descriptive name of the sources to be unpacked
# Line 100  Line 251 
251  # $4: the basename of the source archive (the script will check several  # $4: the basename of the source archive (the script will check several
252  #     different suffixes to determine what kind of de-compression is to  #     different suffixes to determine what kind of de-compression is to
253  #     be used)  #     be used)
254    #
255    # fetch_n_unpack is the helper function that does the real work.  If
256    # no archive is found locally, it invokes $URLGETTER and tries again.
257    # The variable $tryfetch is used to make sure this happens only once.
258    fetch_n_unpack() {
259        cd $2
260        if unarchive "$1" $4.tar.gz un_tar_gz ||
261           unarchive "$1" $4.tgz un_tar_gz ||
262           unarchive "$1" $4.tar.Z un_tar_Z ||
263           unarchive "$1" $4.tar un_tar ||
264           unarchive "$1" $4.tar.bz1 un_tar_bz2 ||
265           unarchive "$1" $4.tz un_tar_Z
266        then
267            : we are done
268        elif [ $tryfetch = yes ] ; then
269            urlgetter
270            $URLGETTER "$1" $4 $SRCARCHIVEURL
271            tryfetch=no
272            fetch_n_unpack "$1" "$2" "$3" "$4"
273        fi
274    }
275    
276    #
277    # The main "unpack" driver function that invokes the above helper.
278    #
279  unpack() {  unpack() {
280        tryfetch=yes
281      if [ -d $2/$3 ]; then      if [ -d $2/$3 ]; then
282          echo "The $1 source tree already exists."          echo "$this: The $1 tree already exists."
     else  
         echo "Unpacking $1 source archive."  
         cd $2  
         if [ -r $4.tar.Z ] ; then  
             zcat $4.tar.Z | tar -xf -  
         elif [ -r $4.tar ] ; then  
             tar -xf $4.tar  
         elif [ -r $4.tar.gz ] ; then  
             gunzip -c $4.tar.gz | tar -xf -  
         elif [ -r $4.tar.bz2 ] ; then  
             bunzip2 -c $4.tar.bz2 | tar -xf -  
         elif [ -r $4.tgz ] ; then  
             gunzip -c $4.tgz | tar -xf -  
         elif [ -r $4.tz ] ; then  
             zcat $4.tz | tar -xf -  
283          else          else
284              echo "!!! The $1 source archive is missing."          fetch_n_unpack "$1" "$2" "$3" "$4"
             exit 1  
285          fi          fi
286          if [ ! -d $2/$3 ]; then          if [ ! -d $2/$3 ]; then
287              echo "!!! Unable to unpack $1 source archive."          echo "$this: !!! Unable to unpack $1 archive."
288              exit 1              exit 1
289          fi          fi
290    }
291    
292    # A function to move all stable library files to a parallel directory
293    # hierarchy.
294    # The first argument must be a simple path (no / inside), and
295    # the second argument must be an absolute path.
296    move() {
297        if [ -d $1 ] ; then
298            if [ ! -d $2 ] ; then
299                if [ -f $2 ] ; then
300                    echo $this: $2 exists as a non-directory.
301                    exit 1
302                fi
303                mkdir $2
304            fi
305            cd $1
306            for i in * ; do
307                move $i $2/$i
308            done
309            cd ..
310        elif [ -f $1 ] ; then
311            rm -f $2
312            mv $1 $2
313      fi      fi
314  }  }
315    
316  #  # move stable library file from $1 to $2
317  # Move the stable archive of a library whose description file was $1/$2 to  movelib()
318  # $LIBDIR/$2/CM/$ARCH-unix/$2 so that it appears as if the description file  {
319  # had been at $LIBDIR/$2/$2      SOURCE=$1
320  #      TARGET=$2
321  # (This script will also move all other libraries that show up in      TARGETDIR=`dirname ${TARGET}`
322  #  $1/CM/$ARCH-unix because in the case of the boot directory this indicates      if [ ! -d ${TARGETDIR} ] ; then
323  #  that some library did not have its own path anchor but was specified          makedir ${TARGETDIR}
 #  relative to $1/$2. Still, don't rely on this to be robust -- rather make  
 #  separate anchors for every library!)  
 #  
 movelibs() {  
     for lib in `/bin/ls $1/CM/$ARCH-unix` ; do  
         case $lib in  
         *.cm | *.cmi)  
             if [ $lib != $2 ] ; then  
                 echo "! Warning:" $lib specified relative to $2  
324              fi              fi
325              echo Moving library $lib to $LIBDIR      mv ${SOURCE} ${TARGET}
             makedir $LIBDIR/$2  
             makedir $LIBDIR/$2/CM  
             makedir $LIBDIR/$2/CM/$ARCH-unix  
             mv $1/CM/$ARCH-unix/$lib $LIBDIR/$2/CM/$ARCH-unix/$lib  
             ;;  
         *)  
             ;;  
         esac  
      done  
326  }  }
327    
328  # A shell function that registers a library for being built.  # A shell function that registers a library for being built.
329  # This function takes two arguments: 1. a name under which the library  # This function takes 3 arguments:
330  # is to be known later (something.cm) and 2. the path relative to $SRCDIR  #   $1 = controlling anchor
331  # that leads to the library's .cm file.  The library's .cm file must be the  #   $2 = name relative to controlling anchor
332  # same as $1.  #   $3 = dir (relative to ${SRCDIR}) corresponding to $1
333  #  #
334  # This works by adding ML code to file $LIBLIST.  The code in this file  # This works by adding ML code to file $LIBLIST.  The code in this file
335  # will be executed near the end of this script.  If $MOVE_LIBRARIES is  # will be executed near the end of this script.  If $MOVE_LIBRARIES is
336  # set to true, then reglib will also register a "movelibs" to be executed at  # set to true, then reglib will also register a "movelib" to be executed at
337  # the end by putting a "movelibs" line into $LIBMOVESCRIPT.  # the end by putting a "movelib" line into $LIBMOVESCRIPT.
   
338  reglib() {  reglib() {
339        ANCHOR=$1
340        RELNAME=$2
341        LIBNAME='$'${ANCHOR}/${RELNAME}
342        ADIR=${SRCDIR}/$3
343        RELDIR=`dirname $RELNAME`
344        RELBASE=`basename $RELNAME`
345        if [ x$RELDIR = x. ] ; then
346            RELDIR=
347        else
348            RELDIR=/$RELDIR
349        fi
350        RELLOC=${RELDIR}/CM/${ARCH}-unix/${RELBASE}
351        SRCFINALLOC=${ADIR}${RELLOC}
352      if [ x$MOVE_LIBRARIES = xtrue ] ; then      if [ x$MOVE_LIBRARIES = xtrue ] ; then
353          FINALLOCATION=$LIBDIR/$1          FINALLOC=${LIBDIR}/${ANCHOR}${RELLOC}
354            FINALCONFIGPATH=${ANCHOR}
355      else      else
356          FINALLOCATION=$SRCDIR/$2          FINALLOC=${SRCFINALLOC}
357            FINALCONFIGPATH=${ADIR}
358      fi      fi
359      if [ -d $FINALLOCATION/CM/$ARCH-unix ] ; then  
360          echo "Library $1 already exists in $FINALLOCATION."      if [ -f ${FINALLOC} ] ; then
361            echo "$this: Library ${LIBNAME} already exists in ${FINALLOC}"
362      else      else
363          echo "Scheduling library $1 to be built in $FINALLOCATION."          echo "$this: Scheduling library ${LIBNAME} to be built as ${FINALLOC}."
364          echo "andalso CM.stabilize false \"$1\"" >>$LIBLIST          echo "  andalso CM.stabilize false \"${LIBNAME}\"" >>${LIBLIST}
365          echo $1 $SRCDIR/$2 >>$LOCALPATHCONFIG          echo ${ANCHOR} ${ADIR} >>${LOCALPATHCONFIG}
366          if [ x$MOVE_LIBRARIES = xtrue ] ; then          if [ x$MOVE_LIBRARIES = xtrue ] ; then
367              echo movelibs $SRCDIR/$2 $1 >>$LIBMOVESCRIPT              echo movelib ${SRCFINALLOC} ${FINALLOC} >>${LIBMOVESCRIPT}
368          fi          fi
         echo $1 $FINALLOCATION >>$CM_PATHCONFIG_DEFAULT  
369      fi      fi
370        echo ${ANCHOR} ${FINALCONFIGPATH} >>${CM_PATHCONFIG_DEFAULT}
371  }  }
372    
373  #  #
# Line 206  Line 387 
387          TARGETLOC=$TARGET          TARGETLOC=$TARGET
388      fi      fi
389      if [ -r $HEAPDIR/$TARGET ] ; then      if [ -r $HEAPDIR/$TARGET ] ; then
390          echo Target $TARGET already exists.          echo $this: Target $TARGET already exists.
391      else      else
392          echo Building $TARGET.          echo $this: Building $TARGET.
393          unpack $2 $SRCDIR $1 $ROOT/$VERSION-$1          unpack $2 $SRCDIR $1 $1
394          cd $SRCDIR/$1          cd $SRCDIR/$1
395          ./build          # build it, but make sure we don't pick up some (unrelated)
396            # local path configuration...
397            CM_LOCAL_PATHCONFIG=/dev/null ./build
398          if [ -r $TARGETLOC ] ; then          if [ -r $TARGETLOC ] ; then
399              mv $TARGETLOC $HEAPDIR/$TARGET              mv $TARGETLOC $HEAPDIR/$TARGET
400              if [ ! -f $BINDIR/$1 ] ; then              if [ ! -f $BINDIR/$1 ] ; then
# Line 219  Line 402 
402                  ln -s .run-sml $1                  ln -s .run-sml $1
403              fi              fi
404          else          else
405              echo "!!! Build of $TARGET failed."              echo "$this: !!! Build of $TARGET failed."
406          fi          fi
407      fi      fi
408  }  }
# Line 227  Line 410 
410  #  #
411  # create the various sub directories  # create the various sub directories
412  #  #
413  for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR  for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR ; do
 do  
414      makedir $dir      makedir $dir
415  done  done
416    
# Line 236  Line 418 
418  # install the script that tests the architecture, and make sure that it works  # install the script that tests the architecture, and make sure that it works
419  #  #
420  if [ -x $BINDIR/.arch-n-opsys ]; then  if [ -x $BINDIR/.arch-n-opsys ]; then
421      echo Script $BINDIR/.arch-n-opsys already exists.      echo $this: Script $BINDIR/.arch-n-opsys already exists.
422  else  else
423      cat $CONFIGDIR/_arch-n-opsys \      cat $CONFIGDIR/_arch-n-opsys \
424      | sed -e "s,@SHELL@,$SHELL,g" > $BINDIR/.arch-n-opsys      | sed -e "s,@SHELL@,$SHELL,g" > $BINDIR/.arch-n-opsys
425      chmod 555 $BINDIR/.arch-n-opsys      chmod 555 $BINDIR/.arch-n-opsys
426      if [ ! -x $BINDIR/.arch-n-opsys ]; then      if [ ! -x $BINDIR/.arch-n-opsys ]; then
427          echo "!!! Installation of $BINDIR/.arch-n-opsys failed."          echo "$this: !!! Installation of $BINDIR/.arch-n-opsys failed."
428          exit 1          exit 1
429      fi      fi
430  fi  fi
431    
432  ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`  ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`
433  if [ "$?" != "0" ]; then  if [ "$?" != "0" ]; then
434      echo "!!! Script $BINDIR/.arch-n-opsys fails on this machine."      echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine."
435      echo "!!! You must patch this by hand and repeat the installation."      echo "$this: !!! You must patch this by hand and repeat the installation."
436      exit 2      exit 2
437  else  else
438      echo Script $BINDIR/.arch-n-opsys reports $ARCH_N_OPSYS.      echo $this: Script $BINDIR/.arch-n-opsys reports $ARCH_N_OPSYS.
439  fi  fi
440  eval $ARCH_N_OPSYS  eval $ARCH_N_OPSYS
441    
# Line 265  Line 447 
447  installdriver() {  installdriver() {
448      dsrc=$1      dsrc=$1
449      ddst=$2      ddst=$2
450      if [ -x $BINDIR/$ddst ]; then  # We install the driver unconditionally. (It would be better to test
451          echo Script $BINDIR/$ddst already exists.  # for an outdated driver script, but not all "test" commands understand
452      else  # the -nt comparison operator....)
453    #   if [ -x $BINDIR/$ddst ]; then
454    #       echo $this: Script $BINDIR/$ddst already exists.
455    #   else
456            rm -f $BINDIR/$ddst
457          cat $CONFIGDIR/$dsrc | \          cat $CONFIGDIR/$dsrc | \
458          sed -e "s,@SHELL@,$SHELL,g" \          sed -e "s,@SHELL@,$SHELL,g" \
459              -e "s,@BINDIR@,$BINDIR," \              -e "s,@BINDIR@,$BINDIR," \
# Line 275  Line 461 
461              > $BINDIR/$ddst              > $BINDIR/$ddst
462          chmod 555 $BINDIR/$ddst          chmod 555 $BINDIR/$ddst
463          if [ ! -x $BINDIR/$ddst ]; then          if [ ! -x $BINDIR/$ddst ]; then
464              echo "!!! Installation of $BINDIR/${ddst} failed."              echo "$this: !!! Installation of $BINDIR/${ddst} failed."
465              exit 1              exit 1
466          fi          fi
467      fi  #   fi
468  }  }
469    
470  installdriver _run-sml .run-sml  installdriver _run-sml .run-sml
471  installdriver _link-sml .link-sml  installdriver _link-sml .link-sml
472  installdriver _ml-build ml-build  installdriver _ml-build ml-build
473    installdriver _ml-makedepend ml-makedepend
474    
475  #  #
476  # set some architecture dependent run-time system flags  # set some architecture dependent run-time system flags
# Line 293  Line 480 
480          ALLOC=1M          ALLOC=1M
481          ;;          ;;
482      x86)      x86)
483            # The following is the _wrong_ value for many popular x86 chips
484            # (i.e., Celerons).  However, the optimal value for those is 32k,
485            # and such a small value is not enough for the runtime system's boot
486            # code.  Therefore, we use 256k here and re-set it to the proper
487            # value in .run-sml.
488          ALLOC=256k          ALLOC=256k
489          ;;          ;;
490      alpha32)      alpha32)
# Line 310  Line 502 
502      linux)      linux)
503          EXTRA_DEFS=`$CONFIGDIR/chk-global-names.sh`          EXTRA_DEFS=`$CONFIGDIR/chk-global-names.sh`
504          if [ "$?" != "0" ]; then          if [ "$?" != "0" ]; then
505              echo "!!! Problems checking for underscores in global names."              echo "$this: !!! Problems checking for underscores in asm names."
506              exit 1              exit 1
507          fi          fi
508          EXTRA_DEFS="XDEFS=$EXTRA_DEFS"          EXTRA_DEFS="XDEFS=$EXTRA_DEFS"
# Line 320  Line 512 
512  #  #
513  # the name of the bin files directory  # the name of the bin files directory
514  #  #
515  BOOT_FILES=sml.boot.$ARCH-unix  BOOT_ARCHIVE=boot.$ARCH-unix
516    BOOT_FILES=sml.$BOOT_ARCHIVE
 #  
 # files to be deleted after we are done...  
 #  
 tmpfiles=""  
 tmpfiles="$tmpfiles $ROOT/preloads.standard"  
 tmpfiles="$tmpfiles $ROOT/$LIBLIST"  
 tmpfiles="$tmpfiles $ROOT/$LOCALPATHCONFIG"  
 tmpfiles="$tmpfiles $ROOT/$LIBMOVESCRIPT"  
 #  
 # also remove the boot dir because it won't have anything interesting in  
 # it after we are successful...  
 #  
 tmpfiles="$tmpfiles $ROOT/$BOOT_FILES"  
 #  
 # make sure we always clean up after ourselves...  
 #  
 trap 'rm -rf $tmpfiles' 0 1 2 3 15  
517    
518  #  #
519  # build the run-time system  # build the run-time system
520  #  #
521  unpack "run-time" $SRCDIR runtime $ROOT/$VERSION-runtime  unpack "run-time" $SRCDIR runtime runtime
522  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then
523      echo Run-time system already exists.      echo $this: Run-time system already exists.
524  else  else
525      cd $SRCDIR/runtime/objs      cd $SRCDIR/runtime/objs
526      echo Compiling the run-time system.      echo $this: Compiling the run-time system.
527      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS
528      if [ -x run.$ARCH-$OPSYS ]; then      if [ -x run.$ARCH-$OPSYS ]; then
529          mv run.$ARCH-$OPSYS $RUNDIR          mv run.$ARCH-$OPSYS $RUNDIR
530          # $MAKE MAKE=$MAKE clean          $MAKE MAKE=$MAKE clean
531      else      else
532          echo "!!! Run-time system build failed for some reason."          echo "$this: !!! Run-time system build failed for some reason."
533          exit 1          exit 1
534      fi      fi
535  fi  fi
# Line 364  Line 539 
539  # boot the base SML system  # boot the base SML system
540  #  #
541  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then
542      echo Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.      echo $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.
543  else  else
544      unpack bin $ROOT $BOOT_FILES $ROOT/$VERSION-$BOOT_FILES      unpack bin $ROOT $BOOT_FILES $BOOT_ARCHIVE
545      cd $ROOT/$BOOT_FILES      cd $ROOT/$BOOT_FILES
546      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC
547      then      then
# Line 380  Line 555 
555              # the pathconfig file.              # the pathconfig file.
556              #              #
557              cd $ROOT/$BOOT_FILES              cd $ROOT/$BOOT_FILES
558              for lib in *.cm ; do              for anchor in * ; do
559                  echo $lib $LIBDIR/$lib >>$CM_PATHCONFIG_DEFAULT                  if [ -d $anchor ] ; then
560                  movelibs $ROOT/$BOOT_FILES/$lib $lib                      echo $anchor $anchor >>$CM_PATHCONFIG_DEFAULT
561                        move $anchor $LIBDIR/$anchor
562                    fi
563              done              done
564              cd $ROOT              cd $ROOT
565              # rm -rf $BOOT_FILES              # $BOOT_FILES is now only an empty skeleton, let's get rid of it.
566                rm -rf $BOOT_FILES
567    
568          else          else
569              echo "!!! Boot code did not produce heap image (sml.$HEAP_SUFFIX)."              echo "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."
570              exit 1              exit 1
571          fi          fi
572      else      else
573          echo "!!! Boot code failed, no heap image built (sml.$HEAP_SUFFIX)."          echo "$this !!! Boot code failed, no heap image (sml.$HEAP_SUFFIX)."
574          exit 1          exit 1
575      fi      fi
576  fi  fi
# Line 402  Line 580 
580  #  #
581  cd $ROOT  cd $ROOT
582  rm -f $LOCALPATHCONFIG $LIBLIST  rm -f $LOCALPATHCONFIG $LIBLIST
583  echo 'OS.Process.exit (if true' >$LIBLIST  echo 'ignore (OS.Process.exit (if true' >$LIBLIST
584    
585  #  #
586  # now build (or prepare to build) the individual targets  # now build (or prepare to build) the individual targets
587  #  #
588  cd $SRCDIR  cd $SRCDIR
589  echo Installing other targets.  echo $this: Installing other targets.
590  for i in $TARGETS ; do  for i in $TARGETS ; do
591      case $i in      case $i in
592        src-smlnj)        src-smlnj)
593          for src in compiler cm MLRISC smlnj-lib ml-yacc system          for src in compiler cm MLRISC smlnj-lib ml-yacc system
594          do          do
595              unpack $src $ROOT/src $src $ROOT/$VERSION-$src              unpack $src $ROOT/src $src $src
596          done          done
597          ;;          ;;
598        ml-yacc)        ml-yacc)
# Line 429  Line 607 
607          standalone ml-burg ML-Burg          standalone ml-burg ML-Burg
608          echo ml-burg $TOOLDIR >>$CM_PATHCONFIG_DEFAULT          echo ml-burg $TOOLDIR >>$CM_PATHCONFIG_DEFAULT
609          ;;          ;;
610          ml-nlffigen)
611            echo standalone ml-nlffigen ML-NLFFI-Gen >>$LATESTANDALONES
612            echo ml-nlffigen $TOOLDIR >>$CM_PATHCONFIG_DEFAULT
613            ;;
614        smlnj-lib)        smlnj-lib)
615          unpack "SML/NJ Library" $SRCDIR smlnj-lib $ROOT/$VERSION-smlnj-lib          unpack "SML/NJ Library" $SRCDIR smlnj-lib smlnj-lib
616    
617          # Don't make the Util library -- it came pre-made and has been          # Don't make the Util library -- it came pre-made and has been
618          # installed when making the base system.  In other words, don't do...          # installed when making the base system.  In other words, don't do...
619              #reglib smlnj-lib.cm smlnj-lib/Util              #reglib smlnj-lib.cm smlnj-lib.cm smlnj-lib/Util
620          # ... and don't make the HTML library ...          # ... and don't make the HTML library ...
621              #reglib html-lib.cm smlnj-lib/HTML              #reglib html-lib.cm html-lib.cm smlnj-lib/HTML
622          # ... and don't make the PP library ...          # ... and don't make the PP library ...
623              #reglib pp-lib.cm smlnj-lib/PP              #reglib pp-lib.cm pp-lib.cm smlnj-lib/PP
624          # make the Unix library          # make the Unix library
625              reglib unix-lib.cm smlnj-lib/Unix              reglib unix-lib.cm unix-lib.cm smlnj-lib/Unix
626          # make the INet library          # make the INet library
627              reglib inet-lib.cm smlnj-lib/INet              reglib inet-lib.cm inet-lib.cm smlnj-lib/INet
628          # make the RegExp library          # make the RegExp library
629              reglib regexp-lib.cm smlnj-lib/RegExp              reglib regexp-lib.cm regexp-lib.cm smlnj-lib/RegExp
630          # make the Reactive library          # make the Reactive library
631              reglib reactive-lib.cm smlnj-lib/Reactive              reglib reactive-lib.cm reactive-lib.cm smlnj-lib/Reactive
632          ;;          ;;
633        cml)        cml)
634          unpack CML $SRCDIR cml $ROOT/$VERSION-cml          unpack CML $SRCDIR cml cml
635          reglib core-cml.cm cml/src/core-cml          reglib cml core-cml.cm cml/src
636          reglib cml.cm cml/src          reglib cml cml-internal.cm cml/src
637          reglib cml-basis.cm cml          reglib cml cml.cm cml/src
638            reglib cml basis.cm cml/src
639          ;;          ;;
640        cml-lib)        cml-lib)
641          unpack CML $SRCDIR cml $ROOT/$VERSION-cml          unpack CML $SRCDIR cml cml
642          reglib cml-lib.cm cml/cml-lib          reglib cml-lib trace-cml.cm cml/cml-lib/cm
643            reglib cml-lib smlnj-lib.cm cml/cml-lib/cm ????
644          ;;          ;;
645        eXene)        eXene)
646          unpack EXene $SRCDIR eXene $ROOT/$VERSION-eXene          unpack EXene $SRCDIR eXene eXene
647          reglib eXene.cm eXene          reglib eXene.cm eXene.cm eXene
648            ;;
649          ckit)
650            unpack "C-Kit" $ROOT ckit ckit
651            reglib ckit-lib.cm ckit-lib.cm ../ckit/src
652            ;;
653          ml-nlffi-lib)
654            unpack "NLFFI Library" $SRCDIR ml-nlffi-lib ml-nlffi-lib
655            reglib memory.cm memory.cm ml-nlffi-lib/memory
656            reglib c-int.cm c-int.cm ml-nlffi-lib/internals
657            reglib c.cm c.cm ml-nlffi-lib
658          ;;          ;;
659        doc)        doc)
660          unpack Doc $ROOT doc $ROOT/$VERSION-doc          unpack Doc $ROOT doc doc
661          cd $ROOT/doc          cd $ROOT/doc
662          build $ROOT          build $ROOT
663          ;;          ;;
664        *)        *)
665          echo "!!! Unknown target $i."          echo "$this: !!! Unknown target $i."
666          ;;          ;;
667      esac      esac
668  done  done
# Line 479  Line 673 
673  # $SRCDIR, so we must consult $LOCALPATHCONFIG.  # $SRCDIR, so we must consult $LOCALPATHCONFIG.
674  #  #
675    
676  echo Compiling library code.  echo $this: Compiling library code.
677  echo 'then OS.Process.success else OS.Process.failure);' >>$LIBLIST  echo 'then OS.Process.success else OS.Process.failure));' >>$LIBLIST
678  if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then  if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then
679      echo Libraries compiled successfully.      echo $this: Libraries compiled successfully.
680  else  else
681      echo "!!! Something went wrong when compiling the libraries."      echo "$this: !!! Something went wrong when compiling the libraries."
682      exit 1      exit 1
683  fi  fi
684    
685  #  #
686  # Finally, move the libraries to their final locations...  # Move the libraries to their final locations...
687  #  #
688    
689  if [ -r $LIBMOVESCRIPT ] ; then  if [ -r $LIBMOVESCRIPT ] ; then
690      echo Moving libraries to $LIBDIR.      echo $this: Moving libraries to $LIBDIR.
691      . $LIBMOVESCRIPT      . $LIBMOVESCRIPT
692  fi  fi
693    
694    #
695    # Build "late" standalone programs (i.e., those that must be built
696    # after libraries are already in place):
697    #
698    
699    if [ -r $LATESTANDALONES ] ; then
700        echo $this: Building late standalone programs.
701        . $LATESTANDALONES
702    fi
703    
704    #
705    # Finally, remove duplicate entries from pathconfig file...
706    #
707    if [ -f $CM_PATHCONFIG_DEFAULT ] ; then
708        cp $CM_PATHCONFIG_DEFAULT $PCEDITTMP
709        rm -f $CM_PATHCONFIG_DEFAULT
710        awk <$PCEDITTMP 'NF == 2 { mapping[$1] = $2 }
711    NF != 2 { print $0 }
712    END { for (i in mapping) print i, mapping[i] }' \
713          | sort >$CM_PATHCONFIG_DEFAULT
714    fi
715    
716  exit 0  exit 0

Legend:
Removed from v.537  
changed lines
  Added in v.844

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0