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

sml/trunk/config/install.sh revision 537, Fri Feb 18 17:20:16 2000 UTC config/trunk/install.sh revision 3615, Mon May 16 21:12:52 2011 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2  #  #
3  # Copyright (c) 1994 AT&T Bell Laboratories.  # Copyright (c) 1994 AT&T Bell Laboratories.
4    # Copyright (c) 2003 The Fellowship of SML/NJ
5  #  #
6  # Installation script for SML/NJ and related tools; this is a temporary  # Installation script for SML/NJ and related tools; this is a temporary
7  # placeholder until the configuration tool is finished.  # placeholder until the configuration tool is finished.
8  #  #
9  # Significant changes to accommodate (and take advantage of) the new CM  # Significant changes to take advantage of a new portable installer
10  # by M.Blume (2/2000).  # script for everything after booting the interactive system.
11  #  #
12    # Author: Matthias Blume (blume@tti-c.org)
 #  
 # get the target list  
13  #  #
14  if [ ! -r config/targets ]; then  
15      echo "!!! File config/targets is missing."  if [ x$1 = xnolib ] ; then
16      exit 1      nolib=true
17    else
18        nolib=false
19    fi
20    
21    if [ x${INSTALL_QUIETLY} = xtrue ] ; then
22        export CM_VERBOSE
23        CM_VERBOSE=false
24    fi
25    
26    vsay() {
27        if [ x${INSTALL_DEBUG} = xtrue ] ; then
28            echo "$@"
29        elif [ x${INSTALL_QUIETLY} = xtrue ] ; then
30            :
31        else
32            echo "$@"
33  fi  fi
34  . config/targets  }
35    
36    complain() {
37        echo "$@"
38        exit 1
39    }
40    
41    this=$0
42    
43    
44  #  #
45  # create the preloads.standard file  # create the preloads.standard file
46  #  #
47  if [ ! -r config/preloads ]; then  if [ ! -r config/preloads ]; then
48      echo "!!! File config/preloads is missing."      complain "$this: !!! File config/preloads is missing."
     exit 1  
49  fi  fi
50  cp config/preloads preloads.standard  cp config/preloads preloads.standard
51    
# Line 34  Line 56 
56  MAKE=make  MAKE=make
57    
58  SHELL=/bin/sh  SHELL=/bin/sh
59  echo Using shell $SHELL.  vsay $this: Using shell $SHELL.
60    
61  #  #
62  # set the SML root directory  # set the SML root directory
63  #  #
64  REAL_PWD=`pwd`  REAL_PWD=`pwd`
65  ROOT=${PWD:-$REAL_PWD}  ROOT=${PWD:-$REAL_PWD}
66  echo SML root is $ROOT.  vsay $this: SML root is $ROOT.
67  echo Installation directory is ${INSTALLDIR:=$ROOT}.  
68    cd "${INSTALLDIR:=$ROOT}"
69    INSTALLDIR=`pwd`
70    cd "$ROOT"
71    vsay $this: Installation directory is ${INSTALLDIR}.
72    
73  #  #
74  # set the various directory and file pathname variables  # set the various directory and file pathname variables
# Line 51  Line 77 
77  CONFIGDIR=$ROOT/config  CONFIGDIR=$ROOT/config
78  HEAPDIR=$BINDIR/.heap           # where heap images live  HEAPDIR=$BINDIR/.heap           # where heap images live
79  RUNDIR=$BINDIR/.run             # where executables (i.e., the RTS) live  RUNDIR=$BINDIR/.run             # where executables (i.e., the RTS) live
80  SRCDIR=$ROOT/src                # where the source tree is rooted  BASEDIR=$ROOT/base              # where the base source tree is rooted
81  LIBDIR=$INSTALLDIR/lib          # where libraries live  LIBDIR=$INSTALLDIR/lib          # where libraries live
 LIBLIST=$ROOT/liblist           # list of commands to stabilize libraries  
 LIBMOVESCRIPT=$ROOT/libmove     # a temporary script  
 LOCALPATHCONFIG=$INSTALLDIR/pathconfig # a temporary pathconfig file  
