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 573, Thu Mar 9 15:23:52 2000 UTC revision 975, Wed Oct 31 20:22:44 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  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.  This path will be interpreted relative to $LIBDIR.
77  #  #
78  TOOLDIR=$BINDIR  TOOLDIR=../bin
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...  # files to be deleted after we are done...
# Line 70  Line 88 
88  tmpfiles=""  tmpfiles=""
89  tmpfiles="$tmpfiles $ROOT/preloads.standard"  tmpfiles="$tmpfiles $ROOT/preloads.standard"
90  tmpfiles="$tmpfiles $LIBLIST"  tmpfiles="$tmpfiles $LIBLIST"
91    tmpfiles="$tmpfiles $LATESTANDALONES"
92  tmpfiles="$tmpfiles $LOCALPATHCONFIG"  tmpfiles="$tmpfiles $LOCALPATHCONFIG"
93  tmpfiles="$tmpfiles $LIBMOVESCRIPT"  tmpfiles="$tmpfiles $LIBMOVESCRIPT"
94    tmpfiles="$tmpfiles $PCEDITTMP"
95  #  #
96  # make sure we always clean up after ourselves...  # make sure we always clean up after ourselves...
97  #  #
# Line 90  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  # the URL for the (usually remote) source archive
117  #  #
118  SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl`  SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl`
119  echo URL of source archive is $SRCARCHIVEURL.  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
# Line 120  Line 145 
145  #   $3 - remote directory  #   $3 - remote directory
146  #  #
147  askurl() {  askurl() {
148      echo Please, fetch $1 archive '('$VERSION-$2.'*)' from      echo "$this: Please, fetch $1 archive"
149      echo '  ' $3      echo ' ('$2.'*' or $VERSION-$2.'*)'
150        echo " from $3"
151      echo "and then re-run this script!"      echo "and then re-run this script!"
152      exit 1      exit 1
153  }  }
# Line 130  Line 156 
156  # Function for fetching source archives automatically using wget or lynx.  # Function for fetching source archives automatically using wget or lynx.
157  #   $1 - command to actually get the stuff  #   $1 - command to actually get the stuff
158  #   $2 - descriptive name  #   $2 - descriptive name
159  #   $3 - base name without extension, without version, and without dir  #   $3 - base name without extension and without dir
160  #   $4 - remote directory  #   $4 - remote directory
161  #  #
162  fetchurl() {  fetchurl() {
163      getter=$1 ; shift      getter=$1 ; shift
164      echo Fetching $1 from $2. Please stand by...      echo $this: Fetching $1 from $3. Please stand by...
165      fetched=no      fetched=no
166      for ext in tgz tar.gz tar.Z tz tar tar.bz2 ; do      for base in $2 $VERSION-$2 ; do
167          try=$VERSION-$2.$ext          for ext in tar.gz tgz tar.Z tz tar tar.bz2 ; do
168          echo Trying $try ...              try=$base.$ext
169                echo $this: Trying $try ...
170          if $getter $3 $try $ROOT/$try ; then          if $getter $3 $try $ROOT/$try ; then
171              fetched=yes              fetched=yes
172              echo Success.                  echo $this: Fetching $try was a success.
173              break                  break 2         # get out of both for-loops
174          else          else
175              rm -f $ROOT/$try              rm -f $ROOT/$try
176          fi          fi
177      done      done
178        done
179      if [ $fetched = no ] ; then      if [ $fetched = no ] ; then
180          echo No success.  You should try to do it manually now.          echo $this: Fetching $try was no success.
181            echo '  ' You should try to do it manually now.
182          askurl "$1" "$2" "$3"          askurl "$1" "$2" "$3"
183      fi      fi
184  }  }
# Line 162  Line 191 
191      lynx -source $1/$2 >$3      lynx -source $1/$2 >$3
192  }  }
193    
194    usecurl() {
195        curl -s $1/$2 >$3
196    }
197    
198  testurlgetter() {  testurlgetter() {
199      (exec >/dev/null 2>&1 ; exec $*)      (exec >/dev/null 2>&1 ; exec $*)
200  }  }
# Line 174  Line 207 
207      if [ "$URLGETTER" = unknown ] ; then      if [ "$URLGETTER" = unknown ] ; then
208          if testurlgetter wget --help ; then          if testurlgetter wget --help ; then
209              URLGETTER="fetchurl usewget"              URLGETTER="fetchurl usewget"
210            elif testurlgetter curl --help ; then
211                URLGETTER="fetchurl usecurl"
212          elif testurlgetter lynx -help ; then          elif testurlgetter lynx -help ; then
213              URLGETTER="fetchurl uselynx"              URLGETTER="fetchurl uselynx"
214          else          else
# Line 182  Line 217 
217      fi      fi
218  }  }
219    
220    un_tar() {
221        echo "$this: Un-TAR-ing $1 archive."
222        tar -xf $2
223    }
224    
225    un_tar_Z() {
226        echo "$this: Un-COMPRESS-ing and un-TAR-ing $1 archive."
227        zcat $2 | tar -xf -
228    }
229    
230    un_tar_gz() {
231        echo "$this: Un-GZIP-ing and un-TAR-ing $1 archive."
232        gunzip -c $2 | tar -xf -
233    }
234    
235    un_tar_bz2() {
236        echo "$this: Un-BZIP2-ing and un-TAR-ing $1 archive."
237        bunzip2 -c $2 | tar -xf -
238    }
239    
240    unarchive() {
241        # $1: descriptive string, $2: archive, $3: unpacker
242        if [ -r $ROOT/$2 ] ; then
243            $3 "$1" $ROOT/$2
244        elif [ -r $ROOT/$VERSION-$2 ]; then
245            $3 "$1" $ROOT/$VERSION-$2
246        else
247            return 1
248        fi
249    }
250    
251  #  #
252  # Function to unpack a source archive.  # Function to unpack a source archive.
253  #  #
# Line 193  Line 259 
259  #     be used)  #     be used)
260  #  #
261  # fetch_n_unpack is the helper function that does the real work.  If  # fetch_n_unpack is the helper function that does the real work.  If
262  # on archive is found locally, it invokes $URLGETTER and tries again.  # no archive is found locally, it invokes $URLGETTER and tries again.
263  # The variable $tryfetch is used to make sure this happens only once.  # The variable $tryfetch is used to make sure this happens only once.
264  fetch_n_unpack() {  fetch_n_unpack() {
     larc=$ROOT/$VERSION-$4  
265      cd $2      cd $2
266      if [ -r $larc.tar.Z ] ; then      if unarchive "$1" $4.tar.gz un_tar_gz ||
267          echo "Un-compress-ing and un-tar-ing $1 archive."         unarchive "$1" $4.tgz un_tar_gz ||
268          zcat $larc.tar.Z | tar -xf -         unarchive "$1" $4.tar.Z un_tar_Z ||
269      elif [ -r $larc.tar ] ; then         unarchive "$1" $4.tar un_tar ||
270          echo "Un-tar-ing $1 archive."         unarchive "$1" $4.tar.bz1 un_tar_bz2 ||
271          tar -xf $larc.tar         unarchive "$1" $4.tz un_tar_Z
272      elif [ -r $larc.tar.gz ] ; then      then
273          echo "Un-gzip-ing and un-tar-ing $1 archive."          : we are done
         gunzip -c $larc.tar.gz | tar -xf -  
     elif [ -r $larc.tar.bz2 ] ; then  
         echo "Un-bzip2-ing and un-tar-ing $1 archive."  
         bunzip2 -c $larc.tar.bz2 | tar -xf -  
     elif [ -r $larc.tgz ] ; then  
         echo "Un-gzip-ing and un-tar-ing $1 archive."  
         gunzip -c $larc.tgz | tar -xf -  
     elif [ -r $larc.tz ] ; then  
         echo "Un-compress-ing and un-tar-ing $1 archive."  
         zcat $larc.tz | tar -xf -  
274      elif [ $tryfetch = yes ] ; then      elif [ $tryfetch = yes ] ; then
275          urlgetter          urlgetter
276          $URLGETTER "$1" $4 $SRCARCHIVEURL          $URLGETTER "$1" $4 $SRCARCHIVEURL
# Line 230  Line 285 
285  unpack() {  unpack() {
286      tryfetch=yes      tryfetch=yes
287      if [ -d $2/$3 ]; then      if [ -d $2/$3 ]; then
288          echo "The $1 tree already exists."          echo "$this: The $1 tree already exists."
289      else      else
290          fetch_n_unpack "$1" "$2" "$3" "$4"          fetch_n_unpack "$1" "$2" "$3" "$4"
291      fi      fi
292      if [ ! -d $2/$3 ]; then      if [ ! -d $2/$3 ]; then
293          echo "!!! Unable to unpack $1 archive."          echo "$this: !!! Unable to unpack $1 archive."
294          exit 1          exit 1
295      fi      fi
296  }  }
# Line 248  Line 303 
303      if [ -d $1 ] ; then      if [ -d $1 ] ; then
304          if [ ! -d $2 ] ; then          if [ ! -d $2 ] ; then
305              if [ -f $2 ] ; then              if [ -f $2 ] ; then
306                  echo install.sh: $2 exists as a non-directory.                  echo $this: $2 exists as a non-directory.
307                  exit 1                  exit 1
308              fi              fi
309              mkdir $2              mkdir $2
# Line 264  Line 319 
319      fi      fi
320  }  }
321    
322  #  # move stable library file from $1 to $2
323  # Move the stable archive of a library whose description file was $1/$2 to  movelib()
324  # $LIBDIR/$2/CM/$ARCH-unix/$2 so that it appears as if the description file  {
325  # had been at $LIBDIR/$2/$2      SOURCE=$1
326  #      TARGET=$2
327  # (This script will also move all other libraries that show up in      TARGETDIR=`dirname ${TARGET}`
328  #  $1/CM/$ARCH-unix because in the case of the boot directory this indicates      if [ ! -d ${TARGETDIR} ] ; then
329  #  that some library did not have its own path anchor but was specified          makedir ${TARGETDIR}
330  #  relative to $1/$2. Still, don't rely on this to be robust -- rather make      fi
331  #  separate anchors for every library!)      mv ${SOURCE} ${TARGET}
 #  
 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  
             fi  
             echo Moving library $lib to $LIBDIR  
             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  
