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 1368, Sat Sep 13 04:44:43 2003 UTC revision 1725, Tue Dec 14 23:23:41 2004 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  if [ x${INSTALL_QUIETLY} = xtrue ] ; then  if [ x${INSTALL_QUIETLY} = xtrue ] ; then
16      export CM_VERBOSE=false      export CM_VERBOSE
17        CM_VERBOSE=false
18  fi  fi
19    
20  vsay() {  vsay() {
# Line 23  Line 27 
27      fi      fi
28  }  }
29    
 dsay() {  
     if [ x${INSTALL_DEBUG} = xtrue ] ; then  
         echo "$@"  
     fi  
 }  
   
30  complain() {  complain() {
31      echo "$@"      echo "$@"
32      exit 1      exit 1
33  }  }
34    
 # The following variable holds the name of all possible targets.  
 # The names must occur in the order in which targets are to be built.  
 ALLTARGETS=\  
 "src-smlnj \  
  ml-yacc \  
  ml-lex \  
  ml-burg \  
  ml-nlffigen \  
  smlnj-lib \  
  mlrisc \  
  cml \  
  cml-lib \  
  eXene \  
  ckit \  
  ml-nlffi-lib \  
  pgraph-util \  
  mlrisc-tools \  
  nowhere \  
  doc"  
   
35  this=$0  this=$0
36    
 # By default, move libraries to lib directory:  
 MOVE_LIBRARIES=true  
   
 # function to be used in config/targets:  
 dont_move_libraries() { MOVE_LIBRARIES=false ; }  
   
 # Initialize target list.  
 TARGETS=""  
   
 # function to be used in config/targets:  
 request() { TARGETS="$TARGETS $1" ; }  
   
 #  
 # get the target list  
 #  
 if [ -r config/targets.customized ] ; then  
     . config/targets.customized  
 elif [ ! -r config/targets ]; then  
     complain "$this: !!! File config/targets is missing."  
 else  
     . config/targets  
 fi  
   
 #  
 # resolve dependencies  
 #  
 isnotin() {  
     tested_x=$1  
     shift  
     for set_y in "$@" ; do  
         if [ ${tested_x} = ${set_y} ] ; then  
             return 1  
         fi  
     done  
     return 0  
 }  
   
 require() {  
     require_who=$1  
     shift  
     if isnotin ${require_who} ${TARGETS} ; then  
         :  
     else  
         for required_x in "$@" ; do  
             if isnotin ${required_x} ${TARGETS} ; then  
                 echo "Including ${required_x} (needed by ${require_who})."  
                 request ${required_x}  
                 CHANGED=true  
             fi  
         done  
     fi  
 }  
   
 onepass() {  
     while read depline ; do  
         require $depline  
     done  
 }  
   
 if [ -r config/dependencies ] ; then  
     CHANGED=true  
     while [ $CHANGED = true ]; do  
         CHANGED=false  
         onepass <config/dependencies  
     done  
 fi  
   
 #  
 # Rebuild target list using the order defined by ALLTARGETS.  
 #  
 NEWTARGETS=""  
 for t in ${ALLTARGETS} ; do  
     if isnotin $t ${TARGETS} ; then  
         :  
     else  
         NEWTARGETS="$NEWTARGETS $t"  
     fi  
 done  
 TARGETS=$NEWTARGETS  