82    
83  #  #
84  # the path to the dir where ml-yacc, ml-burg, ml-lex, and ml-build live  # files to be deleted after we are done...
85    #
86    tmpfiles=""
87    tmpfiles="$tmpfiles preloads.standard"
88    #
89    # make sure we always clean up after ourselves...
90  #  #
91  TOOLDIR=$BINDIR  trap 'cd "$ROOT"; rm -f $tmpfiles' 0 1 2 3 15
92    
93    
94  #  #
95  # set the CM configuration variables (these are environment variables  # set the CM configuration variables (these are environment variables
96  # that will be queried by the bootstrap code)  # that will be queried by the bootstrap code)
97  # Especially important is CM_PATHCONFIG_DEFAULT.  # Especially important is CM_PATHCONFIG.
98  #  #
99  CM_PATHCONFIG_DEFAULT=$LIBDIR/pathconfig  export CM_PATHCONFIG
100  export CM_PATHCONFIG_DEFAULT  CM_PATHCONFIG=$LIBDIR/pathconfig
   
101  #  #
102  # the release version that we are installing  # the release version that we are installing
103  #  #
104  VERSION=`cat $CONFIGDIR/version`  VERSION=`cat "$CONFIGDIR/version"`
105  echo Installing version $VERSION.  vsay $this: Installing version $VERSION.
106    
107  #  #
108  # Function to make a directory (and advertise such action).  # the URL for the (usually remote) source archive
109  #  #
110  makedir() {  . "$CONFIGDIR"/srcarchiveurl
111      if [ ! -d $1 ] ; then  vsay $this: URL of source archive is $SRCARCHIVEURL.
         echo Making directory $1  
         if mkdir $1 ; then  
             : everything is fine  
         else  
             echo "!!! Unable to make directory $1!"  
             exit 1  
         fi  
     fi  
 }  
