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 /sml/trunk/config/install.sh
ViewVC logotype

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

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

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