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 814, Tue May 1 15:44:45 2001 UTC revision 1794, Wed May 18 16:59:22 2005 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)
13  #  #
14    
15  this=$0  if [ x$1 = xnolib ] ; then
16        nolib=true
17    else
18        nolib=false
19    fi
20    
21  #  if [ x${INSTALL_QUIETLY} = xtrue ] ; then
22  # get the target list      export CM_VERBOSE
23  #      CM_VERBOSE=false
 if [ ! -r config/targets ]; then  
     echo "$this: !!! File config/targets is missing."  
     exit 1  
24  fi  fi
25  . config/targets  
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
34    }
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 "$this: !!! 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 36  Line 56 
56  MAKE=make  MAKE=make
57    
58  SHELL=/bin/sh  SHELL=/bin/sh
59  echo $this: 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 $this: SML root is $ROOT.  vsay $this: SML root is $ROOT.
67  echo $this: 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 55  Line 79 
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  SRCDIR=$ROOT/src                # where the 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  
   
 URLGETTER=unknown  
   
 #  
 # the path to the dir where ml-yacc, ml-burg, ml-lex, ml-build, and  
 # ml-makedepend live  
 #  
 TOOLDIR=$BINDIR  
   
 #  
 # A temporary file for post-editing the pathconfig file...  
 #  
 PCEDITTMP=$INSTALLDIR/pcedittmp.$$  
82    
83  #  #
84  # files to be deleted after we are done...  # files to be deleted after we are done...
85  #  #
86  tmpfiles=""  tmpfiles=""
87  tmpfiles="$tmpfiles $ROOT/preloads.standard"  tmpfiles="$tmpfiles preloads.standard"
 tmpfiles="$tmpfiles $LIBLIST"  
 tmpfiles="$tmpfiles $LOCALPATHCONFIG"  
 tmpfiles="$tmpfiles $LIBMOVESCRIPT"  
 tmpfiles="$tmpfiles $PCEDITTMP"  