332  }  }
333    
334  # A shell function that registers a library for being built.  # A shell function that registers a library for being built.
335  # This function takes two arguments: 1. a name under which the library  # This function takes 3 arguments:
336  # is to be known later (something.cm) and 2. the path relative to $SRCDIR  #   $1 = controlling anchor
337  # that leads to the library's .cm file.  The library's .cm file must be the  #   $2 = name relative to controlling anchor
338  # same as $1.  #   $3 = dir (relative to ${SRCDIR}) corresponding to $1
339  #  #
340  # 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
341  # 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
342  # 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
343  # the end by putting a "movelibs" line into $LIBMOVESCRIPT.  # the end by putting a "movelib" line into $LIBMOVESCRIPT.
   
344  reglib() {  reglib() {
345        ANCHOR=$1
346        RELNAME=$2
347        LIBNAME='$'${ANCHOR}/${RELNAME}
348        ADIR=${SRCDIR}/$3
349        RELDIR=`dirname $RELNAME`
350        RELBASE=`basename $RELNAME`
351        if [ x$RELDIR = x. ] ; then
352            RELDIR=
353        else
354            RELDIR=/$RELDIR
355        fi
356        RELLOC=${RELDIR}/CM/${ARCH}-unix/${RELBASE}
357        SRCFINALLOC=${ADIR}${RELLOC}
358      if [ x$MOVE_LIBRARIES = xtrue ] ; then      if [ x$MOVE_LIBRARIES = xtrue ] ; then
359          FINALLOCATION=$LIBDIR/$1          FINALLOC=${LIBDIR}/${ANCHOR}${RELLOC}
360            FINALCONFIGPATH=${ANCHOR}
361      else      else
362          FINALLOCATION=$SRCDIR/$2          FINALLOC=${SRCFINALLOC}
363            FINALCONFIGPATH=${ADIR}
364      fi      fi
365      if [ -d $FINALLOCATION/CM/$ARCH-unix ] ; then  
366          echo "Library $1 already exists in $FINALLOCATION."      if [ -f ${FINALLOC} ] ; then
367            echo "$this: Library ${LIBNAME} already exists in ${FINALLOC}"
368      else      else
369          echo "Scheduling library $1 to be built in $FINALLOCATION."          echo "$this: Scheduling library ${LIBNAME} to be built as ${FINALLOC}."
370          echo "andalso CM.stabilize false \"$1\"" >>$LIBLIST          echo "  andalso CM.stabilize false \"${LIBNAME}\"" >>${LIBLIST}
371          echo $1 $SRCDIR/$2 >>$LOCALPATHCONFIG          echo ${ANCHOR} ${ADIR} >>${LOCALPATHCONFIG}
372          if [ x$MOVE_LIBRARIES = xtrue ] ; then          if [ x$MOVE_LIBRARIES = xtrue ] ; then
373              echo movelibs $SRCDIR/$2 $1 >>$LIBMOVESCRIPT              echo movelib ${SRCFINALLOC} ${FINALLOC} >>${LIBMOVESCRIPT}
374          fi          fi
         echo $1 $FINALLOCATION >>$CM_PATHCONFIG_DEFAULT  
375      fi      fi
376        echo ${ANCHOR} ${FINALCONFIGPATH} >>${CM_PATHCONFIG_DEFAULT}
377  }  }
378    
379  #  #
# Line 341  Line 393 
393          TARGETLOC=$TARGET          TARGETLOC=$TARGET
394      fi      fi
395      if [ -r $HEAPDIR/$TARGET ] ; then      if [ -r $HEAPDIR/$TARGET ] ; then
396          echo Target $TARGET already exists.          echo $this: Target $TARGET already exists.
397      else      else
398          echo Building $TARGET.          echo $this: Building $TARGET.
399          unpack $2 $SRCDIR $1 $1          unpack $2 $SRCDIR $1 $1
400          cd $SRCDIR/$1          cd $SRCDIR/$1
401          ./build          # build it, but make sure we don't pick up some (unrelated)
402            # local path configuration...
403            CM_LOCAL_PATHCONFIG=/dev/null ./build
404          if [ -r $TARGETLOC ] ; then          if [ -r $TARGETLOC ] ; then
405              mv $TARGETLOC $HEAPDIR/$TARGET              mv $TARGETLOC $HEAPDIR/$TARGET
406              if [ ! -f $BINDIR/$1 ] ; then              if [ ! -f $BINDIR/$1 ] ; then
# Line 354  Line 408 
408                  ln -s .run-sml $1                  ln -s .run-sml $1
409              fi              fi
410          else          else
411              echo "!!! Build of $TARGET failed."              echo "$this: !!! Build of $TARGET failed."
412          fi          fi
413      fi      fi
414  }  }
# Line 362  Line 416 
416  #  #
417  # create the various sub directories  # create the various sub directories
418  #  #
419  for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR  for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR ; do
 do  