112    
113  #  #
114  # Function to unpack a source archive.  # Function to make a directory including its ancestors.
115  #  #
116  # $1: descriptive name of the sources to be unpacked  makedir() {
117  # $2: the directory into which to unpack the sources      if [ x"$1" = x ] ; then
118  # $3: the sub-directory of $2 that is going to be created by unpacking          :
119  # $4: the basename of the source archive (the script will check several      elif [ -d "$1" ] ; then
120  #     different suffixes to determine what kind of de-compression is to          :
121  #     be used)      else
122  unpack() {          makedirtmp=`dirname "$1"`
123      if [ -d $2/$3 ]; then          makedir "$makedirtmp"
124          echo "The $1 source tree already exists."          if [ x${INSTALL_VERBOSE} = xtrue ] ; then
125      else              vsay "$this: Making directory $1"
         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 -  
         else  
             echo "!!! The $1 source archive is missing."  
             exit 1  
126          fi          fi
127          if [ ! -d $2/$3 ]; then          if mkdir "$1" ; then
128              echo "!!! Unable to unpack $1 source archive."              :
129              exit 1          else
130                complain "$this: !!! Unable to make directory $1!"
131          fi          fi
132      fi      fi
133  }  }
134    
135  #  #
136  # Move the stable archive of a library whose description file was $1/$2 to  # Fish out the CM metadata directory name from library files
137  # $LIBDIR/$2/CM/$ARCH-unix/$2 so that it appears as if the description file  # and store it in ORIG_CM_DIR_ARC.
138  # had been at $LIBDIR/$2/$2  # The single argument is the name of the directory containing
139  #  # a single subdirectory which is a CM metadata directory:
140  # (This script will also move all other libraries that show up in  #
141  #  $1/CM/$ARCH-unix because in the case of the boot directory this indicates  fish() {
142  #  that some library did not have its own path anchor but was specified      cd "$1"
143  #  relative to $1/$2. Still, don't rely on this to be robust -- rather make      ORIG_CM_DIR_ARC=unknown
144  #  separate anchors for every library!)      for i in * .[a-zA-Z0-9]* ; do
145  #          if [ -d $i ] ; then
146  movelibs() {              ORIG_CM_DIR_ARC=$i
147      for lib in `/bin/ls $1/CM/$ARCH-unix` ; do              break
148          case $lib in          fi
         *.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  
149       done       done
150        if [ $ORIG_CM_DIR_ARC = unknown ] ; then
151            complain "$this: could not determine CM metadata directory name"
152        else
153            echo "$this: CM metadata directory name is \"${ORIG_CM_DIR_ARC}\""
154        fi
155  }  }
156    
157  # A shell function that registers a library for being built.  
158  # This function takes two arguments: 1. a name under which the library  # A function to move all stable library files to a parallel directory
159  # is to be known later (something.cm) and 2. the path relative to $SRCDIR  # hierarchy.
160  # that leads to the library's .cm file.  The library's .cm file must be the  # The first argument must be a simple path (no / inside), and
161  # same as $1.  # the second argument must be an absolute path.
162  #  move() {
163  # This works by adding ML code to file $LIBLIST.  The code in this file      if [ -L "$1" ] ; then
164  # will be executed near the end of this script.  If $MOVE_LIBRARIES is          rm -f "$1"           # remove symbolic link made by diracs (see below)
165  # set to true, then reglib will also register a "movelibs" to be executed at      elif [ -d "$1" ] ; then
166  # the end by putting a "movelibs" line into $LIBMOVESCRIPT.          if [ ! -d "$2" ] ; then
167                if [ -f "$2" ] ; then
168  reglib() {                  complain $this: $2 exists as a non-directory.
169      if [ x$MOVE_LIBRARIES = xtrue ] ; then              fi
170          FINALLOCATION=$LIBDIR/$1              mkdir "$2"
171      else          fi
172          FINALLOCATION=$SRCDIR/$2          cd "$1"
173      fi          for i in * .[a-zA-Z0-9]* ; do
174      if [ -d $FINALLOCATION/CM/$ARCH-unix ] ; then              move "$i" "$2"/"$i"
175          echo "Library $1 already exists in $FINALLOCATION."          done
176      else          cd ..
177          echo "Scheduling library $1 to be built in $FINALLOCATION."      elif [ -f "$1" ] ; then
178          echo "andalso CM.stabilize false \"$1\"" >>$LIBLIST          rm -f "$2"
179          echo $1 $SRCDIR/$2 >>$LOCALPATHCONFIG          mv "$1" "$2"
         if [ x$MOVE_LIBRARIES = xtrue ] ; then  
             echo movelibs $SRCDIR/$2 $1 >>$LIBMOVESCRIPT  
         fi  
         echo $1 $FINALLOCATION >>$CM_PATHCONFIG_DEFAULT  
180      fi      fi
181  }  }
182    
183  #  #
184  # Function to build a standalone program such as ml-yacc.  The function takes  # Traverse the directory tree rooted at $3 (must be single arc!).
185  # 2 or 3 arguments.  First the name of the program which at the same time  # Find all directories named $1, rename them into $2 and make
186  # is the directory name under $SRCDIR where the sources reside.  The second  # and establish $1 as a symbolic link to $2:
187  # argument is a descriptive name for the program (passed on to "unpack").  #
188  # The optional third argument specifies the path relative to $SRCDIR/$1  dirarcs() {
189  # of the directory where the program's heap image is to be found.      if [ -d "$3" ] ; then
190  #          if [ "$3" = "$1" ] ; then
191                mv "$1" "$2"
192  standalone() {              ln -s "$2" "$1"
193      TARGET=$1.$HEAP_SUFFIX          else
194      if [ $# = 3 ] ; then              cd "$3"
195          TARGETLOC=$3/$TARGET              for d in * .[a-zA-Z0-9]* ; do
196      else                  dirarcs "$1" "$2" "$d"
197          TARGETLOC=$TARGET              done
198      fi              cd ..
     if [ -r $HEAPDIR/$TARGET ] ; then  
         echo Target $TARGET already exists.  
     else  
         echo Building $TARGET.  
         unpack $2 $SRCDIR $1 $ROOT/$VERSION-$1  
         cd $SRCDIR/$1  
         ./build  
         if [ -r $TARGETLOC ] ; then  
             mv $TARGETLOC $HEAPDIR/$TARGET  
             if [ ! -f $BINDIR/$1 ] ; then  
                 cd $BINDIR  
                 ln -s .run-sml $1  
             fi  
         else  
             echo "!!! Build of $TARGET failed."  
199          fi          fi
200      fi      fi
201  }  }
202    
203    
204    ######################################################################
205    
206  #  #
207  # create the various sub directories  # create the various sub directories
208  #  #
209  for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR  for dir in "$BINDIR" "$HEAPDIR" "$RUNDIR" "$LIBDIR" "$BASEDIR" ; do
210  do      makedir "$dir"
     makedir $dir  