88  #  #
89  # make sure we always clean up after ourselves...  # make sure we always clean up after ourselves...
90  #  #
91  trap 'rm -f $tmpfiles' 0 1 2 3 15  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  #  #
103  # the release version that we are installing  # the release version that we are installing
104  #  #
105  VERSION=`cat $CONFIGDIR/version`  VERSION=`cat "$CONFIGDIR/version"`
106  echo $this: Installing version $VERSION.  vsay $this: Installing version $VERSION.
107    
108  #  #
109  # the URL for the (usually remote) source archive  # the URL for the (usually remote) source archive
110  #  #
111  SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl`  . "$CONFIGDIR"/srcarchiveurl
112  echo $this: URL of source archive is $SRCARCHIVEURL.  vsay $this: URL of source archive is $SRCARCHIVEURL.
113    
114  #  #
115  # Function to make a directory (and advertise such action).  # Function to make a directory including its ancestors.
116  #  #
117  makedir() {  makedir() {
118      if [ ! -d $1 ] ; then      if [ x"$1" = x ] ; then
119          echo $this: Making directory $1          :
120          if mkdir $1 ; then      elif [ -d "$1" ] ; then
121              : everything is fine          :
122          else          else
123              echo "$this: !!! Unable to make directory $1!"          makedirtmp=`dirname "$1"`
124              exit 1          makedir "$makedirtmp"
125          fi          if [ x${INSTALL_VERBOSE} = xtrue ] ; then
126                vsay "$this: Making directory $1"
127      fi      fi
128  }          if mkdir "$1" ; then
129                :
 #  
 # Function for asking user to fetch source archive.  
 #   $1 - descriptive name  
 #   $2 - base name without extension, without version, and without dir  
 #   $3 - remote directory  
 #  
 askurl() {  
     echo "$this: Please, fetch $1 archive"  
     echo ' ('$2.'*' or $VERSION-$2.'*)'  
     echo " from $3"  
     echo " and then re-run this script!"  
     exit 1  
 }  
   
 #  
 # Function for fetching source archives automatically using wget or lynx.  
 #   $1 - command to actually get the stuff  
 #   $2 - descriptive name  
 #   $3 - base name without extension and without dir  
 #   $4 - remote directory  
 #  
 fetchurl() {  
     getter=$1 ; shift  
     echo $this: Fetching $1 from $3. Please stand by...  
     fetched=no  
     for base in $2 $VERSION-$2 ; do  
         for ext in tar.gz tgz tar.Z tz tar tar.bz2 ; do  
             try=$base.$ext  
             echo $this: Trying $try ...  
             if $getter $3 $try $ROOT/$try ; then  
                 fetched=yes  
                 echo $this: Fetching $try was a success.  
                 break 2         # get out of both for-loops  
130              else              else
131                  rm -f $ROOT/$try              complain "$this: !!! Unable to make directory $1!"
132              fi              fi
         done  
     done  
     if [ $fetched = no ] ; then  
         echo $this: Fetching $try was no success.  
         echo '  ' You should try to do it manually now.  
         askurl "$1" "$2" "$3"  
133      fi      fi
134  }  }
135    
 usewget() {  
     wget -nv -O $3 $1/$2  
 }  
   
 uselynx() {  
     lynx -source $1/$2 >$3  
 }  
   
 testurlgetter() {  
     (exec >/dev/null 2>&1 ; exec $*)  
 }  
   
136  #  #
137  # Function to check whether wget or lynx is available.  # Fish out the CM metadata directory name from library files
138  # Set URLGETTER accordingly.  # and store it in ORIG_CM_DIR_ARC.
139    # The single argument is the name of the directory containing
140    # a single subdirectory which is a CM metadata directory:
141  #  #
142  urlgetter() {  fish() {
143      if [ "$URLGETTER" = unknown ] ; then      cd "$1"
144          if testurlgetter wget --help ; then      ORIG_CM_DIR_ARC=unknown
145              URLGETTER="fetchurl usewget"      for i in * .[a-zA-Z0-9]* ; do
146          elif testurlgetter lynx -help ; then          if [ -d $i ] ; then
147              URLGETTER="fetchurl uselynx"              ORIG_CM_DIR_ARC=$i
148          else              break
             URLGETTER="askurl"  
149          fi          fi
150      fi      done
151  }      if [ $ORIG_CM_DIR_ARC = unknown ] ; then
152            complain "$this: could not determine CM metadata directory name"
 un_tar() {  
     echo "$this: Un-TAR-ing $1 archive."  
     tar -xf $2  
 }  
   
 un_tar_Z() {  
     echo "$this: Un-COMPRESS-ing and un-TAR-ing $1 archive."  
     zcat $2 | tar -xf -  
 }  
   
 un_tar_gz() {  
     echo "$this: Un-GZIP-ing and un-TAR-ing $1 archive."  
     gunzip -c $2 | tar -xf -  
 }  
   
 un_tar_bz2() {  
     echo "$this: Un-BZIP2-ing and un-TAR-ing $1 archive."  
     bunzip2 -c $2 | tar -xf -  
 }  
   
 unarchive() {  
     # $1: descriptive string, $2: archive, $3: unpacker  
     if [ -r $ROOT/$2 ] ; then  
         $3 "$1" $ROOT/$2  
     elif [ -r $ROOT/$VERSION-$2 ]; then  
         $3 "$1" $ROOT/$VERSION-$2  
153      else      else
154          return 1          echo "$this: CM metadata directory name is \"${ORIG_CM_DIR_ARC}\""
155      fi      fi
156  }  }
157    
 #  
 # Function to unpack a source archive.  
 #  
 # $1: descriptive name of the sources to be unpacked  
 # $2: the directory into which to unpack the sources  
 # $3: the sub-directory of $2 that is going to be created by unpacking  
 # $4: the basename of the source archive (the script will check several  
 #     different suffixes to determine what kind of de-compression is to  
 #     be used)  
 #  
 # fetch_n_unpack is the helper function that does the real work.  If  
 # no archive is found locally, it invokes $URLGETTER and tries again.  
 # The variable $tryfetch is used to make sure this happens only once.  
 fetch_n_unpack() {  
     cd $2  
     if unarchive "$1" $4.tar.gz un_tar_gz ||  
        unarchive "$1" $4.tgz un_tar_gz ||  
        unarchive "$1" $4.tar.Z un_tar_Z ||  
        unarchive "$1" $4.tar un_tar ||  
        unarchive "$1" $4.tar.bz1 un_tar_bz2 ||  
        unarchive "$1" $4.tz un_tar_Z  
     then  
         : we are done  
     elif [ $tryfetch = yes ] ; then  
         urlgetter  
         $URLGETTER "$1" $4 $SRCARCHIVEURL  
         tryfetch=no  
         fetch_n_unpack "$1" "$2" "$3" "$4"  
     fi  
 }  
   
 #  
 # The main "unpack" driver function that invokes the above helper.  
 #  
 unpack() {  
     tryfetch=yes  
     if [ -d $2/$3 ]; then  
         echo "$this: The $1 tree already exists."  
     else  
         fetch_n_unpack "$1" "$2" "$3" "$4"  
     fi  
     if [ ! -d $2/$3 ]; then  
         echo "$this: !!! Unable to unpack $1 archive."  
         exit 1  
     fi  
 }  
158    
159  # A function to move all stable library files to a parallel directory  # A function to move all stable library files to a parallel directory
160  # hierarchy.  # hierarchy.
161  # The first argument must be a simple path (no / inside), and  # The first argument must be a simple path (no / inside), and
162  # the second argument must be an absolute path.  # the second argument must be an absolute path.
163  move() {  move() {
164      if [ -d $1 ] ; then      if [ -L "$1" ] ; then
165          if [ ! -d $2 ] ; then          rm -f "$1"           # remove symbolic link made by diracs (see below)
166              if [ -f $2 ] ; then      elif [ -d "$1" ] ; then
167                  echo $this: $2 exists as a non-directory.          if [ ! -d "$2" ] ; then
168                  exit 1              if [ -f "$2" ] ; then
169              fi                  complain $this: $2 exists as a non-directory.
170              mkdir $2              fi
171          fi              mkdir "$2"
172          cd $1          fi
173          for i in * ; do          cd "$1"
174              move $i $2/$i          for i in * .[a-zA-Z0-9]* ; do
175                move "$i" "$2"/"$i"
176          done          done
177          cd ..          cd ..
178      elif [ -f $1 ] ; then      elif [ -f "$1" ] ; then
179          rm -f $2          rm -f "$2"
180          mv $1 $2          mv "$1" "$2"
181      fi      fi
182  }  }
183    
184  #  #
185  # Move the stable archive of a library whose description file was $1/$2 to  # Traverse the directory tree rooted at $3 (must be single arc!).
186  # $LIBDIR/$2/CM/$ARCH-unix/$2 so that it appears as if the description file  # Find all directories named $1, rename them into $2 and make
187  # had been at $LIBDIR/$2/$2  # and establish $1 as a symbolic link to $2:
 #  
 # (This script will also move all other libraries that show up in  
 #  $1/CM/$ARCH-unix because in the case of the boot directory this indicates  
 #  that some library did not have its own path anchor but was specified  
 #  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 "$this: Warning:" $lib specified relative to $2  
             fi  
             echo $this: 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  
 }  
   
 # A shell function that registers a library for being built.  
 # This function takes two arguments: 1. a name under which the library  
 # is to be known later (something.cm) and 2. the path relative to $SRCDIR  
 # that leads to the library's .cm file.  The library's .cm file must be the  
 # same as $1.  
 #  
 # This works by adding ML code to file $LIBLIST.  The code in this file  
 # will be executed near the end of this script.  If $MOVE_LIBRARIES is  
 # set to true, then reglib will also register a "movelibs" to be executed at  
 # the end by putting a "movelibs" line into $LIBMOVESCRIPT.  
   
 reglib() {  
     if [ x$MOVE_LIBRARIES = xtrue ] ; then  
         FINALLOCATION=$LIBDIR/$1  
         FINALCONFIGPATH=$1  
     else  
         FINALLOCATION=$SRCDIR/$2  
         FINALCONFIGPATH=$FINALLOCATION  
     fi  
     if [ -d $FINALLOCATION/CM/$ARCH-unix ] ; then  
         echo "$this: Library $1 already exists in $FINALLOCATION."  
     else  
         echo "$this: Scheduling library $1 to be built in $FINALLOCATION."  
         echo "  andalso CM.stabilize false \"\$/$1\"" >>$LIBLIST  
         echo $1 $SRCDIR/$2 >>$LOCALPATHCONFIG  
         if [ x$MOVE_LIBRARIES = xtrue ] ; then  
             echo movelibs $SRCDIR/$2 $1 >>$LIBMOVESCRIPT  
         fi  
     fi  
     echo $1 $FINALCONFIGPATH >>$CM_PATHCONFIG_DEFAULT  
 }  
   
188  #  #
189  # Function to build a standalone program such as ml-yacc.  The function takes  dirarcs() {
190  # 2 or 3 arguments.  First the name of the program which at the same time      if [ -d "$3" ] ; then
191  # is the directory name under $SRCDIR where the sources reside.  The second          if [ "$3" = "$1" ] ; then
192  # argument is a descriptive name for the program (passed on to "unpack").              mv "$1" "$2"
193  # The optional third argument specifies the path relative to $SRCDIR/$1              ln -s "$2" "$1"
 # of the directory where the program's heap image is to be found.  
 #  
   
 standalone() {  
     TARGET=$1.$HEAP_SUFFIX  
     if [ $# = 3 ] ; then  
         TARGETLOC=$3/$TARGET  
     else  
         TARGETLOC=$TARGET  
     fi  
     if [ -r $HEAPDIR/$TARGET ] ; then  
         echo $this: Target $TARGET already exists.  
     else  
         echo $this: Building $TARGET.  
         unpack $2 $SRCDIR $1 $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  
194          else          else
195              echo "$this: !!! Build of $TARGET failed."              cd "$3"
196                for d in * .[a-zA-Z0-9]* ; do
197                    dirarcs "$1" "$2" "$d"
198                done
199                cd ..
200          fi          fi
201      fi      fi
202  }  }
203    
204    
205    ######################################################################
206    
207  #  #
208  # create the various sub directories  # create the various sub directories
209  #  #
210  for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR ; do  for dir in "$BINDIR" "$HEAPDIR" "$RUNDIR" "$LIBDIR" "$SRCDIR" ; do
211      makedir $dir      makedir "$dir"
212  done  done
213    
214  #  #
 # install the script that tests the architecture, and make sure that it works  
 #  
 if [ -x $BINDIR/.arch-n-opsys ]; then  
     echo $this: 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 "$this: !!! Installation of $BINDIR/.arch-n-opsys failed."  
         exit 1  
     fi  
 fi  
   
 ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`  
 if [ "$?" != "0" ]; then  
     echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine."  
     echo "$this: !!! You must patch this by hand and repeat the installation."  
     exit 2  
 else  
     echo $this: Script $BINDIR/.arch-n-opsys reports $ARCH_N_OPSYS.  
 fi  
 eval $ARCH_N_OPSYS  
   
 #  