37    
38  #  #
39  # create the preloads.standard file  # create the preloads.standard file
# Line 159  Line 58 
58  REAL_PWD=`pwd`  REAL_PWD=`pwd`
59  ROOT=${PWD:-$REAL_PWD}  ROOT=${PWD:-$REAL_PWD}
60  vsay $this: SML root is $ROOT.  vsay $this: SML root is $ROOT.
61  vsay $this: Installation directory is ${INSTALLDIR:=$ROOT}.  
62    cd "${INSTALLDIR:=$ROOT}"
63    INSTALLDIR=`pwd`
64    cd "$ROOT"
65    vsay $this: Installation directory is ${INSTALLDIR}.
66    
67  #  #
68  # set the various directory and file pathname variables  # set the various directory and file pathname variables
# Line 170  Line 73 
73  RUNDIR=$BINDIR/.run             # where executables (i.e., the RTS) live  RUNDIR=$BINDIR/.run             # where executables (i.e., the RTS) live
74  SRCDIR=$ROOT/src                # where the source tree is rooted  SRCDIR=$ROOT/src                # where the source tree is rooted
75  LIBDIR=$INSTALLDIR/lib          # where libraries live  LIBDIR=$INSTALLDIR/lib          # where libraries live
 LIBLIST=$ROOT/liblist           # list of commands to stabilize libraries  
 LATESTANDALONES=$ROOT/latestandalones # standalone programs to be built late  
 LIBMOVESCRIPT=$ROOT/libmove     # a temporary script  
 LOCALPATHCONFIG=$INSTALLDIR/pathconfig # a temporary pathconfig file  
   
 #  
 # The path to the dir where ml-yacc, ml-burg, ml-lex, ml-build, and  
 # ml-makedepend live.  This path will be interpreted relative to $LIBDIR.  
 #  
 TOOLDIR=../bin  
   
 #  
 # A temporary file for post-editing the pathconfig file...  
 #  
 PCEDITTMP=$INSTALLDIR/pcedittmp.$$  
76    
77  #  #
78  # files to be deleted after we are done...  # files to be deleted after we are done...
79  #  #
80  tmpfiles=""  tmpfiles=""
81  tmpfiles="$tmpfiles $ROOT/preloads.standard"  tmpfiles="$tmpfiles preloads.standard"
 tmpfiles="$tmpfiles $LIBLIST"  
 tmpfiles="$tmpfiles $LATESTANDALONES"  
 tmpfiles="$tmpfiles $LOCALPATHCONFIG"  
 tmpfiles="$tmpfiles $LIBMOVESCRIPT"  
 tmpfiles="$tmpfiles $PCEDITTMP"  
82  #  #
83  # make sure we always clean up after ourselves...  # make sure we always clean up after ourselves...
84  #  #
85  trap 'rm -f $tmpfiles' 0 1 2 3 15  trap 'cd "$ROOT"; rm -f $tmpfiles' 0 1 2 3 15
86    
87    
88  #  #
# Line 207  Line 90 
90  # that will be queried by the bootstrap code)  # that will be queried by the bootstrap code)
91  # Especially important is CM_PATHCONFIG.  # Especially important is CM_PATHCONFIG.
92  #  #
 CM_PATHCONFIG=$LIBDIR/pathconfig  