420      makedir $dir      makedir $dir
421  done  done
422    
# Line 371  Line 424 
424  # 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
425  #  #
426  if [ -x $BINDIR/.arch-n-opsys ]; then  if [ -x $BINDIR/.arch-n-opsys ]; then
427      echo Script $BINDIR/.arch-n-opsys already exists.      echo $this: Script $BINDIR/.arch-n-opsys already exists.
428  else  else
429      cat $CONFIGDIR/_arch-n-opsys \      cat $CONFIGDIR/_arch-n-opsys \
430      | sed -e "s,@SHELL@,$SHELL,g" > $BINDIR/.arch-n-opsys      | sed -e "s,@SHELL@,$SHELL,g" > $BINDIR/.arch-n-opsys
431      chmod 555 $BINDIR/.arch-n-opsys      chmod 555 $BINDIR/.arch-n-opsys
432      if [ ! -x $BINDIR/.arch-n-opsys ]; then      if [ ! -x $BINDIR/.arch-n-opsys ]; then
433          echo "!!! Installation of $BINDIR/.arch-n-opsys failed."          echo "$this: !!! Installation of $BINDIR/.arch-n-opsys failed."
434          exit 1          exit 1
435      fi      fi
436  fi  fi
437    
438  ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`  ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`
439  if [ "$?" != "0" ]; then  if [ "$?" != "0" ]; then
440      echo "!!! Script $BINDIR/.arch-n-opsys fails on this machine."      echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine."
441      echo "!!! You must patch this by hand and repeat the installation."      echo "$this: !!! You must patch this by hand and repeat the installation."
442      exit 2      exit 2
443  else  else
444      echo Script $BINDIR/.arch-n-opsys reports $ARCH_N_OPSYS.      echo $this: Script $BINDIR/.arch-n-opsys reports $ARCH_N_OPSYS.
445  fi  fi
446  eval $ARCH_N_OPSYS  eval $ARCH_N_OPSYS
447    
# Line 404  Line 457 
457  # for an outdated driver script, but not all "test" commands understand  # for an outdated driver script, but not all "test" commands understand
458  # the -nt comparison operator....)  # the -nt comparison operator....)
459  #   if [ -x $BINDIR/$ddst ]; then  #   if [ -x $BINDIR/$ddst ]; then
460  #       echo Script $BINDIR/$ddst already exists.  #       echo $this: Script $BINDIR/$ddst already exists.
461  #   else  #   else
462          rm -f $BINDIR/$ddst          rm -f $BINDIR/$ddst
463          cat $CONFIGDIR/$dsrc | \          cat $CONFIGDIR/$dsrc | \
# Line 414  Line 467 
467              > $BINDIR/$ddst              > $BINDIR/$ddst
468          chmod 555 $BINDIR/$ddst          chmod 555 $BINDIR/$ddst
469          if [ ! -x $BINDIR/$ddst ]; then          if [ ! -x $BINDIR/$ddst ]; then
470              echo "!!! Installation of $BINDIR/${ddst} failed."              echo "$this: !!! Installation of $BINDIR/${ddst} failed."
471              exit 1              exit 1
472          fi          fi
473  #   fi  #   fi
# Line 423  Line 476 
476  installdriver _run-sml .run-sml  installdriver _run-sml .run-sml
477  installdriver _link-sml .link-sml  installdriver _link-sml .link-sml
478  installdriver _ml-build ml-build  installdriver _ml-build ml-build
479    installdriver _ml-makedepend ml-makedepend
480    
481  #  #
482  # set some architecture dependent run-time system flags  # set some architecture dependent run-time system flags
# Line 432  Line 486 
486          ALLOC=1M          ALLOC=1M
487          ;;          ;;
488      x86)      x86)
489            # The following is the _wrong_ value for many popular x86 chips
490            # (i.e., Celerons).  However, the optimal value for those is 32k,
491            # and such a small value is not enough for the runtime system's boot
492            # code.  Therefore, we use 256k here and re-set it to the proper
493            # value in .run-sml.
494          ALLOC=256k          ALLOC=256k
495          ;;          ;;
496      alpha32)      alpha32)
# Line 449  Line 508 
508      linux)      linux)
509          EXTRA_DEFS=`$CONFIGDIR/chk-global-names.sh`          EXTRA_DEFS=`$CONFIGDIR/chk-global-names.sh`
510          if [ "$?" != "0" ]; then          if [ "$?" != "0" ]; then
511              echo "!!! Problems checking for underscores in global names."              echo "$this: !!! Problems checking for underscores in asm names."
512              exit 1              exit 1
513          fi          fi
514          EXTRA_DEFS="XDEFS=$EXTRA_DEFS"          EXTRA_DEFS="XDEFS=$EXTRA_DEFS"
# Line 459  Line 518 
518  #  #
519  # the name of the bin files directory  # the name of the bin files directory
520  #  #
521  BOOT_FILES=sml.boot.$ARCH-unix  BOOT_ARCHIVE=boot.$ARCH-unix
522    BOOT_FILES=sml.$BOOT_ARCHIVE
523    
524  #  #
525  # build the run-time system  # build the run-time system
526  #  #
527  unpack "run-time" $SRCDIR runtime runtime  unpack "run-time" $SRCDIR runtime runtime
528  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then
529      echo Run-time system already exists.      echo $this: Run-time system already exists.
530  else  else
531      cd $SRCDIR/runtime/objs      cd $SRCDIR/runtime/objs
532      echo Compiling the run-time system.      echo $this: Compiling the run-time system.
533      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS
534      if [ -x run.$ARCH-$OPSYS ]; then      if [ -x run.$ARCH-$OPSYS ]; then
535          mv run.$ARCH-$OPSYS $RUNDIR          mv run.$ARCH-$OPSYS $RUNDIR
536          # $MAKE MAKE=$MAKE clean          $MAKE MAKE=$MAKE clean
537      else      else
538          echo "!!! Run-time system build failed for some reason."          echo "$this: !!! Run-time system build failed for some reason."
539          exit 1          exit 1
540      fi      fi
541  fi  fi
# Line 485  Line 545 
545  # boot the base SML system  # boot the base SML system
546  #  #
547  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then
548      echo Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.      echo $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.
549  else  else
550      unpack bin $ROOT $BOOT_FILES $BOOT_FILES      unpack bin $ROOT $BOOT_FILES $BOOT_ARCHIVE
551      cd $ROOT/$BOOT_FILES      cd $ROOT/$BOOT_FILES
552      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC
553      then      then
# Line 512  Line 572 
572              rm -rf $BOOT_FILES              rm -rf $BOOT_FILES
573    
574          else          else
575              echo "!!! Boot code did not produce heap image (sml.$HEAP_SUFFIX)."              echo "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."
576              exit 1              exit 1
577          fi          fi
578      else      else
579          echo "!!! Boot code failed, no heap image built (sml.$HEAP_SUFFIX)."          echo "$this !!! Boot code failed, no heap image (sml.$HEAP_SUFFIX)."
580          exit 1          exit 1
581      fi      fi
582  fi  fi
# Line 526  Line 586 
586  #  #
587  cd $ROOT  cd $ROOT
588  rm -f $LOCALPATHCONFIG $LIBLIST  rm -f $LOCALPATHCONFIG $LIBLIST
589  echo 'OS.Process.exit (if true' >$LIBLIST  echo 'ignore (OS.Process.exit (if true' >$LIBLIST
590    
591  #  #
592  # now build (or prepare to build) the individual targets  # now build (or prepare to build) the individual targets
593  #  #
594  cd $SRCDIR  cd $SRCDIR
595  echo Installing other targets.  echo $this: Installing other targets.
596  for i in $TARGETS ; do  for i in $TARGETS ; do
597      case $i in      case $i in
598        src-smlnj)        src-smlnj)
# Line 553  Line 613 
613          standalone ml-burg ML-Burg          standalone ml-burg ML-Burg
614          echo ml-burg $TOOLDIR >>$CM_PATHCONFIG_DEFAULT          echo ml-burg $TOOLDIR >>$CM_PATHCONFIG_DEFAULT
615          ;;          ;;
616          ml-nlffigen)
617            echo standalone ml-nlffigen ML-NLFFI-Gen >>$LATESTANDALONES
618            echo ml-nlffigen $TOOLDIR >>$CM_PATHCONFIG_DEFAULT
619            ;;
620        smlnj-lib)        smlnj-lib)
621          unpack "SML/NJ Library" $SRCDIR smlnj-lib smlnj-lib          unpack "SML/NJ Library" $SRCDIR smlnj-lib smlnj-lib
622    
623          # 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
624          # installed when making the base system.  In other words, don't do...          # installed when making the base system.  In other words, don't do...
625              #reglib smlnj-lib.cm smlnj-lib/Util              #reglib smlnj-lib.cm smlnj-lib.cm smlnj-lib/Util
626          # ... and don't make the HTML library ...          # ... and don't make the HTML library ...
627              #reglib html-lib.cm smlnj-lib/HTML              #reglib html-lib.cm html-lib.cm smlnj-lib/HTML
628          # ... and don't make the PP library ...          # ... and don't make the PP library ...
629              #reglib pp-lib.cm smlnj-lib/PP              #reglib pp-lib.cm pp-lib.cm smlnj-lib/PP
630          # make the Unix library          # make the Unix library
631              reglib unix-lib.cm smlnj-lib/Unix              reglib unix-lib.cm unix-lib.cm smlnj-lib/Unix
632          # make the INet library          # make the INet library
633              reglib inet-lib.cm smlnj-lib/INet              reglib inet-lib.cm inet-lib.cm smlnj-lib/INet
634          # make the RegExp library          # make the RegExp library
635              reglib regexp-lib.cm smlnj-lib/RegExp              reglib regexp-lib.cm regexp-lib.cm smlnj-lib/RegExp
636          # make the Reactive library          # make the Reactive library
637              reglib reactive-lib.cm smlnj-lib/Reactive              reglib reactive-lib.cm reactive-lib.cm smlnj-lib/Reactive
638          ;;          ;;
639        cml)        cml)
640          unpack CML $SRCDIR cml cml          unpack CML $SRCDIR cml cml
641          reglib core-cml.cm cml/src/core-cml          reglib cml core-cml.cm cml/src
642          reglib cml.cm cml/src          reglib cml cml-internal.cm cml/src
643          reglib cml-basis.cm cml          reglib cml cml.cm cml/src
644            reglib cml basis.cm cml/src
645          ;;          ;;
646        cml-lib)        cml-lib)
647          unpack CML $SRCDIR cml cml          unpack CML $SRCDIR cml cml
648          reglib cml-lib.cm cml/cml-lib          reglib cml-lib trace-cml.cm cml/cml-lib/cm
649            reglib cml-lib smlnj-lib.cm cml/cml-lib/cm
650          ;;          ;;
651        eXene)        eXene)
652          unpack EXene $SRCDIR eXene eXene          unpack EXene $SRCDIR eXene eXene
653          reglib eXene.cm eXene          reglib eXene.cm eXene.cm eXene
654            ;;
655          ckit)
656            unpack "C-Kit" $ROOT ckit ckit
657            reglib ckit-lib.cm ckit-lib.cm ../ckit/src
658            ;;
659          ml-nlffi-lib)
660            unpack "NLFFI Library" $SRCDIR ml-nlffi-lib ml-nlffi-lib
661            reglib memory.cm memory.cm ml-nlffi-lib/memory
662            reglib c-int.cm c-int.cm ml-nlffi-lib/internals
663            reglib c.cm c.cm ml-nlffi-lib
664            ;;
665          pgraph-util)
666            unpack "CM source code" $SRCDIR cm cm
667            reglib pgraph-util.cm pgraph-util.cm cm/pgraph
668          ;;          ;;
669        doc)        doc)
670          unpack Doc $ROOT doc doc          unpack Doc $ROOT doc doc
# Line 592  Line 672 
672          build $ROOT          build $ROOT
673          ;;          ;;
674        *)        *)
675          echo "!!! Unknown target $i."          echo "$this: !!! Unknown target $i."
676          ;;          ;;
677      esac      esac
678  done  done
# Line 603  Line 683 
683  # $SRCDIR, so we must consult $LOCALPATHCONFIG.  # $SRCDIR, so we must consult $LOCALPATHCONFIG.
684  #  #
685    
686  echo Compiling library code.  echo $this: Compiling library code.
687  echo 'then OS.Process.success else OS.Process.failure);' >>$LIBLIST  echo 'then OS.Process.success else OS.Process.failure));' >>$LIBLIST
688  if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then  if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then
689      echo Libraries compiled successfully.      echo $this: Libraries compiled successfully.
690  else  else
691      echo "!!! Something went wrong when compiling the libraries."      echo "$this: !!! Something went wrong when compiling the libraries."
692      exit 1      exit 1
693  fi  fi
694    
695  #  #
696  # Finally, move the libraries to their final locations...  # Move the libraries to their final locations...
697  #  #
698    
699  if [ -r $LIBMOVESCRIPT ] ; then  if [ -r $LIBMOVESCRIPT ] ; then
700      echo Moving libraries to $LIBDIR.      echo $this: Moving libraries to $LIBDIR.
701      . $LIBMOVESCRIPT      . $LIBMOVESCRIPT
702  fi  fi
703    
704    #
705    # Build "late" standalone programs (i.e., those that must be built
706    # after libraries are already in place):
707    #
708    
709    if [ -r $LATESTANDALONES ] ; then
710        echo $this: Building late standalone programs.
711        . $LATESTANDALONES
712    fi
713    
714    #
715    # Finally, remove duplicate entries from pathconfig file...
716    #
717    if [ -f $CM_PATHCONFIG_DEFAULT ] ; then
718        cp $CM_PATHCONFIG_DEFAULT $PCEDITTMP
719        rm -f $CM_PATHCONFIG_DEFAULT
720        awk <$PCEDITTMP 'NF == 2 { mapping[$1] = $2 }
721    NF != 2 { print $0 }
722    END { for (i in mapping) print i, mapping[i] }' \
723          | sort >$CM_PATHCONFIG_DEFAULT
724    fi
725    
726  exit 0  exit 0

Legend:
Removed from v.573  
changed lines
  Added in v.975

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