215  # Function to install a "driver" script...  # Function to install a "driver" script...
216  #   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,
217  #   BINDIR, and VERSION variables to use.  #   BINDIR, and VERSION variables to use.
# Line 440  Line 225 
225  #   if [ -x $BINDIR/$ddst ]; then  #   if [ -x $BINDIR/$ddst ]; then
226  #       echo $this: Script $BINDIR/$ddst already exists.  #       echo $this: Script $BINDIR/$ddst already exists.
227  #   else  #   else
228          rm -f $BINDIR/$ddst          rm -f "$BINDIR"/"$ddst"
229          cat $CONFIGDIR/$dsrc | \          cat "$CONFIGDIR"/"$dsrc" | \
230          sed -e "s,@SHELL@,$SHELL,g" \          sed -e "s,@SHELL@,$SHELL,g" \
231              -e "s,@BINDIR@,$BINDIR," \              -e "s,@BINDIR@,$BINDIR," \
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 "$this: !!! Installation of $BINDIR/${ddst} failed."          if [ ! -x "$BINDIR"/"$ddst" ]; then
237              exit 1              complain "$this: !!! Installation of $BINDIR/${ddst} failed."
238          fi          fi
239  #   fi  #   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
 installdriver _ml-build ml-build  
267  installdriver _ml-makedepend ml-makedepend  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
273  #  #
# Line 489  Line 298 
298      linux)      linux)
299          EXTRA_DEFS=`$CONFIGDIR/chk-global-names.sh`          EXTRA_DEFS=`$CONFIGDIR/chk-global-names.sh`
300          if [ "$?" != "0" ]; then          if [ "$?" != "0" ]; then
301              echo "$this: !!! Problems checking for underscores in asm names."              complain "$this: !!! Problems checking for underscores in asm names."
             exit 1  