93  export CM_PATHCONFIG  export CM_PATHCONFIG
94    CM_PATHCONFIG=$LIBDIR/pathconfig
95    
96  #  #
97  # the release version that we are installing  # the release version that we are installing
98  #  #
99  VERSION=`cat $CONFIGDIR/version`  VERSION=`cat "$CONFIGDIR/version"`
100  vsay $this: Installing version $VERSION.  vsay $this: Installing version $VERSION.
101    
102  #  #
103  # the URL for the (usually remote) source archive  # the URL for the (usually remote) source archive
104  #  #
105  SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl`  . "$CONFIGDIR"/srcarchiveurl
106  vsay $this: URL of source archive is $SRCARCHIVEURL.  vsay $this: URL of source archive is $SRCARCHIVEURL.
107    
108  #  #
109  # Function to make a directory including its ancestors.  # Function to make a directory including its ancestors.
110  #  #
111  makedir() {  makedir() {
112      if [ x$1 = x ] ; then      if [ x"$1" = x ] ; then
113          :          :
114      elif [ -d $1 ] ; then      elif [ -d "$1" ] ; then
115          :          :
116      else      else
117          makedir `dirname $1`          makedirtmp=`dirname "$1"`
118            makedir "$makedirtmp"
119          if [ x${INSTALL_VERBOSE} = xtrue ] ; then          if [ x${INSTALL_VERBOSE} = xtrue ] ; then
120              vsay "$this: Making directory $1"              vsay "$this: Making directory $1"
121          fi          fi
122          if mkdir $1 ; then          if mkdir "$1" ; then
123              :              :
124          else          else
125              complain "$this: !!! Unable to make directory $1!"              complain "$this: !!! Unable to make directory $1!"
# Line 244  Line 128 
128  }  }
129    
130  #  #
131  # Function for asking user to fetch source archive.  # Fish out the CM metadata directory name from library files
132  #   $1 - descriptive name  # and store it in ORIG_CM_DIR_ARC.
133  #   $2 - base name without extension, without version, and without dir  # The single argument is the name of the directory containing
134  #   $3 - remote directory  # a single subdirectory which is a CM metadata directory:
135  #  #
136  askurl() {  fish() {
137      echo "$this: Please, fetch $1 archive"      cd "$1"
138      echo ' ('$2.'*' or $VERSION-$2.'*)'      ORIG_CM_DIR_ARC=unknown
139      echo " from $3"      for i in * .[a-zA-Z0-9]* ; do
140      echo " and then re-run this script!"          if [ -d $i ] ; then
141      exit 1              ORIG_CM_DIR_ARC=$i
142  }              break
   
 #  
 # 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  
     vsay $this: Fetching $1 from $3. Please stand by...  
     fetched=no  
     for base in $2 $VERSION-$2 ; do  
         for ext in tgz tar.gz tar.Z tz tar tar.bz2 ; do  
             try=$base.$ext  
             vsay $this: Trying $try ...  
             if $getter $3/$try $ROOT/$try ; then  
                 fetched=yes  
                 vsay $this: Fetching $try was a success.  
                 break 2         # get out of both for-loops  
             else  
                 rm -f $ROOT/$try  
143              fi              fi
144          done          done
145      done      if [ $ORIG_CM_DIR_ARC = unknown ] ; then
146      if [ $fetched = no ] ; then          complain "$this: could not determine CM metadata directory name"
         echo $this: Fetching $try was no success.  
         echo '  ' You should try to do it manually now.  
         askurl "$1" "$2" "$3"  
     fi  
 }  
   
 # wrapper for wget  
 usewget() {  
     wget -nv -O $2 $1  
 }  
   
 # wrapper for lynx  
 uselynx() {  
     lynx -source $1 >$2  
 }  
   
 # wrapper for curl  
 usecurl() {  
     curl -s $1 >$2  
 }  
   
 testurlgetter() {  
     (exec >/dev/null 2>&1 ; exec $*)  
 }  
   
 #  
 # Function to check whether wget or lynx is available.  
 # Set URLGETTER accordingly.  URLGETTER can be set externally  
 # to either 'wget' or 'curl' or 'lynx' -- in which case the  
 # corresponding command will be used (properly wrapped).  Any  
 # other external setting will be passed directly to fetchurl (without  
 # wrapping -- meaning it must take precisely two argumets: source and  
 # destination, in that order).  
 #  
 urlgetter() {  
     case ${URLGETTER:-unknown} in  
         fetchurl*)  
             ;;  
         unknown)  
             # automatically figure out which wrapper to use  
             if testurlgetter wget --help ; then  
                 URLGETTER="fetchurl usewget"  
             elif testurlgetter curl -s -O file:///dev/null -o /dev/null ; then  
                 URLGETTER="fetchurl usecurl"  
             elif testurlgetter lynx -help ; then  
                 URLGETTER="fetchurl uselynx"  
147              else              else
148                  URLGETTER="askurl"          echo "$this: CM metadata directory name is \"${ORIG_CM_DIR_ARC}\""
149              fi              fi
             ;;  
         wget|curl|lynx)  
             # special getters we know how to wrap  
             URLGETTER="fetchurl use${URLGETTER}"  
             ;;  
         *)  
             # other -- must be able to work without wrapper  
             URLGETTER="fetchurl ${URLGETTER}"  
             ;;  
     esac  
 }  
   
 # wrapper for tar  
 un_tar() {  
     vsay "$this: Un-TAR-ing $1 archive."  
     tar -xf $2  
150  }  }
151    
 # wrapper for zcat followed by tar  
 un_tar_Z() {  
     vsay "$this: Un-COMPRESS-ing and un-TAR-ing $1 archive."  
     zcat $2 | tar -xf -  
 }  
   
 # wrapper for gunzip followed by tar  
 un_tar_gz() {  
     vsay "$this: Un-GZIP-ing and un-TAR-ing $1 archive."  
     gunzip -c $2 | tar -xf -  
 }  
   
 # wrapper for bunzip2 followed by tar  
 un_tar_bz2() {  
     vsay "$this: Un-BZIP2-ing and un-TAR-ing $1 archive."  
     bunzip2 -c $2 | tar -xf -  
 }  
   
 # unarchive archive without and with version number attached  
 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  
     else  
         return 1  
     fi  
 }  
   
 #  
 # 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.tgz un_tar_gz ||  
        unarchive "$1" $4.tar.gz un_tar_gz ||  
        unarchive "$1" $4.tar.Z un_tar_Z ||  
        unarchive "$1" $4.tar un_tar ||  
        unarchive "$1" $4.tar.bz2 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  
         vsay "$this: The $1 tree already exists."  
     else  
         fetch_n_unpack "$1" "$2" "$3" "$4"  
     fi  
     if [ ! -d $2/$3 ]; then  
         complain "$this: !!! Unable to unpack $1 archive."  
     fi  
 }  
152    
153  # A function to move all stable library files to a parallel directory  # A function to move all stable library files to a parallel directory
154  # hierarchy.  # hierarchy.
155  # The first argument must be a simple path (no / inside), and  # The first argument must be a simple path (no / inside), and
156  # the second argument must be an absolute path.  # the second argument must be an absolute path.
157  move() {  move() {
158      if [ -d $1 ] ; then      if [ -L "$1" ] ; then
159          if [ ! -d $2 ] ; then          rm -f "$1"           # remove symbolic link made by diracs (see below)
160              if [ -f $2 ] ; then      elif [ -d "$1" ] ; then
161            if [ ! -d "$2" ] ; then
162                if [ -f "$2" ] ; then
163                  complain $this: $2 exists as a non-directory.                  complain $this: $2 exists as a non-directory.
164              fi              fi
165              mkdir $2              mkdir "$2"
166          fi          fi
167          cd $1          cd "$1"
168          for i in * ; do          for i in * .[a-zA-Z0-9]* ; do
169              move $i $2/$i              move "$i" "$2"/"$i"
170          done          done
171          cd ..          cd ..
172      elif [ -f $1 ] ; then      elif [ -f "$1" ] ; then
173          rm -f $2          rm -f "$2"
174          mv $1 $2          mv "$1" "$2"
     fi  
 }  
   
 # move stable library file from $1 to $2  
 movelib()  
 {  
     SOURCE=$1  
     TARGET=$2  
     TARGETDIR=`dirname ${TARGET}`  
     if [ ! -d ${TARGETDIR} ] ; then  
         makedir ${TARGETDIR}  
     fi  
     mv ${SOURCE} ${TARGET}  
 }  
   
 # A shell function that registers a library for being built.  
 # This function takes 3 arguments:  
 #   $1 = controlling anchor  
 #   $2 = name relative to controlling anchor  
 #   $3 = dir (relative to ${SRCDIR}) corresponding to $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 "movelib" to be executed at  
 # the end by putting a "movelib" line into $LIBMOVESCRIPT.  
 reglib() {  
     ANCHOR=$1  
     RELNAME=$2  
     LIBNAME='$'${ANCHOR}/${RELNAME}  
     ADIR=${SRCDIR}/$3  
     if [ $# -gt 3 ] ; then  
         FINALANCHOR=$4  
     else  
         FINALANCHOR=$ANCHOR  
     fi  
     RELDIR=`dirname $RELNAME`  
     RELBASE=`basename $RELNAME`  
     if [ x$RELDIR = x. ] ; then  
         RELDIR=  
     else  
         RELDIR=/$RELDIR  
     fi  
     RELLOC=${RELDIR}/CM/${ARCH}-unix/${RELBASE}  
     SRCFINALLOC=${ADIR}${RELLOC}  
     if [ x$MOVE_LIBRARIES = xtrue ] ; then  
         FINALLOC=${LIBDIR}/${FINALANCHOR}${RELLOC}  
         FINALCONFIGPATH=${FINALANCHOR}  
     else  
         FINALLOC=${SRCFINALLOC}  
         FINALCONFIGPATH=${ADIR}  
     fi  
   
     if [ -f ${FINALLOC} ] ; then  
         vsay "$this: Library ${LIBNAME} already exists in ${FINALLOC}"  
     else  
         vsay "$this: Scheduling library ${LIBNAME} to be built as ${FINALLOC}."  
         echo "  andalso CM.stabilize false \"${LIBNAME}\"" >>${LIBLIST}  
         echo ${ANCHOR} ${ADIR} >>${LOCALPATHCONFIG}  
         if [ x$MOVE_LIBRARIES = xtrue ] ; then  
             echo movelib ${SRCFINALLOC} ${FINALLOC} >>${LIBMOVESCRIPT}  
         fi  
175      fi      fi
     echo ${FINALANCHOR} ${FINALCONFIGPATH} >>${CM_PATHCONFIG}  
176  }  }
177    
178  #  #
179  # Function for adding anchor bindings to LOCALPATHCONFIG  # Traverse the directory tree rooted at $3 (must be single arc!).
180    # Find all directories named $1, rename them into $2 and make
181    # and establish $1 as a symbolic link to $2:
182  #  #
183  # $1 - anchor name  dirarcs() {
184  # $2 - directory relative to ROOT corresponding to $1      if [ -d "$3" ] ; then
185  localanchor() {          if [ "$3" = "$1" ] ; then
186      echo $1 ${ROOT}/$2 >>${LOCALPATHCONFIG}              mv "$1" "$2"
187  }              ln -s "$2" "$1"
   
 #  
 # Function to build a standalone program such as ml-yacc.  The function takes  
 # 2 or 3 or 4 arguments.  First the name of the program which at the same time  
 # is the directory name under $SRCDIR/$4 where the sources reside.  The second  
 # argument is a descriptive name for the program (passed on to "unpack").  
 # The optional third argument specifies the path relative to $SRCDIR/$4/$1  
 # of the directory where the program's heap image is to be found.  
 # The fourth argument, if missing, defaults to "."  
 #  
   
 standalone() {  
     TARGET=$1.$HEAP_SUFFIX  
     if [ $# = 3 ] ; then  
         TARGETLOC=$3/$TARGET  
     else  
         TARGETLOC=$TARGET  
     fi  
     if [ $# = 4 ] ; then  
          MYSRCDIR=$SRCDIR/$4  
     else  
          MYSRCDIR=$SRCDIR  
     fi  
     if [ -r $HEAPDIR/$TARGET ] ; then  
         vsay $this: Target $TARGET already exists.  
     else  
         echo $this: Building $TARGET.  
         unpack $2 $MYSRCDIR $1 $1  
         cd $MYSRCDIR/$1  
         # build it, but make sure we don't pick up some (unrelated)  
         # local path configuration...  
         CM_LOCAL_PATHCONFIG=/dev/null ./build  
         if [ -r $TARGETLOC ] ; then  
             mv $TARGETLOC $HEAPDIR/$TARGET  
             if [ ! -f $BINDIR/$1 ] ; then  
                 cd $BINDIR  
                 ln -s .run-sml $1  
             fi  
188          else          else
189              echo "$this: !!! Build of $TARGET failed."              cd "$3"
190                for d in * .[a-zA-Z0-9]* ; do
191                    dirarcs "$1" "$2" "$d"
192                done
193                cd ..
194          fi          fi
195      fi      fi
196  }  }
197    
198    
199  ######################################################################  ######################################################################
200    
201  #  #
202  # create the various sub directories  # create the various sub directories
203  #  #
204  for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR ; do  for dir in "$BINDIR" "$HEAPDIR" "$RUNDIR" "$LIBDIR" "$SRCDIR" ; do
205      makedir $dir      makedir "$dir"
206  done  done
207    
208  #  #
# Line 585  Line 219 
219  #   if [ -x $BINDIR/$ddst ]; then  #   if [ -x $BINDIR/$ddst ]; then
220  #       echo $this: Script $BINDIR/$ddst already exists.  #       echo $this: Script $BINDIR/$ddst already exists.
221  #   else  #   else
222          rm -f $BINDIR/$ddst          rm -f "$BINDIR"/"$ddst"
223          cat $CONFIGDIR/$dsrc | \          cat "$CONFIGDIR"/"$dsrc" | \
224          sed -e "s,@SHELL@,$SHELL,g" \          sed -e "s,@SHELL@,$SHELL,g" \
225              -e "s,@BINDIR@,$BINDIR," \              -e "s,@BINDIR@,$BINDIR," \
226              -e "s,@VERSION@,$VERSION," \              -e "s,@VERSION@,$VERSION," \
227              > $BINDIR/$ddst              -e "s,@CMDIRARC@,${CM_DIR_ARC:-dummy}," \
228          chmod 555 $BINDIR/$ddst              > "$BINDIR"/"$ddst"
229          if [ ! -x $BINDIR/$ddst ]; then          chmod 555 "$BINDIR"/"$ddst"
230            if [ ! -x "$BINDIR"/"$ddst" ]; then
231              complain "$this: !!! Installation of $BINDIR/${ddst} failed."              complain "$this: !!! Installation of $BINDIR/${ddst} failed."
232          fi          fi
233  #   fi  #   fi
# Line 607  Line 242 
242  # run it to figure out what architecture and os we are using, define  # run it to figure out what architecture and os we are using, define
243  # corresponding variables...  # corresponding variables...
244  #  #
245  ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`  ARCH_N_OPSYS=`"$BINDIR"/.arch-n-opsys`
246  if [ "$?" != "0" ]; then  if [ "$?" != "0" ]; then
247      echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine."      echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine."
248      echo "$this: !!! You must patch this by hand and repeat the installation."      echo "$this: !!! You must patch this by hand and repeat the installation."
# Line 618  Line 253 
253  eval $ARCH_N_OPSYS  eval $ARCH_N_OPSYS
254    
255  #  #
256  # now install all the other driver scripts...  # now install most of the other driver scripts
257    #  (except ml-build, since we don't know $CM_DIR_ARC yet)
258  #  #
259  installdriver _run-sml .run-sml  installdriver _run-sml .run-sml
260  installdriver _link-sml .link-sml  installdriver _link-sml .link-sml
 installdriver _ml-build ml-build  