211  done  done
212    
213  #  #
 # install the script that tests the architecture, and make sure that it works  
 #  
 if [ -x $BINDIR/.arch-n-opsys ]; then  
     echo Script $BINDIR/.arch-n-opsys already exists.  
 else  
     cat $CONFIGDIR/_arch-n-opsys \  
     | sed -e "s,@SHELL@,$SHELL,g" > $BINDIR/.arch-n-opsys  
     chmod 555 $BINDIR/.arch-n-opsys  
     if [ ! -x $BINDIR/.arch-n-opsys ]; then  
         echo "!!! Installation of $BINDIR/.arch-n-opsys failed."  
         exit 1  
     fi  
 fi  
   
 ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`  
 if [ "$?" != "0" ]; then  
     echo "!!! Script $BINDIR/.arch-n-opsys fails on this machine."  
     echo "!!! You must patch this by hand and repeat the installation."  
     exit 2  
 else  
     echo Script $BINDIR/.arch-n-opsys reports $ARCH_N_OPSYS.  
 fi  
 eval $ARCH_N_OPSYS  
   
 #  
214  # Function to install a "driver" script...  # Function to install a "driver" script...
215  #   This takes care of patching the source of the script with the SHELL,  #   This takes care of patching the source of the script with the SHELL,
216  #   BINDIR, and VERSION variables to use.  #   BINDIR, and VERSION variables to use.
# Line 265  Line 218 
218  installdriver() {  installdriver() {
219      dsrc=$1      dsrc=$1
220      ddst=$2      ddst=$2
221      if [ -x $BINDIR/$ddst ]; then  # We install the driver unconditionally. (It would be better to test
222          echo Script $BINDIR/$ddst already exists.  # for an outdated driver script, but not all "test" commands understand
223      else  # the -nt comparison operator....)
224          cat $CONFIGDIR/$dsrc | \  #   if [ -x $BINDIR/$ddst ]; then
225    #       echo $this: Script $BINDIR/$ddst already exists.
226    #   else
227            rm -f "$BINDIR"/"$ddst"
228            cat "$CONFIGDIR"/"$dsrc" | \
229          sed -e "s,@SHELL@,$SHELL,g" \          sed -e "s,@SHELL@,$SHELL,g" \
230              -e "s,@BINDIR@,$BINDIR," \              -e "s,@BINDIR@,$BINDIR," \
231                -e "s,@LIBDIR@,$LIBDIR," \
232              -e "s,@VERSION@,$VERSION," \              -e "s,@VERSION@,$VERSION," \
233              > $BINDIR/$ddst              -e "s,@CMDIRARC@,${CM_DIR_ARC:-dummy}," \
234          chmod 555 $BINDIR/$ddst              > "$BINDIR"/"$ddst"
235          if [ ! -x $BINDIR/$ddst ]; then          chmod 555 "$BINDIR"/"$ddst"
236              echo "!!! Installation of $BINDIR/${ddst} failed."          if [ ! -x "$BINDIR"/"$ddst" ]; then
237              exit 1              complain "$this: !!! Installation of $BINDIR/${ddst} failed."
         fi  
238      fi      fi
239    #   fi
240  }  }
241    
242    #
243    # install the script that tests architecture and os...
244    #
245    installdriver _arch-n-opsys .arch-n-opsys
246    
247    #
248    # run it to figure out what architecture and os we are using, define
249    # corresponding variables...
250    #
251    ARCH_N_OPSYS=`"$BINDIR"/.arch-n-opsys`
252    if [ "$?" != "0" ]; then
253        echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine."
254        echo "$this: !!! You must patch this by hand and repeat the installation."
255        exit 2
256    else
257        vsay $this: Script $BINDIR/.arch-n-opsys reports $ARCH_N_OPSYS.
258    fi
259    eval $ARCH_N_OPSYS
260    
261    #
262    # now install most of the other driver scripts
263    #  (except ml-build, since we don't know $CM_DIR_ARC yet)
264    #
265  installdriver _run-sml .run-sml  installdriver _run-sml .run-sml
266  installdriver _link-sml .link-sml  installdriver _link-sml .link-sml
267  installdriver _ml-build ml-build  installdriver _ml-makedepend ml-makedepend
268    
269    installdriver _heap2exec heap2exec
270    
271  #  #
272  # set some architecture dependent run-time system flags  # set some architecture dependent run-time system flags
# Line 293  Line 276 
276          ALLOC=1M          ALLOC=1M
277          ;;          ;;
278      x86)      x86)
279          ALLOC=256k          # The following is the _wrong_ value for some x86 chips
280            # (i.e., Celerons).  We use 512k here and re-set it to the proper
281            # value in .run-sml.
282            ALLOC=512k
283          ;;          ;;
284      alpha32)      alpha32)
285          ALLOC=512k          ALLOC=512k
# Line 308  Line 294 
294          MAKE=/usr/ccs/bin/make          MAKE=/usr/ccs/bin/make
295          ;;          ;;
296      linux)      linux)
297          EXTRA_DEFS=`$CONFIGDIR/chk-global-names.sh`          EXTRA_DEFS=`"$CONFIGDIR/chk-global-names.sh"`
298          if [ "$?" != "0" ]; then          if [ "$?" != "0" ]; then
299              echo "!!! Problems checking for underscores in global names."              complain "$this: !!! Problems checking for underscores in asm names."
             exit 1  
300          fi          fi
301          EXTRA_DEFS="XDEFS=$EXTRA_DEFS"          EXTRA_DEFS="XDEFS=$EXTRA_DEFS"
302          ;;          ;;
303  esac  esac
304    
305  #  #
306  # the name of the bin files directory  # on 64-bit linux systems, we need to check to see if the 32-bit emulation
307    # support is installed
308  #  #
309  BOOT_FILES=sml.boot.$ARCH-unix  if [ x"$ARCH" = "xx86" -a x"$OPSYS" = "xlinux" ] ; then
310      case `uname -m` in
311        x86_64)
312          tmpFile=smlnj-test$$
313          echo "int main () { return 0; }" >> /tmp/$tmpFile.c
314          gcc -m32 -o /tmp/$tmpFile /tmp/$tmpFile.c 2> /dev/null 1>> /dev/null
315          if [ "$?" != "0" ] ; then
316            rm -f /tmp/$tmpFile /tmp/$tmpFile.c
317            complain "$this: !!! SML/NJ requires support for 32-bit executables"
318          else
319            rm -f /tmp/$tmpFile /tmp/$tmpFile.c
320          fi
321        ;;
322        *) ;;
323      esac
324    fi
325    
326  #  #
327  # files to be deleted after we are done...  # the name of the bin files directory
 #  
 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...  
328  #  #
329  trap 'rm -rf $tmpfiles' 0 1 2 3 15  BOOT_ARCHIVE=boot.$ARCH-unix
330    BOOT_FILES=sml.$BOOT_ARCHIVE
331    
332  #  #
333  # build the run-time system  # build the run-time system
334  #  #
335  unpack "run-time" $SRCDIR runtime $ROOT/$VERSION-runtime  if [ -x "$RUNDIR"/run.$ARCH-$OPSYS ]; then
336  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then      vsay $this: Run-time system already exists.
     echo Run-time system already exists.  
337  else  else
338      cd $SRCDIR/runtime/objs      "$CONFIGDIR"/unpack "$ROOT" runtime
339      echo Compiling the run-time system.      cd "$BASEDIR"/runtime/objs
340        echo $this: Compiling the run-time system.
341      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS
342      if [ -x run.$ARCH-$OPSYS ]; then      if [ -x run.$ARCH-$OPSYS ]; then
343          mv run.$ARCH-$OPSYS $RUNDIR          mv run.$ARCH-$OPSYS "$RUNDIR"
344          # $MAKE MAKE=$MAKE clean          if [ -f runx.$ARCH-$OPSYS ]; then
345                mv runx.$ARCH-$OPSYS "$RUNDIR"
346            fi
347            if [ -f run.$ARCH-$OPSYS.so ]; then
348                mv run.$ARCH-$OPSYS.so "$RUNDIR"
349            fi
350            if [ -f run.$ARCH-$OPSYS.a ]; then
351                mv run.$ARCH-$OPSYS.a "$RUNDIR"
352            fi
353            $MAKE MAKE=$MAKE clean
354      else      else
355          echo "!!! Run-time system build failed for some reason."          complain "$this: !!! Run-time system build failed for some reason."
         exit 1  
356      fi      fi
357  fi  fi
358  cd $SRCDIR  cd "$BASEDIR"
359    
360  #  #
361  # boot the base SML system  # boot the base SML system
362  #  #
363  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then  if [ -r "$HEAPDIR"/sml.$HEAP_SUFFIX ]; then
364      echo Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.      vsay $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.
365        fish "$LIBDIR"/smlnj/basis
366        # ignore requested arc name since we have to live with what is there:
367        export CM_DIR_ARC
368        CM_DIR_ARC=$ORIG_CM_DIR_ARC
369        # now re-dump the heap image:
370        vsay "$this: Re-creating a (customized) heap image..."
371        "$BINDIR"/sml @CMredump "$ROOT"/sml
372        cd "$ROOT"
373        if [ -r sml.$HEAP_SUFFIX ]; then
374            mv sml.$HEAP_SUFFIX "$HEAPDIR"
375  else  else
376      unpack bin $ROOT $BOOT_FILES $ROOT/$VERSION-$BOOT_FILES          complain "$this !!! Unable to re-create heap image (sml.$HEAP_SUFFIX)."
377      cd $ROOT/$BOOT_FILES      fi
378      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC  else
379        "$CONFIGDIR"/unpack "$ROOT" "$BOOT_ARCHIVE"
380    
381        fish "$ROOT"/"$BOOT_FILES"/smlnj/basis
382    
383        cd "$ROOT"
384    
385        # Target arc:
386        export CM_DIR_ARC
387        CM_DIR_ARC=${CM_DIR_ARC:-".cm"}
388    
389        if [ $CM_DIR_ARC = $ORIG_CM_DIR_ARC ] ; then
390            : we are happy
391        else
392            # now we have to make a symbolic link for each occurrence of
393            # $ORIG_CM_DIR_ARC to $CM_DIR_ARC
394            dirarcs "$ORIG_CM_DIR_ARC" "$CM_DIR_ARC" "$BOOT_FILES"
395        fi
396    
397        cd "$ROOT"/"$BOOT_FILES"
398    
399        # now link (boot) the system and let it initialize itself...
400        if "$BINDIR"/.link-sml @SMLheap="$ROOT"/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC
401      then      then
402          cd $ROOT          cd "$ROOT"
403          if [ -r sml.$HEAP_SUFFIX ]; then          if [ -r sml.$HEAP_SUFFIX ]; then
404              mv sml.$HEAP_SUFFIX $HEAPDIR              mv sml.$HEAP_SUFFIX "$HEAPDIR"
405              cd $BINDIR              cd "$BINDIR"
406              ln -s .run-sml sml              ln -s .run-sml sml
407              #              #
408              # Now move all stable libraries to #LIBDIR and generate              # Now move all stable libraries to #LIBDIR and generate
409              # the pathconfig file.              # the pathconfig file.
410              #              #
411              cd $ROOT/$BOOT_FILES              cd "$ROOT"/"$BOOT_FILES"
412              for lib in *.cm ; do              for anchor in * ; do
413                  echo $lib $LIBDIR/$lib >>$CM_PATHCONFIG_DEFAULT                  if [ -d $anchor ] ; then
414                  movelibs $ROOT/$BOOT_FILES/$lib $lib                      echo $anchor $anchor >>$CM_PATHCONFIG
415                        move $anchor "$LIBDIR"/$anchor
416                    fi
417              done              done
418              cd $ROOT              cd "$ROOT"
419              # rm -rf $BOOT_FILES              # $BOOT_FILES is now only an empty skeleton, let's get rid of it.
420                rm -rf "$BOOT_FILES"
421    
422          else          else
423              echo "!!! Boot code did not produce heap image (sml.$HEAP_SUFFIX)."              complain "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."
             exit 1  
424          fi          fi
425      else      else
426          echo "!!! Boot code failed, no heap image built (sml.$HEAP_SUFFIX)."          complain "$this !!! Boot code failed, no heap image (sml.$HEAP_SUFFIX)."
         exit 1  
427      fi      fi
428  fi  fi
429    
430  #  #
431  # Initialize $LIBLIST  # now that we know CM_DIR_ARC we can install the ml-build driver...
432  #  #
433  cd $ROOT  installdriver _ml-build ml-build
 rm -f $LOCALPATHCONFIG $LIBLIST  
 echo 'OS.Process.exit (if true' >$LIBLIST  
   
 #  
 # now build (or prepare to build) the individual targets  
 #  
 cd $SRCDIR  
 echo Installing other targets.  
 for i in $TARGETS ; do  
     case $i in  
       src-smlnj)  
         for src in compiler cm MLRISC smlnj-lib ml-yacc system  
         do  
             unpack $src $ROOT/src $src $ROOT/$VERSION-$src  
         done  
         ;;  
       ml-yacc)  
         standalone ml-yacc ML-Yacc src  
         echo ml-yacc $TOOLDIR >>$CM_PATHCONFIG_DEFAULT  
         ;;  
       ml-lex)  
         standalone ml-lex ML-Lex  
         echo ml-lex $TOOLDIR >>$CM_PATHCONFIG_DEFAULT  
         ;;  
       ml-burg)  
         standalone ml-burg ML-Burg  
         echo ml-burg $TOOLDIR >>$CM_PATHCONFIG_DEFAULT  
         ;;  
       smlnj-lib)  
         unpack "SML/NJ Library" $SRCDIR smlnj-lib $ROOT/$VERSION-smlnj-lib  
434    
435          # Don't make the Util library -- it came pre-made and has been  cd "$ROOT"
         # installed when making the base system.  In other words, don't do...  
             #reglib smlnj-lib.cm smlnj-lib/Util  
         # ... and don't make the HTML library ...  
             #reglib html-lib.cm smlnj-lib/HTML  
         # ... and don't make the PP library ...  
             #reglib pp-lib.cm smlnj-lib/PP  
         # make the Unix library  
             reglib unix-lib.cm smlnj-lib/Unix  
         # make the INet library  
             reglib inet-lib.cm smlnj-lib/INet  
         # make the RegExp library  
             reglib regexp-lib.cm smlnj-lib/RegExp  
         # make the Reactive library  
             reglib reactive-lib.cm smlnj-lib/Reactive  
         ;;  
       cml)  
         unpack CML $SRCDIR cml $ROOT/$VERSION-cml  
         reglib core-cml.cm cml/src/core-cml  
         reglib cml.cm cml/src  
         reglib cml-basis.cm cml  
         ;;  
       cml-lib)  
         unpack CML $SRCDIR cml $ROOT/$VERSION-cml  
         reglib cml-lib.cm cml/cml-lib  
         ;;  
       eXene)  
         unpack EXene $SRCDIR eXene $ROOT/$VERSION-eXene  
         reglib eXene.cm eXene  
         ;;  
       doc)  
         unpack Doc $ROOT doc $ROOT/$VERSION-doc  
         cd $ROOT/doc  
         build $ROOT  
         ;;  
       *)  
         echo "!!! Unknown target $i."  
         ;;  
     esac  
 done  
436    
437  #  #
438  # Now go and stabilize all registered libraries...  # Now do all the rest using the precompiled installer:
 # This is done with library sources in their original locations inside  
 # $SRCDIR, so we must consult $LOCALPATHCONFIG.  
439  #  #
440    if [ $nolib = false ] ; then
441  echo Compiling library code.      echo $this: Installing other libraries and programs:
442  echo 'then OS.Process.success else OS.Process.failure);' >>$LIBLIST      export ROOT INSTALLDIR CONFIGDIR BINDIR
443  if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then      CM_TOLERATE_TOOL_FAILURES=true
444      echo Libraries compiled successfully.      export CM_TOLERATE_TOOL_FAILURES
445        if "$BINDIR"/sml -m \$smlnj/installer.cm
446        then
447            vsay $this: Installation complete.
448  else  else
449      echo "!!! Something went wrong when compiling the libraries."          complain "$this: !!! Installation of libraries and programs failed."
     exit 1  
450  fi  fi
   
 #  
 # Finally, move the libraries to their final locations...  
 #  
   
 if [ -r $LIBMOVESCRIPT ] ; then  
     echo Moving libraries to $LIBDIR.  
     . $LIBMOVESCRIPT  
451  fi  fi
452    
453  exit 0  exit 0

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

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