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

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

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