261  installdriver _ml-makedepend ml-makedepend  installdriver _ml-makedepend ml-makedepend
262    
263  #  #
# Line 670  Line 305 
305  #  #
306  # build the run-time system  # build the run-time system
307  #  #
308  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then  if [ -x "$RUNDIR"/run.$ARCH-$OPSYS ]; then
309      vsay $this: Run-time system already exists.      vsay $this: Run-time system already exists.
310  else  else
311      unpack "run-time" $SRCDIR runtime runtime      "$CONFIGDIR"/unpack "$ROOT" runtime
312      cd $SRCDIR/runtime/objs      cd "$SRCDIR"/runtime/objs
313      echo $this: Compiling the run-time system.      echo $this: Compiling the run-time system.
314      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS
315      if [ -x run.$ARCH-$OPSYS ]; then      if [ -x run.$ARCH-$OPSYS ]; then
316          mv run.$ARCH-$OPSYS $RUNDIR          mv run.$ARCH-$OPSYS "$RUNDIR"
317          $MAKE MAKE=$MAKE clean          $MAKE MAKE=$MAKE clean
318      else      else
319          complain "$this: !!! Run-time system build failed for some reason."          complain "$this: !!! Run-time system build failed for some reason."
320      fi      fi
321  fi  fi
322  cd $SRCDIR  cd "$SRCDIR"
323    
324  #  #
325  # boot the base SML system  # boot the base SML system
326  #  #
327  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then  if [ -r "$HEAPDIR"/sml.$HEAP_SUFFIX ]; then
328      vsay $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.      vsay $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.
329        fish "$LIBDIR"/basis.cm
330        # ignore requested arc name since we have to live with what is there:
331        export CM_DIR_ARC
332        CM_DIR_ARC=$ORIG_CM_DIR_ARC
333    else
334        "$CONFIGDIR"/unpack "$ROOT" "$BOOT_ARCHIVE"
335    
336        fish "$ROOT"/"$BOOT_FILES"/basis.cm
337    
338        cd "$ROOT"
339    
340        # Target arc:
341        export CM_DIR_ARC
342        CM_DIR_ARC=${CM_DIR_ARC:-".cm"}
343    
344        if [ $CM_DIR_ARC = $ORIG_CM_DIR_ARC ] ; then
345            : we are happy
346  else  else
347      unpack bin $ROOT $BOOT_FILES $BOOT_ARCHIVE          # now we have to make a symbolic link for each occurrence of
348      cd $ROOT/$BOOT_FILES          # $ORIG_CM_DIR_ARC to $CM_DIR_ARC
349      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC          dirarcs "$ORIG_CM_DIR_ARC" "$CM_DIR_ARC" "$BOOT_FILES"
350        fi
351    
352        cd "$ROOT"/"$BOOT_FILES"
353    
354        # now link (boot) the system and let it initialize itself...
355        if "$BINDIR"/.link-sml @SMLheap="$ROOT"/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC
356      then      then
357          cd $ROOT          cd "$ROOT"
358          if [ -r sml.$HEAP_SUFFIX ]; then          if [ -r sml.$HEAP_SUFFIX ]; then
359              mv sml.$HEAP_SUFFIX $HEAPDIR              mv sml.$HEAP_SUFFIX "$HEAPDIR"
360              cd $BINDIR              cd "$BINDIR"
361              ln -s .run-sml sml              ln -s .run-sml sml
362              #              #
363              # Now move all stable libraries to #LIBDIR and generate              # Now move all stable libraries to #LIBDIR and generate
364              # the pathconfig file.              # the pathconfig file.
365              #              #
366              cd $ROOT/$BOOT_FILES              cd "$ROOT"/"$BOOT_FILES"
367              for anchor in * ; do              for anchor in * ; do
368                  if [ -d $anchor ] ; then                  if [ -d $anchor ] ; then
369                      echo $anchor $anchor >>$CM_PATHCONFIG                      echo $anchor $anchor >>$CM_PATHCONFIG
370                      move $anchor $LIBDIR/$anchor                      move $anchor "$LIBDIR"/$anchor
371                  fi                  fi
372              done              done
373              cd $ROOT              cd "$ROOT"
374              # $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.
375              rm -rf $BOOT_FILES              rm -rf "$BOOT_FILES"
376    
377          else          else
378              complain "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."              complain "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."
# Line 725  Line 383 
383  fi  fi
384    
385  #  #
386  # Initialize $LIBLIST  # now that we know CM_DIR_ARC we can install the ml-build driver...
387  #  #
388  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  
 vsay $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  
         ;;  
       ml-lex)  
         standalone ml-lex ML-Lex  
         echo ml-lex $TOOLDIR >>$CM_PATHCONFIG  
         ;;  
       ml-burg)  
         standalone ml-burg ML-Burg  
         echo ml-burg $TOOLDIR >>$CM_PATHCONFIG  
         ;;  
       ml-nlffigen)  
         echo standalone ml-nlffigen ML-NLFFI-Gen >>$LATESTANDALONES  
         echo ml-nlffigen $TOOLDIR >>$CM_PATHCONFIG  
         ;;  
       smlnj-lib)  
         unpack "SML/NJ Library" $SRCDIR smlnj-lib smlnj-lib  
