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/branches/SMLNJ/config/install.sh revision 411, Fri Sep 3 00:25:03 1999 UTC sml/trunk/config/install.sh revision 615, Wed Apr 12 04:52:09 2000 UTC
# Line 2  Line 2 
2  #  #
3  # Copyright (c) 1994 AT&T Bell Laboratories.  # Copyright (c) 1994 AT&T Bell Laboratories.
4  #  #
5  # installation script for SML/NJ and related tools; this is a temporary  # Installation script for SML/NJ and related tools; this is a temporary
6  # placeholder until the configuration tool is finished.  # placeholder until the configuration tool is finished.
7  #  #
8    # Significant changes to accommodate (and take advantage of) the new CM
9    # by M.Blume (2/2000).
10    #
11    
12  #set -x  this=$0
13    
14  #  #
15  # get the target list  # get the target list
16  #  #
17  if [ ! -r config/targets ]; then  if [ ! -r config/targets ]; then
18    echo "!!! no target list"      echo "$this: !!! File config/targets is missing."
19    exit 1;      exit 1
20  fi  fi
21  . config/targets  . config/targets
22    
23  #  #
24  # some OSs have make in strange places  # create the preloads.standard file
25  #  #
26  MAKE=make  if [ ! -r config/preloads ]; then
27        echo "$this: !!! File config/preloads is missing."
28        exit 1
29    fi
30    cp config/preloads preloads.standard
31    
32  #  #
33  # command for building SML libraries; this should be either  # Some OSs have make in strange places, but most of the time it is
34  # "CM.recompile()" or "CM.stabilize true".  The latter builds  # simply on the PATH:
 # stable libraries, which may be somewhat faster to use.  
35  #  #
36  #CM_MAKE_LIB="CM.recompile();"  MAKE=make
 CM_MAKE_LIB="CM.stabilize true;"  
37    
 #  
 # check for ksh  
 #  
 # ksh causes some people problems so we will always use /bin/sh  
 #  
 #echo "checking for ksh"  
 #if [ -x /bin/ksh ]; then  
 #  SHELL=/bin/ksh  
 #elif [ -x /usr/local/bin/ksh ]; then  
 #  SHELL=/usr/local/bin/ksh  
 #else  
38    SHELL=/bin/sh    SHELL=/bin/sh
39  #fi  echo $this: Using shell $SHELL.
 echo "  using $SHELL"  
40    
41  #  #
42  # set the SML root directory  # set the SML root directory
43  #  #
44  REAL_PWD=`pwd`  REAL_PWD=`pwd`
45  ROOT=${PWD:-$REAL_PWD}  ROOT=${PWD:-$REAL_PWD}
46  echo "SML root is $ROOT"  echo $this: SML root is $ROOT.
47    echo $this: Installation directory is ${INSTALLDIR:=$ROOT}.
48    
49  #  #
50  # set the various directory pathname variables  # set the various directory and file pathname variables
51  #  #
52  BINDIR=$ROOT/bin  BINDIR=$INSTALLDIR/bin          # main dir for binary stuff
53  CONFIGDIR=$ROOT/config  CONFIGDIR=$ROOT/config
54  HEAPDIR=$BINDIR/.heap  HEAPDIR=$BINDIR/.heap           # where heap images live
55  RUNDIR=$BINDIR/.run  RUNDIR=$BINDIR/.run             # where executables (i.e., the RTS) live
56  SRCDIR=$ROOT/src  SRCDIR=$ROOT/src                # where the source tree is rooted
57  LIBDIR=$ROOT/lib  LIBDIR=$INSTALLDIR/lib          # where libraries live
58    LIBLIST=$ROOT/liblist           # list of commands to stabilize libraries
59    LIBMOVESCRIPT=$ROOT/libmove     # a temporary script
60    LOCALPATHCONFIG=$INSTALLDIR/pathconfig # a temporary pathconfig file
61    
62    URLGETTER=unknown
63    
64  #  #
65  # the paths to ml-yacc and ml-lex; needed to configure CM  # the path to the dir where ml-yacc, ml-burg, ml-lex, and ml-build live
66  #  #
67  YACCPATH=$BINDIR/ml-yacc  TOOLDIR=$BINDIR
68  LEXPATH=$BINDIR/ml-lex  
69  BURGPATH=$BINDIR/ml-burg  #
70    # files to be deleted after we are done...
71    #
72    tmpfiles=""
73    tmpfiles="$tmpfiles $ROOT/preloads.standard"
74    tmpfiles="$tmpfiles $LIBLIST"
75    tmpfiles="$tmpfiles $LOCALPATHCONFIG"
76    tmpfiles="$tmpfiles $LIBMOVESCRIPT"
77    #
78    # make sure we always clean up after ourselves...
79    #
80    trap 'rm -f $tmpfiles' 0 1 2 3 15
81    
82    
83  #  #
84  # set the CM configuration variables (these are environment variables  # set the CM configuration variables (these are environment variables
85  # that will be queried by the bootstrap code)  # that will be queried by the bootstrap code)
86  #  -M.Blume (5/1998)  # Especially important is CM_PATHCONFIG_DEFAULT.
87  #  #
88  CM_YACC_DEFAULT=$YACCPATH  CM_PATHCONFIG_DEFAULT=$LIBDIR/pathconfig
89  CM_LEX_DEFAULT=$LEXPATH  export CM_PATHCONFIG_DEFAULT
 CM_BURG_DEFAULT=$BURGPATH  
 CM_PATH_DEFAULT=.:$LIBDIR  
 export CM_YACC_DEFAULT CM_LEX_DEFAULT CM_BURG_DEFAULT CM_PATH_DEFAULT  