302          fi          fi
303          EXTRA_DEFS="XDEFS=$EXTRA_DEFS"          EXTRA_DEFS="XDEFS=$EXTRA_DEFS"
304          ;;          ;;
# Line 505  Line 313 
313  #  #
314  # build the run-time system  # build the run-time system
315  #  #
316  unpack "run-time" $SRCDIR runtime runtime  if [ -x "$RUNDIR"/run.$ARCH-$OPSYS ]; then
317  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then      vsay $this: Run-time system already exists.
     echo $this: Run-time system already exists.  
318  else  else
319      cd $SRCDIR/runtime/objs      "$CONFIGDIR"/unpack "$ROOT" runtime
320        cd "$SRCDIR"/runtime/objs
321      echo $this: Compiling the run-time system.      echo $this: Compiling the run-time system.
322      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS
323      if [ -x run.$ARCH-$OPSYS ]; then      if [ -x run.$ARCH-$OPSYS ]; then
324          mv run.$ARCH-$OPSYS $RUNDIR          mv run.$ARCH-$OPSYS "$RUNDIR"
325            if [ -f runx.$ARCH-$OPSYS ]; then
326                mv runx.$ARCH-$OPSYS "$RUNDIR"
327            fi
328          $MAKE MAKE=$MAKE clean          $MAKE MAKE=$MAKE clean
329      else      else
330          echo "$this: !!! Run-time system build failed for some reason."          complain "$this: !!! Run-time system build failed for some reason."
         exit 1  