389    
390          # 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.cm smlnj-lib/Util  
         # ... and don't make the HTML library ...  
             #reglib html-lib.cm html-lib.cm smlnj-lib/HTML  
         # ... and don't make the PP library ...  
             #reglib pp-lib.cm pp-lib.cm smlnj-lib/PP  
         # ... and don't make the controls library ...  
             #reglib controls-lib.cm controls-lib.cm smlnj-lib/Controls  
         # make the Unix library  
             reglib unix-lib.cm unix-lib.cm smlnj-lib/Unix  
         # make the INet library  
             reglib inet-lib.cm inet-lib.cm smlnj-lib/INet  
         # make the RegExp library  
             reglib regexp-lib.cm regexp-lib.cm smlnj-lib/RegExp  
         # make the Reactive library  
             reglib reactive-lib.cm reactive-lib.cm smlnj-lib/Reactive  
         # make the HashCons library  
             reglib hash-cons-lib.cm hash-cons-lib.cm smlnj-lib/HashCons  
         ;;  
       cml)  
         unpack CML $SRCDIR cml cml  
         reglib cml core-cml.cm cml/src  
         reglib cml cml-internal.cm cml/src  
         reglib cml cml.cm cml/src  
         reglib cml basis.cm cml/src  
         ;;  
       cml-lib)  
         unpack CML $SRCDIR cml cml  
         reglib cml-lib trace-cml.cm cml/cml-lib/cm-descr  
         reglib cml-lib smlnj-lib.cm cml/cml-lib/cm-descr  
         ;;  
       eXene)  
         unpack EXene $SRCDIR eXene eXene  
         reglib eXene.cm eXene.cm eXene  
         ;;  
       ckit)  
         unpack "C-Kit" $ROOT ckit ckit  
         reglib ckit-lib.cm ckit-lib.cm ../ckit/src  
         ;;  
       ml-nlffi-lib)  
         unpack "NLFFI Library" $SRCDIR ml-nlffi-lib ml-nlffi-lib  
         reglib c memory/memory.cm ml-nlffi-lib  
         reglib c internals/c-int.cm ml-nlffi-lib  
         reglib c c.cm ml-nlffi-lib  
         ;;  
       pgraph-util)  
         unpack "CM source code" $SRCDIR cm cm  
         reglib pgraph-util.cm pgraph-util.cm cm/pgraph  
         ;;  
       mlrisc)  
         unpack "MLRISC Library" $SRCDIR MLRISC MLRISC  
         localanchor Control.cm lib/SMLNJ-MLRISC  
         localanchor Lib.cm lib/SMLNJ-MLRISC  
         localanchor Visual.cm lib/SMLNJ-MLRISC  
         localanchor MLRISC.cm lib/SMLNJ-MLRISC  
         localanchor MLTREE.cm lib/SMLNJ-MLRISC  
         localanchor Graphs.cm lib/SMLNJ-MLRISC  
         localanchor IA32.cm lib/SMLNJ-MLRISC  
         localanchor Peephole.cm src/MLRISC/cm  
         reglib OTHER-MLRISC RA.cm MLRISC/cm SMLNJ-MLRISC  
         reglib OTHER-MLRISC Peephole.cm MLRISC/cm SMLNJ-MLRISC  
         reglib OTHER-MLRISC IA32-Peephole.cm MLRISC/cm SMLNJ-MLRISC  
         ;;  
       mlrisc-tools)  
         unpack "MLRISC Tools Library" $SRCDIR MLRISC MLRISC  
         reglib mlrisc-tools pp.cm MLRISC/Tools  
         reglib mlrisc-tools source-map.cm MLRISC/Tools  
         reglib mlrisc-tools sml-ast.cm MLRISC/Tools  
         reglib mlrisc-tools prec-parser.cm MLRISC/Tools  
         reglib mlrisc-tools parser.cm MLRISC/Tools  
         reglib mlrisc-tools match-compiler.cm MLRISC/Tools  
         ;;  
       nowhere)  
         unpack "MLRISC Tools Library" $SRCDIR MLRISC MLRISC  
         echo standalone nowhere NoWhere . MLRISC/Tools >>$LATESTANDALONES  
         echo nowhere $TOOLDIR >>$CM_PATHCONFIG  
         ;;  
       doc)  
         echo Package doc is currently unavailable.  
         # unpack Doc $ROOT doc doc  
         # cd $ROOT/doc  
         # build $ROOT  
         ;;  
       *)  
         echo "$this: !!! Unknown target $i."  
         ;;  
     esac  
 done  