90    
91  #  #
92  # the release version that we are installing  # the release version that we are installing
93  #  #
94  VERSION=`cat $CONFIGDIR/version`  VERSION=`cat $CONFIGDIR/version`
95  echo "installing version $VERSION"  echo $this: Installing version $VERSION.
96    
97  #  #
98  # create the various sub directories  # the URL for the (usually remote) source archive
99  #  #
100  for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR  SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl`
101  do  echo $this: URL of source archive is $SRCARCHIVEURL.
102    if [ -d $dir ]; then  
103      echo "$dir already exists"  #
104    # Function to make a directory (and advertise such action).
105    #
106    makedir() {
107        if [ ! -d $1 ] ; then
108            echo $this: Making directory $1
109            if mkdir $1 ; then
110                : everything is fine
111    else    else
112      echo "creating $dir"              echo "$this: !!! Unable to make directory $1!"
     mkdir $dir  
     if [ $? != "0" ]; then  
       echo "unable to create $dir"  
113        exit 1        exit 1
114      fi      fi
115    fi    fi
116    }
117    
118    #
119    # Function for asking user to fetch source archive.
120    #   $1 - descriptive name
121    #   $2 - base name without extension, without version, and without dir
122    #   $3 - remote directory
123    #
124    askurl() {
125        echo "$this: Please, fetch $1 archive"
126        echo ' ('$2.'*' or $VERSION-$2.'*)'
127        echo " from $3"
128        echo " and then re-run this script!"
129        exit 1
130    }
131    
132    #
133    # Function for fetching source archives automatically using wget or lynx.
134    #   $1 - command to actually get the stuff
135    #   $2 - descriptive name
136    #   $3 - base name without extension and without dir
137    #   $4 - remote directory
138    #
139    fetchurl() {
140        getter=$1 ; shift
141        echo $this: Fetching $1 from $3. Please stand by...
142        fetched=no
143        for base in $2 $VERSION-$2 ; do
144            for ext in tar.gz tgz tar.Z tz tar tar.bz2 ; do
145                try=$base.$ext
146                echo $this: Trying $try ...
147                if $getter $3 $try $ROOT/$try ; then
148                    fetched=yes
149                    echo $this: Fetching $try was a success.
150                    break 2         # get out of both for-loops
151                else
152                    rm -f $ROOT/$try
153                fi
154            done
155  done  done
156        if [ $fetched = no ] ; then
157            echo $this: Fetching $try was no success.
158            echo '  ' You should try to do it manually now.
159            askurl "$1" "$2" "$3"
160        fi
161    }
162    
163    usewget() {
164        wget -nv -O $3 $1/$2
165    }
166    
167    uselynx() {
168        lynx -source $1/$2 >$3
169    }
170    
171    testurlgetter() {
172        (exec >/dev/null 2>&1 ; exec $*)
173    }
174    
175    #
176    # Function to check whether wget or lynx is available.
177    # Set URLGETTER accordingly.
178    #
179    urlgetter() {
180        if [ "$URLGETTER" = unknown ] ; then
181            if testurlgetter wget --help ; then
182                URLGETTER="fetchurl usewget"
183            elif testurlgetter lynx -help ; then
184                URLGETTER="fetchurl uselynx"
185            else
186                URLGETTER="askurl"
187            fi
188        fi
189    }
190    
191    un_tar() {
192        echo "$this: Un-TAR-ing $1 archive."
193        tar -xf $2
194    }
195    
196    un_tar_Z() {
197        echo "$this: Un-COMPRESS-ing and un-TAR-ing $1 archive."
198        zcat $2 | tar -xf -
199    }
200    
201    un_tar_gz() {
202        echo "$this: Un-GZIP-ing and un-TAR-ing $1 archive."
203        gunzip -c $2 | tar -xf -
204    }
205    
206    un_tar_bz2() {
207        echo "$this: Un-BZIP2-ing and un-TAR-ing $1 archive."
208        bunzip2 -c $2 | tar -xf -
209    }
210    
211    unarchive() {
212        # $1: descriptive string, $2: archive, $3: unpacker
213        if [ -r $ROOT/$2 ] ; then
214            $3 "$1" $ROOT/$2
215        elif [ -r $ROOT/$VERSION-$2 ]; then
216            $3 "$1" $ROOT/$VERSION-$2
217        else
218            return 1
219        fi
220    }
221    
222    #
223    # Function to unpack a source archive.
224    #
225    # $1: descriptive name of the sources to be unpacked
226    # $2: the directory into which to unpack the sources
227    # $3: the sub-directory of $2 that is going to be created by unpacking
228    # $4: the basename of the source archive (the script will check several
229    #     different suffixes to determine what kind of de-compression is to
230    #     be used)
231    #
232    # fetch_n_unpack is the helper function that does the real work.  If
233    # no archive is found locally, it invokes $URLGETTER and tries again.
234    # The variable $tryfetch is used to make sure this happens only once.
235    fetch_n_unpack() {
236        cd $2
237        if unarchive "$1" $4.tar.gz un_tar_gz ||
238           unarchive "$1" $4.tgz un_tar_gz ||
239           unarchive "$1" $4.tar.Z un_tar_Z ||
240           unarchive "$1" $4.tar un_tar ||
241           unarchive "$1" $4.tar.bz1 un_tar_bz2 ||
242           unarchive "$1" $4.tz un_tar_Z
243        then
244            : we are done
245        elif [ $tryfetch = yes ] ; then
246            urlgetter
247            $URLGETTER "$1" $4 $SRCARCHIVEURL
248            tryfetch=no
249            fetch_n_unpack "$1" "$2" "$3" "$4"
250        fi
251    }
252    
253    #
254    # The main "unpack" driver function that invokes the above helper.
255    #
256    unpack() {
257        tryfetch=yes
258        if [ -d $2/$3 ]; then
259            echo "$this: The $1 tree already exists."
260        else
261            fetch_n_unpack "$1" "$2" "$3" "$4"
262        fi
263        if [ ! -d $2/$3 ]; then
264            echo "$this: !!! Unable to unpack $1 archive."
265            exit 1
266        fi
267    }
268    
269    # A function to move all stable library files to a parallel directory
270    # hierarchy.
271    # The first argument must be a simple path (no / inside), and
272    # the second argument must be an absolute path.
273    move() {
274        if [ -d $1 ] ; then
275            if [ ! -d $2 ] ; then
276                if [ -f $2 ] ; then
277                    echo $this: $2 exists as a non-directory.
278                    exit 1
279                fi
280                mkdir $2
281            fi
282            cd $1
283            for i in * ; do
284                move $i $2/$i
285            done
286            cd ..
287        elif [ -f $1 ] ; then
288            rm -f $2
289            mv $1 $2
290        fi
291    }
292    
293    #
294    # Move the stable archive of a library whose description file was $1/$2 to
295    # $LIBDIR/$2/CM/$ARCH-unix/$2 so that it appears as if the description file
296    # had been at $LIBDIR/$2/$2
297    #
298    # (This script will also move all other libraries that show up in
299    #  $1/CM/$ARCH-unix because in the case of the boot directory this indicates
300    #  that some library did not have its own path anchor but was specified
301    #  relative to $1/$2. Still, don't rely on this to be robust -- rather make
302    #  separate anchors for every library!)
303    #
304    movelibs() {
305        for lib in `/bin/ls $1/CM/$ARCH-unix` ; do
306            case $lib in
307            *.cm | *.cmi)
308                if [ $lib != $2 ] ; then
309                    echo "$this: Warning:" $lib specified relative to $2
310                fi
311                echo $this: Moving library $lib to $LIBDIR
312                makedir $LIBDIR/$2
313                makedir $LIBDIR/$2/CM
314                makedir $LIBDIR/$2/CM/$ARCH-unix
315                mv $1/CM/$ARCH-unix/$lib $LIBDIR/$2/CM/$ARCH-unix/$lib
316                ;;
317            *)
318                ;;
319            esac
320         done
321    }
322    
323    # A shell function that registers a library for being built.
324    # This function takes two arguments: 1. a name under which the library
325    # is to be known later (something.cm) and 2. the path relative to $SRCDIR
326    # that leads to the library's .cm file.  The library's .cm file must be the
327    # same as $1.
328    #
329    # This works by adding ML code to file $LIBLIST.  The code in this file
330    # will be executed near the end of this script.  If $MOVE_LIBRARIES is
331    # set to true, then reglib will also register a "movelibs" to be executed at
332    # the end by putting a "movelibs" line into $LIBMOVESCRIPT.
333    
334    reglib() {
335        if [ x$MOVE_LIBRARIES = xtrue ] ; then
336            FINALLOCATION=$LIBDIR/$1
337        else
338            FINALLOCATION=$SRCDIR/$2
339        fi
340        if [ -d $FINALLOCATION/CM/$ARCH-unix ] ; then
341            echo "$this: Library $1 already exists in $FINALLOCATION."
342        else
343            echo "$this: Scheduling library $1 to be built in $FINALLOCATION."
344            echo "  andalso CM.stabilize false \"$1\"" >>$LIBLIST
345            echo $1 $SRCDIR/$2 >>$LOCALPATHCONFIG
346            if [ x$MOVE_LIBRARIES = xtrue ] ; then
347                echo movelibs $SRCDIR/$2 $1 >>$LIBMOVESCRIPT
348            fi
349            echo $1 $FINALLOCATION >>$CM_PATHCONFIG_DEFAULT
350        fi
351    }
352    
353    #
354    # Function to build a standalone program such as ml-yacc.  The function takes
355    # 2 or 3 arguments.  First the name of the program which at the same time
356    # is the directory name under $SRCDIR where the sources reside.  The second
357    # argument is a descriptive name for the program (passed on to "unpack").
358    # The optional third argument specifies the path relative to $SRCDIR/$1
359    # of the directory where the program's heap image is to be found.
360    #
361    
362    standalone() {
363        TARGET=$1.$HEAP_SUFFIX
364        if [ $# = 3 ] ; then
365            TARGETLOC=$3/$TARGET
366        else
367            TARGETLOC=$TARGET
368        fi
369        if [ -r $HEAPDIR/$TARGET ] ; then
370            echo $this: Target $TARGET already exists.
371        else
372            echo $this: Building $TARGET.
373            unpack $2 $SRCDIR $1 $1
374            cd $SRCDIR/$1
375            ./build
376            if [ -r $TARGETLOC ] ; then
377                mv $TARGETLOC $HEAPDIR/$TARGET
378                if [ ! -f $BINDIR/$1 ] ; then
379                    cd $BINDIR
380                    ln -s .run-sml $1
381                fi
382            else
383                echo "$this: !!! Build of $TARGET failed."
384            fi
385        fi
386    }
387    
388    #
389    # create the various sub directories
390    #
391    for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR ; do
392        makedir $dir
393    done
394    
395  #  #
396  # install the script that tests the architecture, and make sure that it works  # install the script that tests the architecture, and make sure that it works
397  #  #
398  if [ -x $BINDIR/.arch-n-opsys ]; then  if [ -x $BINDIR/.arch-n-opsys ]; then
399    echo "$BINDIR/.arch-n-opsys already exists"      echo $this: Script $BINDIR/.arch-n-opsys already exists.
400  else  else
401    cat $CONFIGDIR/_arch-n-opsys | sed -e "s,@SHELL@,$SHELL,g" > $BINDIR/.arch-n-opsys      cat $CONFIGDIR/_arch-n-opsys \
402        | sed -e "s,@SHELL@,$SHELL,g" > $BINDIR/.arch-n-opsys
403    chmod 555 $BINDIR/.arch-n-opsys    chmod 555 $BINDIR/.arch-n-opsys
404    if [ ! -x $BINDIR/.arch-n-opsys ]; then    if [ ! -x $BINDIR/.arch-n-opsys ]; then
405      echo "!!! installation of $BINDIR/.arch-n-opsys failed for some reason"          echo "$this: !!! Installation of $BINDIR/.arch-n-opsys failed."
406      exit 1      exit 1
407    fi    fi
408  fi  fi
409    
410  ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`  ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`
411  if [ "$?" != "0" ]; then  if [ "$?" != "0" ]; then
412    echo "!!! $BINDIR/.arch-n-opsys fails on this machine"      echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine."
413    echo "!!! you must patch this by hand and repeat the installation"      echo "$this: !!! You must patch this by hand and repeat the installation."
414    exit 2    exit 2
415  else  else
416    echo "$BINDIR/.arch-n-opsys reports $ARCH_N_OPSYS"      echo $this: Script $BINDIR/.arch-n-opsys reports $ARCH_N_OPSYS.
417  fi  fi
418  eval $ARCH_N_OPSYS  eval $ARCH_N_OPSYS
419    
420  if [ -x $BINDIR/.run-sml ]; then  #
421    echo "$BINDIR/.run-sml already exists"  # Function to install a "driver" script...
422  else  #   This takes care of patching the source of the script with the SHELL,
423    cat $CONFIGDIR/_run-sml | \  #   BINDIR, and VERSION variables to use.
424      sed -e "s,@SHELL@,$SHELL,g" -e "s,@BINDIR@,$BINDIR," -e "s,@VERSION@,$VERSION," \  #
425      > $BINDIR/.run-sml  installdriver() {
426    chmod 555 $BINDIR/.run-sml      dsrc=$1
427    if [ ! -x $BINDIR/.run-sml ]; then      ddst=$2
428      echo "!!! installation of $BINDIR/.run-sml failed for some reason"  # We install the driver unconditionally. (It would be better to test
429    # for an outdated driver script, but not all "test" commands understand
430    # the -nt comparison operator....)
431    #   if [ -x $BINDIR/$ddst ]; then
432    #       echo $this: Script $BINDIR/$ddst already exists.
433    #   else
434            rm -f $BINDIR/$ddst
435            cat $CONFIGDIR/$dsrc | \
436            sed -e "s,@SHELL@,$SHELL,g" \
437                -e "s,@BINDIR@,$BINDIR," \
438                -e "s,@VERSION@,$VERSION," \
439                > $BINDIR/$ddst
440            chmod 555 $BINDIR/$ddst
441            if [ ! -x $BINDIR/$ddst ]; then
442                echo "$this: !!! Installation of $BINDIR/${ddst} failed."
443      exit 1      exit 1
444    fi    fi
445  fi  #   fi
446    }
447    
448    installdriver _run-sml .run-sml
449    installdriver _link-sml .link-sml
450    installdriver _ml-build ml-build
451    
452  #  #
453  # set some architecture dependent run-time system flags  # set some architecture dependent run-time system flags
454  #  #
455  case $ARCH in  case $ARCH in
456    mips*) ALLOC=1M ;;      mips*)
457            ALLOC=1M
458            ;;
459    x86)    x86)
460            # The following is the _wrong_ value for many popular x86 chips
461            # (i.e., Celerons).  However, the optimal value for those is 32k,
462            # and such a small value is not enough for the runtime system's boot
463            # code.  Therefore, we use 256k here and re-set it to the proper
464            # value in .run-sml.
465      ALLOC=256k      ALLOC=256k
466    ;;    ;;
467    alpha32)    alpha32)
# Line 155  Line 471 
471      ALLOC=512k      ALLOC=512k
472    ;;    ;;
473  esac  esac
474    
475  case $OPSYS in  case $OPSYS in
476    solaris)    solaris)
477      MAKE=/usr/ccs/bin/make      MAKE=/usr/ccs/bin/make
# Line 162  Line 479 
479    linux)    linux)
480      EXTRA_DEFS=`$CONFIGDIR/chk-global-names.sh`      EXTRA_DEFS=`$CONFIGDIR/chk-global-names.sh`
481      if [ "$?" != "0" ]; then      if [ "$?" != "0" ]; then
482        echo "problems checking for underscores in global names"              echo "$this: !!! Problems checking for underscores in asm names."
483        exit 1        exit 1
484      fi      fi
485      EXTRA_DEFS="XDEFS=$EXTRA_DEFS"      EXTRA_DEFS="XDEFS=$EXTRA_DEFS"
# Line 172  Line 489 
489  #  #
490  # the name of the bin files directory  # the name of the bin files directory
491  #  #
492  BIN_FILES=bin.$ARCH-unix  BOOT_ARCHIVE=boot.$ARCH-unix
493    BOOT_FILES=sml.$BOOT_ARCHIVE
494    
495  #  #
496  # build the run-time system  # build the run-time system
497  #  #
498  $CONFIGDIR/unpack.sh "run-time" $SRCDIR runtime $ROOT/$VERSION-runtime.tar  unpack "run-time" $SRCDIR runtime runtime
499  if [ "$?" != "0" ]; then  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then
500    exit $?      echo $this: Run-time system already exists.
501  fi  else
 if [ ! -x $RUNDIR/run.$ARCH-$OPSYS ]; then  
502    cd $SRCDIR/runtime/objs    cd $SRCDIR/runtime/objs
503    echo "compiling the run-time system"      echo $this: Compiling the run-time system.
504    $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS    $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS
505    if [ -x run.$ARCH-$OPSYS ]; then    if [ -x run.$ARCH-$OPSYS ]; then
506      mv run.$ARCH-$OPSYS $RUNDIR      mv run.$ARCH-$OPSYS $RUNDIR
507      $MAKE MAKE=$MAKE clean          # $MAKE MAKE=$MAKE clean
508    else    else
509      echo "!!! run-time system build failed for some reason"          echo "$this: !!! Run-time system build failed for some reason."
510      exit 1      exit 1
511    fi    fi
512  fi  fi
# Line 199  Line 516 
516  # boot the base SML system  # boot the base SML system
517  #  #
518  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then
519    echo "$HEAPDIR/sml.$HEAP_SUFFIX already exists"      echo $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.
520  else  else
521    $CONFIGDIR/unpack.sh bin $ROOT $BIN_FILES $ROOT/$VERSION-$BIN_FILES.tar      unpack bin $ROOT $BOOT_FILES $BOOT_ARCHIVE
522        cd $ROOT/$BOOT_FILES
523        if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC
524        then
525    cd $ROOT    cd $ROOT
   $RUNDIR/run.$ARCH-$OPSYS @SMLboot=$ROOT/$BIN_FILES @SMLalloc=$ALLOC <<XXXX  
     $SET_FLAGS  
     val use = Compiler.Interact.useFile  
     val _ = (SMLofNJ.exportML "sml";  
              print Compiler.banner;  
              print "\n");  
 XXXX  
526    if [ -r sml.$HEAP_SUFFIX ]; then    if [ -r sml.$HEAP_SUFFIX ]; then
527      mv sml.$HEAP_SUFFIX $HEAPDIR      mv sml.$HEAP_SUFFIX $HEAPDIR
528      cd $BINDIR      cd $BINDIR
529      ln -s .run-sml sml      ln -s .run-sml sml
530                #
531                # Now move all stable libraries to #LIBDIR and generate
532                # the pathconfig file.
533                #
534                cd $ROOT/$BOOT_FILES
535                for anchor in * ; do
536                    if [ -d $anchor ] ; then
537                        echo $anchor $anchor >>$CM_PATHCONFIG_DEFAULT
538                        move $anchor $LIBDIR/$anchor
539                    fi
540                done
541                cd $ROOT
542                # $BOOT_FILES is now only an empty skeleton, let's get rid of it.
543                rm -rf $BOOT_FILES
544    
545            else
546                echo "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."
547                exit 1
548            fi
549    else    else
550      echo "!!! unable to build SML heap image (sml.$HEAP_SUFFIX)"          echo "$this !!! Boot code failed, no heap image (sml.$HEAP_SUFFIX)."
551      exit 1      exit 1
552    fi    fi
553  fi  fi
554    
555    #
556    # Initialize $LIBLIST
557    #
558    cd $ROOT
559    rm -f $LOCALPATHCONFIG $LIBLIST
560    echo 'ignore (OS.Process.exit (if true' >$LIBLIST
561    
562  #  #
563  # now build the individual targets  # now build (or prepare to build) the individual targets
564  #  #
565  cd $SRCDIR  cd $SRCDIR
566  echo "install targets"  echo $this: Installing other targets.
567  for i in $TARGETS  for i in $TARGETS ; do
 do  
   if [ $i = "doc" ]; then  
     TARGET=$i  
   else  
     TARGET=$i.$HEAP_SUFFIX  
   fi  
   if [ -r $HEAPDIR/$TARGET ]; then  
     echo "$TARGET already exists"  
   else  
     echo "  building $TARGET"  
568      case $i in      case $i in
569        src-smlnj)        src-smlnj)
570          for src in compiler comp-lib cm MLRISC; do          for src in compiler cm MLRISC smlnj-lib ml-yacc system
571            $CONFIGDIR/unpack.sh $src $ROOT/src $src $ROOT/$VERSION-$src.tar          do
572                unpack $src $ROOT/src $src $src
573          done          done
574        ;;        ;;
       sml-full)  
         if [ ! -d $ROOT/$BIN_FILES ]; then  
           echo "!!! bin files are missing; build of $TARGET failed"  
           exit 1  
         else  
           cd $ROOT  
           $RUNDIR/run.$ARCH-$OPSYS @SMLfull @SMLboot=$ROOT/$BIN_FILES @SMLalloc=$ALLOC <<XXXX  
             $SET_FLAGS  
             val use = Compiler.Interact.useFile  
             val _ = (SMLofNJ.exportML "sml-full";  
                      print Compiler.banner;  
                      print " [full]\n");  
 XXXX  
           if [ -r sml-full.$HEAP_SUFFIX ]; then  
             mv sml-full.$HEAP_SUFFIX $HEAPDIR  
             cd $BINDIR  
             ln -s .run-sml sml-full  
           else  
             echo "!!! unable to build SML-FULL heap image"  
             exit 1  
           fi  
         fi  
       ;;  
575        ml-yacc)        ml-yacc)
576          $CONFIGDIR/unpack.sh ML-Yacc $SRCDIR ml-yacc $ROOT/$VERSION-ml-yacc.tar          standalone ml-yacc ML-Yacc src
577          if [ "$?" != "0" ]; then          echo ml-yacc $TOOLDIR >>$CM_PATHCONFIG_DEFAULT
           exit $?  
         fi  
         cd $SRCDIR/ml-yacc  
         ./build  
         if [ -r src/$TARGET ]; then  
           mv src/$TARGET $HEAPDIR  
           if [ ! -f $BINDIR/$i ]; then  
             cd $BINDIR  
             ln -s .run-sml $i  
           fi  
         else  
           echo "!!! build of $TARGET failed"  
           exit 1  
         fi  
578        ;;        ;;
579        ml-lex)        ml-lex)
580          $CONFIGDIR/unpack.sh ML-Lex $SRCDIR ml-lex $ROOT/$VERSION-ml-lex.tar          standalone ml-lex ML-Lex
581          if [ "$?" != "0" ]; then          echo ml-lex $TOOLDIR >>$CM_PATHCONFIG_DEFAULT
           exit $?  
         fi  
         cd $SRCDIR/ml-lex  
         ./build  
         if [ -r $TARGET ]; then  
           mv $TARGET $HEAPDIR  
           if [ ! -f $BINDIR/$i ]; then  
             cd $BINDIR  
             ln -s .run-sml $i  
           fi  
         else  
           echo "!!! build of $TARGET failed"  
           exit 1  
         fi  
582        ;;        ;;
583        ml-burg)        ml-burg)
584          $CONFIGDIR/unpack.sh ML-Burg $SRCDIR ml-burg $ROOT/$VERSION-ml-burg.tar          standalone ml-burg ML-Burg
585          if [ "$?" != "0" ]; then          echo ml-burg $TOOLDIR >>$CM_PATHCONFIG_DEFAULT
           exit $?  
         fi  
         cd $SRCDIR/ml-burg  
         ./build  
         if [ -r $TARGET ]; then  
           mv $TARGET $HEAPDIR  
           if [ ! -f $BINDIR/$i ]; then  
             cd $BINDIR  
             ln -s .run-sml $i  
           fi  
         else  
           echo "!!! build of $TARGET failed"  
           exit 1  
         fi  
586        ;;        ;;
587        smlnj-lib)        smlnj-lib)
588          $CONFIGDIR/unpack.sh "SML/NJ Library" $SRCDIR smlnj-lib $ROOT/$VERSION-smlnj-lib.tar          unpack "SML/NJ Library" $SRCDIR smlnj-lib smlnj-lib
589          if [ "$?" != "0" ]; then  
590            exit $?          # Don't make the Util library -- it came pre-made and has been
591          fi          # installed when making the base system.  In other words, don't do...
592        # make the Util library              #reglib smlnj-lib.cm smlnj-lib/Util
593          cd $SRCDIR/smlnj-lib/Util          # ... and don't make the HTML library ...
594          echo "$CM_MAKE_LIB" | $BINDIR/sml              #reglib html-lib.cm smlnj-lib/HTML
595          if [ ! -f $LIBDIR/smlnj-lib.cm ]; then          # ... and don't make the PP library ...
596            cd $LIBDIR              #reglib pp-lib.cm smlnj-lib/PP
           echo "Alias $SRCDIR/smlnj-lib/Util/sources.cm" > smlnj-lib.cm  
         fi  
597        # make the Unix library        # make the Unix library
598          cd $SRCDIR/smlnj-lib/Unix              reglib unix-lib.cm smlnj-lib/Unix
         echo "$CM_MAKE_LIB" | $BINDIR/sml  
         if [ ! -f $LIBDIR/unix-lib.cm ]; then  
           cd $LIBDIR  
           echo "Alias $SRCDIR/smlnj-lib/Unix/sources.cm" > unix-lib.cm  
         fi  
599        # make the INet library        # make the INet library
600          cd $SRCDIR/smlnj-lib/INet              reglib inet-lib.cm smlnj-lib/INet
         echo "$CM_MAKE_LIB" | $BINDIR/sml-cm  
         if [ ! -f $LIBDIR/inet-lib.cm ]; then  
           cd $LIBDIR  
           echo "Alias $SRCDIR/smlnj-lib/INet/sources.cm" > inet-lib.cm  
         fi  
       # make the HTML library  
         cd $SRCDIR/smlnj-lib/HTML  
         echo "$CM_MAKE_LIB" | $BINDIR/sml  
         if [ ! -f $LIBDIR/html-lib.cm ]; then  
           cd $LIBDIR  
           echo "Alias $SRCDIR/smlnj-lib/HTML/sources.cm" > html-lib.cm  
         fi  
       # make the PP library  
         cd $SRCDIR/smlnj-lib/PP  
         echo "$CM_MAKE_LIB" | $BINDIR/sml  
         if [ ! -f $LIBDIR/pp-lib.cm ]; then  
           cd $LIBDIR  
           echo "Alias $SRCDIR/smlnj-lib/PP/sources.cm" > pp-lib.cm  
         fi  
601        # make the RegExp library        # make the RegExp library
602          cd $SRCDIR/smlnj-lib/RegExp              reglib regexp-lib.cm smlnj-lib/RegExp
         echo "$CM_MAKE_LIB" | $BINDIR/sml  
         if [ ! -f $LIBDIR/regexp-lib.cm ]; then  
           cd $LIBDIR  
           echo "Alias $SRCDIR/smlnj-lib/RegExp/sources.cm" > regexp-lib.cm  
         fi  
603        # make the Reactive library        # make the Reactive library
604          cd $SRCDIR/smlnj-lib/Reactive              reglib reactive-lib.cm smlnj-lib/Reactive
         echo "$CM_MAKE_LIB" | $BINDIR/sml  
         if [ ! -f $LIBDIR/reactive-lib.cm ]; then  
           cd $LIBDIR  
           echo "Alias $SRCDIR/smlnj-lib/Reactive/sources.cm" > reactive-lib.cm  
         fi  
       ;;  
       ml-yacc-lib)  
         $CONFIGDIR/unpack.sh ML-Yacc $SRCDIR ml-yacc $ROOT/$VERSION-ml-yacc.tar  
         if [ "$?" != "0" ]; then  
           exit $?  
         fi  
         cd $SRCDIR/ml-yacc/lib  
         echo "$CM_MAKE_LIB" | $BINDIR/sml  
         if [ ! -f $LIBDIR/ml-yacc-lib.cm ]; then  
           cd $LIBDIR  
           echo "Alias $SRCDIR/ml-yacc/lib/sources.cm" > ml-yacc-lib.cm  
         fi  
605        ;;        ;;
606        cml)        cml)
607          $CONFIGDIR/unpack.sh CML $SRCDIR cml $ROOT/$VERSION-cml.tar          unpack CML $SRCDIR cml cml
608          if [ "$?" != "0" ]; then          reglib core-cml.cm cml/src/core-cml
609            exit $?          reglib cml.cm cml/src
610          fi          reglib cml-basis.cm cml
         cd $SRCDIR/cml/src  
         echo "$CM_MAKE_LIB" | $BINDIR/sml  
         if [ ! -f $LIBDIR/cml.cm ]; then  
           cd $LIBDIR  
           echo "Alias $SRCDIR/cml/src/sources.cm" > cml.cm  
         fi  
611        ;;        ;;
612        cml-lib)        cml-lib)
613          $CONFIGDIR/unpack.sh CML $SRCDIR cml $ROOT/$VERSION-cml.tar          unpack CML $SRCDIR cml cml
614          if [ "$?" != "0" ]; then          reglib cml-lib.cm cml/cml-lib
           exit $?  
         fi  
         cd $SRCDIR/cml/cml-lib  
         echo "$CM_MAKE_LIB" | $BINDIR/sml  
         if [ ! -f $LIBDIR/cml-lib.cm ]; then  
           cd $LIBDIR  
           echo "Alias $SRCDIR/cml/cml-lib/sources.cm" > cml-lib.cm  
         fi  
       ;;  
       cml-cm)  
         CMD="CM.autoloading(SOME true); CM.clearAutoList();"  
         CMD="$CMD CM.autoload'(\"$LIBDIR/cml.cm\");"  
         if [ "$AUTOLOAD_CML_LIB" = "TRUE" ]; then  
           CMD="$CMD CM.autoload'(\"$LIBDIR/cml-lib.cm\");"  
         fi  
         if [ "$AUTOLOAD_EXENE" = "TRUE" ]; then  
           CMD="$CMD CM.autoload'(\"$LIBDIR/eXene.cm\");"  
         fi  
         cd $ROOT  
         $BINDIR/sml <<XXXX  
           $CMD  
           val _ = (SMLofNJ.exportML "$i";  
                 print CML.banner;  
                 print "[CML autoload]\n");  
 XXXX  
         if [ -r $TARGET ]; then  
           mv $TARGET $HEAPDIR  
           if [ ! -f $BINDIR/$i ]; then  
             cd $BINDIR  
             ln -s .run-sml $i  
           fi  
         else  
           echo "!!! unable to build autoloading CML"  
           exit 1  
         fi  
615        ;;        ;;
616        eXene)        eXene)
617          $CONFIGDIR/unpack.sh EXene $SRCDIR eXene $ROOT/$VERSION-eXene.tar          unpack EXene $SRCDIR eXene eXene
618          if [ "$?" != "0" ]; then          reglib eXene.cm eXene
           exit $?  
         fi  
         cd $SRCDIR/eXene  
         echo "$CM_MAKE_LIB" | $BINDIR/sml  
         if [ ! -f $LIBDIR/eXene.cm ]; then  
           cd $LIBDIR  
           echo "Alias $SRCDIR/eXene/sources.cm" > eXene.cm  
         fi  
619        ;;        ;;
620        doc)        doc)
621          $CONFIGDIR/unpack.sh Doc $ROOT doc $ROOT/$VERSION-doc.tar          unpack Doc $ROOT doc doc
         if [ "$?" != "0" ]; then  
           exit $?  
         fi  
622          cd $ROOT/doc          cd $ROOT/doc
623          build $ROOT          build $ROOT
624        ;;        ;;
625        *)        *)
626          echo "!!! unknown target $i"          echo "$this: !!! Unknown target $i."
627        ;;        ;;
628      esac      esac
   fi  
629  done  done
630    
631  if [ "$ENABLE_AUTOLOADING" = "TRUE" ]; then  #
632    CMD="CM.autoloading(SOME true); CM.clearAutoList();"  # Now go and stabilize all registered libraries...
633    if [ "$AUTOLOAD_SMLNJ_LIB" = "TRUE" ]; then  # This is done with library sources in their original locations inside
634      CMD="$CMD CM.autoload'(\"$LIBDIR/smlnj-lib.cm\");"  # $SRCDIR, so we must consult $LOCALPATHCONFIG.
635    fi  #
636    if [ "$AUTOLOAD_SMLNJ_UNIX" = "TRUE" ]; then  
637      CMD="$CMD CM.autoload'(\"$LIBDIR/unix-lib.cm\");"  echo $this: Compiling library code.
638    fi  echo 'then OS.Process.success else OS.Process.failure));' >>$LIBLIST
639    if [ "$AUTOLOAD_SMLNJ_INET" = "TRUE" ]; then  if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then
640      CMD="$CMD CM.autoload'(\"$LIBDIR/inet-lib.cm\");"      echo $this: Libraries compiled successfully.
   fi  
   if [ "$AUTOLOAD_SMLNJ_HTML" = "TRUE" ]; then  
     CMD="$CMD CM.autoload'(\"$LIBDIR/html-lib.cm\");"  
   fi  
   if [ "AUTOLOAD_SMLNJ_PP" = "TRUE" ]; then  
     CMD="$CMD CM.autoload'(\"$LIBDIR/pp-lib.cm\");"  
   fi  
   if [ "AUTOLOAD_SMLNJ_REGEXP" = "TRUE" ]; then  
     CMD="$CMD CM.autoload'(\"$LIBDIR/regexp-lib.cm\");"  
   fi  
   if [ "$AUTOLOAD_SMLNJ_REACTIVE" = "TRUE" ]; then  
     CMD="$CMD CM.autoload'(\"$LIBDIR/reactive-lib.cm\");"  
   fi  
   cd $ROOT  
   $BINDIR/sml <<XXXX  
     $CMD  
     val _ = (SMLofNJ.exportML "sml";  
              print Compiler.banner;  
              print " [CM; autoload enabled]\n");  
 XXXX  
   if [ -r sml.$HEAP_SUFFIX ]; then  
     mv sml.$HEAP_SUFFIX $HEAPDIR  
641    else    else
642      echo "!!! unable to build SML with autoloading"      echo "$this: !!! Something went wrong when compiling the libraries."
643      exit 1      exit 1
644    fi    fi
645    
646    #
647    # Finally, move the libraries to their final locations...
648    #
649    
650    if [ -r $LIBMOVESCRIPT ] ; then
651        echo $this: Moving libraries to $LIBDIR.
652        . $LIBMOVESCRIPT
653  fi  fi
654    
655    exit 0

Legend:
Removed from v.411  
changed lines
  Added in v.615

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