331      fi      fi
332  fi  fi
333  cd $SRCDIR  cd "$SRCDIR"
334    
335  #  #
336  # boot the base SML system  # boot the base SML system
337  #  #
338  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then  if [ -r "$HEAPDIR"/sml.$HEAP_SUFFIX ]; then
339      echo $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.      vsay $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.
340        fish "$LIBDIR"/basis.cm
341        # ignore requested arc name since we have to live with what is there:
342        export CM_DIR_ARC
343        CM_DIR_ARC=$ORIG_CM_DIR_ARC
344        # now re-dump the heap image:
345        vsay "$this: Re-creating a (customized) heap image..."
346        "$BINDIR"/sml @CMredump "$ROOT"/sml
347        cd "$ROOT"
348        if [ -r sml.$HEAP_SUFFIX ]; then
349            mv sml.$HEAP_SUFFIX "$HEAPDIR"
350        else
351            complain "$this !!! Unable to re-create heap image (sml.$HEAP_SUFFIX)."
352        fi
353    else
354        "$CONFIGDIR"/unpack "$ROOT" "$BOOT_ARCHIVE"
355    
356        fish "$ROOT"/"$BOOT_FILES"/basis.cm
357    
358        cd "$ROOT"
359    
360        # Target arc:
361        export CM_DIR_ARC
362        CM_DIR_ARC=${CM_DIR_ARC:-".cm"}
363    
364        if [ $CM_DIR_ARC = $ORIG_CM_DIR_ARC ] ; then
365            : we are happy
366  else  else
367      unpack bin $ROOT $BOOT_FILES $BOOT_ARCHIVE          # now we have to make a symbolic link for each occurrence of
368      cd $ROOT/$BOOT_FILES          # $ORIG_CM_DIR_ARC to $CM_DIR_ARC
369      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC          dirarcs "$ORIG_CM_DIR_ARC" "$CM_DIR_ARC" "$BOOT_FILES"
370        fi
371    
372        cd "$ROOT"/"$BOOT_FILES"
373    
374        # now link (boot) the system and let it initialize itself...
375        if "$BINDIR"/.link-sml @SMLheap="$ROOT"/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC
376      then      then
377          cd $ROOT          cd "$ROOT"
378          if [ -r sml.$HEAP_SUFFIX ]; then          if [ -r sml.$HEAP_SUFFIX ]; then
379              mv sml.$HEAP_SUFFIX $HEAPDIR              mv sml.$HEAP_SUFFIX "$HEAPDIR"
380              cd $BINDIR              cd "$BINDIR"
381              ln -s .run-sml sml              ln -s .run-sml sml
382              #              #
383              # Now move all stable libraries to #LIBDIR and generate              # Now move all stable libraries to #LIBDIR and generate
384              # the pathconfig file.              # the pathconfig file.
385              #              #
386              cd $ROOT/$BOOT_FILES              cd "$ROOT"/"$BOOT_FILES"
387              for anchor in * ; do              for anchor in * ; do
388                  if [ -d $anchor ] ; then                  if [ -d $anchor ] ; then
389                      echo $anchor $anchor >>$CM_PATHCONFIG_DEFAULT                      echo $anchor $anchor >>$CM_PATHCONFIG
390                      move $anchor $LIBDIR/$anchor                      move $anchor "$LIBDIR"/$anchor
391                  fi                  fi
392              done              done
393              cd $ROOT              cd "$ROOT"
394              # $BOOT_FILES is now only an empty skeleton, let's get rid of it.              # $BOOT_FILES is now only an empty skeleton, let's get rid of it.
395              rm -rf $BOOT_FILES              rm -rf "$BOOT_FILES"
396    
397          else          else
398              echo "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."              complain "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."
             exit 1  
