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

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

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