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/releases/release-110.63/install.sh
ViewVC logotype

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

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

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