399          fi          fi
400      else      else
401          echo "$this !!! Boot code failed, no heap image (sml.$HEAP_SUFFIX)."          complain "$this !!! Boot code failed, no heap image (sml.$HEAP_SUFFIX)."
         exit 1  
402      fi      fi
403  fi  fi
404    
405  #  #
406  # Initialize $LIBLIST  # now that we know CM_DIR_ARC we can install the ml-build driver...
407  #  #
408  cd $ROOT  installdriver _ml-build ml-build
 rm -f $LOCALPATHCONFIG $LIBLIST  
 echo 'ignore (OS.Process.exit (if true' >$LIBLIST  
   
 #  
 # now build (or prepare to build) the individual targets  
 #  
 cd $SRCDIR  
 echo $this: 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 $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 smlnj-lib  
409    
410          # 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 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 cml  
         reglib cml-lib.cm cml/cml-lib  
         ;;  
       eXene)  
         unpack EXene $SRCDIR eXene eXene  
         reglib eXene.cm eXene  
         ;;  
       doc)  
         unpack Doc $ROOT doc doc  
         cd $ROOT/doc  
         build $ROOT  
         ;;  
       *)  
         echo "$this: !!! Unknown target $i."  
         ;;  
     esac  
 done  
411    
412  #  #
413  # 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.  
414  #  #
415    if [ $nolib = false ] ; then
416  echo $this: Compiling library code.      echo $this: Installing other libraries and programs:
417  echo 'then OS.Process.success else OS.Process.failure));' >>$LIBLIST      export ROOT INSTALLDIR CONFIGDIR BINDIR
418  if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then      if "$BINDIR"/sml -m \$smlnj/installer.cm
419      echo $this: Libraries compiled successfully.      then
420            vsay $this: Installation complete.
421  else  else
422      echo "$this: !!! Something went wrong when compiling the libraries."          complain "$this: !!! Installation of libraries and programs failed."
     exit 1  
 fi  
   
 #  
 # Move the libraries to their final locations...  
 #  
   
 if [ -r $LIBMOVESCRIPT ] ; then  
     echo $this: Moving libraries to $LIBDIR.  
     . $LIBMOVESCRIPT  
423  fi  fi
   
 #  
 # Finally, remove duplicate entries from pathconfig file...  
 #  
 if [ -f $CM_PATHCONFIG_DEFAULT ] ; then  
     cp $CM_PATHCONFIG_DEFAULT $PCEDITTMP  
     rm -f $CM_PATHCONFIG_DEFAULT  
     awk <$PCEDITTMP 'NF == 2 { mapping[$1] = $2 }  
 NF != 2 { print $0 }  
 END { for (i in mapping) print i, mapping[i] }' \  
       | sort >$CM_PATHCONFIG_DEFAULT  
424  fi  fi
425    
426  exit 0  exit 0

Legend:
Removed from v.814  
changed lines
  Added in v.1794

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