391    
392  #  #
393  # 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.  
394  #  #
395    echo $this: Installing other libraries and programs:
396  echo $this: Compiling library code.  export ROOT INSTALLDIR CONFIGDIR BINDIR
397  echo 'then OS.Process.success else OS.Process.failure));' >>$LIBLIST  if "$BINDIR"/sml -m \$smlnj/installer.cm
398  if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then  then
399      vsay $this: Libraries compiled successfully.      vsay $this: Installation complete.
400  else  else
401      complain "$this: !!! Something went wrong when compiling the libraries."      complain "$this: !!! Installation of libraries and programs failed."
 fi  
   
 #  
 # Move the libraries to their final locations...  
 #  
   
 if [ -r $LIBMOVESCRIPT ] ; then  
     vsay $this: Moving libraries to $LIBDIR.  
     . $LIBMOVESCRIPT  
 fi  
   
 #  
 # Build "late" standalone programs (i.e., those that must be built  
 # after libraries are already in place):  
 #  
   
 if [ -r $LATESTANDALONES ] ; then  
     vsay $this: Building late standalone programs.  
     . $LATESTANDALONES  
 fi  
   
 #  
 # Finally, remove duplicate entries from pathconfig file...  
 #  
 if [ -f $CM_PATHCONFIG ] ; then  
     cp $CM_PATHCONFIG $PCEDITTMP  
     rm -f $CM_PATHCONFIG  
     awk <$PCEDITTMP 'NF == 2 { mapping[$1] = $2 }  
 NF != 2 { print $0 }  
 END { for (i in mapping) print i, mapping[i] }' \  
       | sort >$CM_PATHCONFIG  
402  fi  fi
403    
404  exit 0  exit 0

Legend:
Removed from v.1368  
changed lines
  Added in v.1725

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