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

revision 569, Tue Mar 7 04:01:07 2000 UTC revision 1073, Fri Feb 15 22:07:38 2002 UTC
# Line 9  Line 9 
9  # by M.Blume (2/2000).  # by M.Blume (2/2000).
10  #  #
11    
12    if [ x${INSTALL_QUIETLY} = xtrue ] ; then
13        export CM_VERBOSE=false
14    fi
15    
16    vsay() {
17        if [ x${INSTALL_DEBUG} = xtrue ] ; then
18            echo "$@"
19        elif [ x${INSTALL_QUIETLY} = xtrue ] ; then
20            :
21        else
22            echo "$@"
23        fi
24    }
25    
26    dsay() {
27        if [ x${INSTALL_DEBUG} = xtrue ] ; then
28            echo "$@"
29        fi
30    }
31    
32    complain() {
33        echo "$@"
34        exit 1
35    }
36    
37    # The following variable holds the name of all possible targets.
38    # The names must occur in the order in which targets are to be built.
39    ALLTARGETS=\
40    "src-smlnj \
41     ml-yacc \
42     ml-lex \
43     ml-burg \
44     ml-nlffigen \
45     smlnj-lib \
46     cml \
47     cml-lib \
48     eXene \
49     ckit \
50     ml-nlffi-lib \
51     pgraph-util \
52     mlrisc-tools \
53     nowhere \
54     doc"
55    
56    this=$0
57    
58    # By default, move libraries to lib directory:
59    MOVE_LIBRARIES=true
60    
61    # function to be used in config/targets:
62    dont_move_libraries() { MOVE_LIBRARIES=false ; }
63    
64    # Initialize target list.
65    TARGETS=""
66    
67    # function to be used in config/targets:
68    request() { TARGETS="$TARGETS $1" ; }
69    
70  #  #
71  # get the target list  # get the target list
72  #  #
73  if [ ! -r config/targets ]; then  if [ -r config/targets.customized ] ; then
74      echo "!!! File config/targets is missing."      . config/targets.customized
75      exit 1  elif [ ! -r config/targets ]; then
76  fi      complain "$this: !!! File config/targets is missing."
77    else
78  . config/targets  . config/targets
79    fi
80    
81    #
82    # resolve dependencies
83    #
84    isnotin() {
85        tested_x=$1
86        shift
87        for set_y in "$@" ; do
88            if [ ${tested_x} = ${set_y} ] ; then
89                return 1
90            fi
91        done
92        return 0
93    }
94    
95    require() {
96        require_who=$1
97        shift
98        for required_x "$@" ; do
99            if isnotin ${required_x} ${TARGETS} ; then
100                echo "Including ${required_x} (needed by ${require_who})."
101                request ${required_x}
102                CHANGED=true
103            fi
104        done
105    }
106    
107    onepass() {
108        while read depline ; do
109            require $depline
110        done
111    }
112    
113    if [ -r config/dependencies ] ; then
114        CHANGED=true
115        while [ $CHANGED = true ]; do
116            CHANGED=false
117            onepass <config/dependencies
118        done
119    fi
120    
121    #
122    # Rebuild target list using the order defined by ALLTARGETS.
123    #
124    NEWTARGETS=""
125    for t in ${ALLTARGETS} ; do
126        if isnotin $t ${TARGETS} ; then
127            :
128        else
129            NEWTARGETS="$NEWTARGETS $t"
130        fi
131    done
132    TARGETS=$NEWTARGETS
133    
134  #  #
135  # create the preloads.standard file  # create the preloads.standard file
136  #  #
137  if [ ! -r config/preloads ]; then  if [ ! -r config/preloads ]; then
138      echo "!!! File config/preloads is missing."      complain "$this: !!! File config/preloads is missing."
     exit 1  
139  fi  fi
140  cp config/preloads preloads.standard  cp config/preloads preloads.standard
141    
# Line 33  Line 145 
145  #  #
146  MAKE=make  MAKE=make
147    
148    #
149    # Make sure we don't have any unpleasant surprises due to the installing
150    # user's process environment:
151    #
152    unset CM_PATHCONFIG
153    
154  SHELL=/bin/sh  SHELL=/bin/sh
155  echo Using shell $SHELL.  vsay $this: Using shell $SHELL.
156    
157  #  #
158  # set the SML root directory  # set the SML root directory
159  #  #
160  REAL_PWD=`pwd`  REAL_PWD=`pwd`
161  ROOT=${PWD:-$REAL_PWD}  ROOT=${PWD:-$REAL_PWD}
162  echo SML root is $ROOT.  vsay $this: SML root is $ROOT.
163  echo Installation directory is ${INSTALLDIR:=$ROOT}.  vsay $this: Installation directory is ${INSTALLDIR:=$ROOT}.
164    
165  #  #
166  # set the various directory and file pathname variables  # set the various directory and file pathname variables
# Line 54  Line 172 
172  SRCDIR=$ROOT/src                # where the source tree is rooted  SRCDIR=$ROOT/src                # where the source tree is rooted
173  LIBDIR=$INSTALLDIR/lib          # where libraries live  LIBDIR=$INSTALLDIR/lib          # where libraries live
174  LIBLIST=$ROOT/liblist           # list of commands to stabilize libraries  LIBLIST=$ROOT/liblist           # list of commands to stabilize libraries
175    LATESTANDALONES=$ROOT/latestandalones # standalone programs to be built late
176  LIBMOVESCRIPT=$ROOT/libmove     # a temporary script  LIBMOVESCRIPT=$ROOT/libmove     # a temporary script
177  LOCALPATHCONFIG=$INSTALLDIR/pathconfig # a temporary pathconfig file  LOCALPATHCONFIG=$INSTALLDIR/pathconfig # a temporary pathconfig file
178    
179  #  #
180  # the path to the dir where ml-yacc, ml-burg, ml-lex, and ml-build live  # The path to the dir where ml-yacc, ml-burg, ml-lex, ml-build, and
181    # ml-makedepend live.  This path will be interpreted relative to $LIBDIR.
182    #
183    TOOLDIR=../bin
184    
185    #
186    # A temporary file for post-editing the pathconfig file...
187  #  #
188  TOOLDIR=$BINDIR  PCEDITTMP=$INSTALLDIR/pcedittmp.$$
189    
190  #  #
191  # files to be deleted after we are done...  # files to be deleted after we are done...
# Line 68  Line 193 
193  tmpfiles=""  tmpfiles=""
194  tmpfiles="$tmpfiles $ROOT/preloads.standard"  tmpfiles="$tmpfiles $ROOT/preloads.standard"
195  tmpfiles="$tmpfiles $LIBLIST"  tmpfiles="$tmpfiles $LIBLIST"
196    tmpfiles="$tmpfiles $LATESTANDALONES"
197  tmpfiles="$tmpfiles $LOCALPATHCONFIG"  tmpfiles="$tmpfiles $LOCALPATHCONFIG"
198  tmpfiles="$tmpfiles $LIBMOVESCRIPT"  tmpfiles="$tmpfiles $LIBMOVESCRIPT"
199    tmpfiles="$tmpfiles $PCEDITTMP"
200  #  #
201  # make sure we always clean up after ourselves...  # make sure we always clean up after ourselves...
202  #  #
# Line 88  Line 215 
215  # the release version that we are installing  # the release version that we are installing
216  #  #
217  VERSION=`cat $CONFIGDIR/version`  VERSION=`cat $CONFIGDIR/version`
218  echo Installing version $VERSION.  vsay $this: Installing version $VERSION.
219    
220  #  #
221  # Function to make a directory (and advertise such action).  # the URL for the (usually remote) source archive
222    #
223    SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl`
224    vsay $this: URL of source archive is $SRCARCHIVEURL.
225    
226    #
227    # Function to make a directory including its ancestors.
228  #  #
229  makedir() {  makedir() {
230      if [ ! -d $1 ] ; then      if [ x$1 = x ] ; then
231          echo Making directory $1          :
232        elif [ -d $1 ] ; then
233            :
234        else
235            makedir `dirname $1`
236            if [ x${INSTALL_VERBOSE} = xtrue ] ; then
237                vsay "$this: Making directory $1"
238            fi
239          if mkdir $1 ; then          if mkdir $1 ; then
240              : everything is fine              :
241          else          else
242              echo "!!! Unable to make directory $1!"              complain "$this: !!! Unable to make directory $1!"
243            fi
244        fi
245    }
246    
247    #
248    # Function for asking user to fetch source archive.
249    #   $1 - descriptive name
250    #   $2 - base name without extension, without version, and without dir
251    #   $3 - remote directory
252    #
253    askurl() {
254        echo "$this: Please, fetch $1 archive"
255        echo ' ('$2.'*' or $VERSION-$2.'*)'
256        echo " from $3"
257        echo " and then re-run this script!"
258              exit 1              exit 1
259    }
260    
261    #
262    # Function for fetching source archives automatically using wget or lynx.
263    #   $1 - command to actually get the stuff
264    #   $2 - descriptive name
265    #   $3 - base name without extension and without dir
266    #   $4 - remote directory
267    #
268    fetchurl() {
269        getter=$1 ; shift
270        vsay $this: Fetching $1 from $3. Please stand by...
271        fetched=no
272        for base in $2 $VERSION-$2 ; do
273            for ext in tar.gz tgz tar.Z tz tar tar.bz2 ; do
274                try=$base.$ext
275                vsay $this: Trying $try ...
276                if $getter $3/$try $ROOT/$try ; then
277                    fetched=yes
278                    vsay $this: Fetching $try was a success.
279                    break 2         # get out of both for-loops
280                else
281                    rm -f $ROOT/$try
282          fi          fi
283            done
284        done
285        if [ $fetched = no ] ; then
286            echo $this: Fetching $try was no success.
287            echo '  ' You should try to do it manually now.
288            askurl "$1" "$2" "$3"
289        fi
290    }
291    
292    # wrapper for wget
293    usewget() {
294        wget -nv -O $2 $1
295    }
296    
297    # wrapper for lynx
298    uselynx() {
299        lynx -source $1 >$2
300    }
301    
302    # wrapper for curl
303    usecurl() {
304        curl -s $1 >$2
305    }
306    
307    testurlgetter() {
308        (exec >/dev/null 2>&1 ; exec $*)
309    }
310    
311    #
312    # Function to check whether wget or lynx is available.
313    # Set URLGETTER accordingly.  URLGETTER can be set externally
314    # to either 'wget' or 'curl' or 'lynx' -- in which case the
315    # corresponding command will be used (properly wrapped).  Any
316    # other external setting will be passed directly to fetchurl (without
317    # wrapping -- meaning it must take precisely two argumets: source and
318    # destination, in that order).
319    #
320    urlgetter() {
321        case ${URLGETTER:-unknown} in
322            fetchurl*)
323                ;;
324            unknown)
325                # automatically figure out which wrapper to use
326                if testurlgetter wget --help ; then
327                    URLGETTER="fetchurl usewget"
328                elif testurlgetter curl -s -O file:///dev/null -o /dev/null ; then
329                    URLGETTER="fetchurl usecurl"
330                elif testurlgetter lynx -help ; then
331                    URLGETTER="fetchurl uselynx"
332                else
333                    URLGETTER="askurl"
334                fi
335                ;;
336            wget|curl|lynx)
337                # special getters we know how to wrap
338                URLGETTER="fetchurl use${URLGETTER}"
339                ;;
340            *)
341                # other -- must be able to work without wrapper
342                URLGETTER="fetchurl ${URLGETTER}"
343                ;;
344        esac
345    }
346    
347    # wrapper for tar
348    un_tar() {
349        vsay "$this: Un-TAR-ing $1 archive."
350        tar -xf $2
351    }
352    
353    # wrapper for zcat followed by tar
354    un_tar_Z() {
355        vsay "$this: Un-COMPRESS-ing and un-TAR-ing $1 archive."
356        zcat $2 | tar -xf -
357    }
358    
359    # wrapper for gunzip followed by tar
360    un_tar_gz() {
361        vsay "$this: Un-GZIP-ing and un-TAR-ing $1 archive."
362        gunzip -c $2 | tar -xf -
363    }
364    
365    # wrapper for bunzip2 followed by tar
366    un_tar_bz2() {
367        vsay "$this: Un-BZIP2-ing and un-TAR-ing $1 archive."
368        bunzip2 -c $2 | tar -xf -
369    }
370    
371    # unarchive archive without and with version number attached
372    unarchive() {
373        # $1: descriptive string, $2: archive, $3: unpacker
374        if [ -r $ROOT/$2 ] ; then
375            $3 "$1" $ROOT/$2
376        elif [ -r $ROOT/$VERSION-$2 ]; then
377            $3 "$1" $ROOT/$VERSION-$2
378        else
379            return 1
380      fi      fi
381  }  }
382    
# Line 114  Line 389 
389  # $4: the basename of the source archive (the script will check several  # $4: the basename of the source archive (the script will check several
390  #     different suffixes to determine what kind of de-compression is to  #     different suffixes to determine what kind of de-compression is to
391  #     be used)  #     be used)
392    #
393    # fetch_n_unpack is the helper function that does the real work.  If
394    # no archive is found locally, it invokes $URLGETTER and tries again.
395    # The variable $tryfetch is used to make sure this happens only once.
396    fetch_n_unpack() {
397        cd $2
398        if unarchive "$1" $4.tar.gz un_tar_gz ||
399           unarchive "$1" $4.tgz un_tar_gz ||
400           unarchive "$1" $4.tar.Z un_tar_Z ||
401           unarchive "$1" $4.tar un_tar ||
402           unarchive "$1" $4.tar.bz2 un_tar_bz2 ||
403           unarchive "$1" $4.tz un_tar_Z
404        then
405            : we are done
406        elif [ $tryfetch = yes ] ; then
407            urlgetter
408            $URLGETTER "$1" $4 $SRCARCHIVEURL
409            tryfetch=no
410            fetch_n_unpack "$1" "$2" "$3" "$4"
411        fi
412    }
413    
414    #
415    # The main "unpack" driver function that invokes the above helper.
416    #
417  unpack() {  unpack() {
418        tryfetch=yes
419      if [ -d $2/$3 ]; then      if [ -d $2/$3 ]; then
420          echo "The $1 source tree already exists."          vsay "$this: The $1 tree already exists."
     else  
         echo "Unpacking $1 source archive."  
         cd $2  
         if [ -r $4.tar.Z ] ; then  
             zcat $4.tar.Z | tar -xf -  
         elif [ -r $4.tar ] ; then  
             tar -xf $4.tar  
         elif [ -r $4.tar.gz ] ; then  
             gunzip -c $4.tar.gz | tar -xf -  
         elif [ -r $4.tar.bz2 ] ; then  
             bunzip2 -c $4.tar.bz2 | tar -xf -  
         elif [ -r $4.tgz ] ; then  
             gunzip -c $4.tgz | tar -xf -  
         elif [ -r $4.tz ] ; then  
             zcat $4.tz | tar -xf -  
421          else          else
422              echo "!!! The $1 source archive is missing."          fetch_n_unpack "$1" "$2" "$3" "$4"
             exit 1  
423          fi          fi
424          if [ ! -d $2/$3 ]; then          if [ ! -d $2/$3 ]; then
425              echo "!!! Unable to unpack $1 source archive."          complain "$this: !!! Unable to unpack $1 archive."
             exit 1  
         fi  
426      fi      fi
427  }  }
428    
429  #  # A function to move all stable library files to a parallel directory
430  # Move the stable archive of a library whose description file was $1/$2 to  # hierarchy.
431  # $LIBDIR/$2/CM/$ARCH-unix/$2 so that it appears as if the description file  # The first argument must be a simple path (no / inside), and
432  # had been at $LIBDIR/$2/$2  # the second argument must be an absolute path.
433  #  move() {
434  # (This script will also move all other libraries that show up in      if [ -d $1 ] ; then
435  #  $1/CM/$ARCH-unix because in the case of the boot directory this indicates          if [ ! -d $2 ] ; then
436  #  that some library did not have its own path anchor but was specified              if [ -f $2 ] ; then
437  #  relative to $1/$2. Still, don't rely on this to be robust -- rather make                  complain $this: $2 exists as a non-directory.
438  #  separate anchors for every library!)              fi
439  #              mkdir $2
440  movelibs() {          fi
441      for lib in `/bin/ls $1/CM/$ARCH-unix` ; do          cd $1
442          case $lib in          for i in * ; do
443          *.cm | *.cmi)              move $i $2/$i
             if [ $lib != $2 ] ; then  
                 echo "! Warning:" $lib specified relative to $2  
             fi  
             echo Moving library $lib to $LIBDIR  
             makedir $LIBDIR/$2  
             makedir $LIBDIR/$2/CM  
             makedir $LIBDIR/$2/CM/$ARCH-unix  
             mv $1/CM/$ARCH-unix/$lib $LIBDIR/$2/CM/$ARCH-unix/$lib  
             ;;  
         *)  
             ;;  
         esac  
444       done       done
445            cd ..
446        elif [ -f $1 ] ; then
447            rm -f $2
448            mv $1 $2
449        fi
450    }
451    
452    # move stable library file from $1 to $2
453    movelib()
454    {
455        SOURCE=$1
456        TARGET=$2
457        TARGETDIR=`dirname ${TARGET}`
458        if [ ! -d ${TARGETDIR} ] ; then
459            makedir ${TARGETDIR}
460        fi
461        mv ${SOURCE} ${TARGET}
462  }  }
463    
464  # A shell function that registers a library for being built.  # A shell function that registers a library for being built.
465  # This function takes two arguments: 1. a name under which the library  # This function takes 3 arguments:
466  # is to be known later (something.cm) and 2. the path relative to $SRCDIR  #   $1 = controlling anchor
467  # that leads to the library's .cm file.  The library's .cm file must be the  #   $2 = name relative to controlling anchor
468  # same as $1.  #   $3 = dir (relative to ${SRCDIR}) corresponding to $1
469  #  #
470  # This works by adding ML code to file $LIBLIST.  The code in this file  # This works by adding ML code to file $LIBLIST.  The code in this file
471  # will be executed near the end of this script.  If $MOVE_LIBRARIES is  # will be executed near the end of this script.  If $MOVE_LIBRARIES is
472  # set to true, then reglib will also register a "movelibs" to be executed at  # set to true, then reglib will also register a "movelib" to be executed at
473  # the end by putting a "movelibs" line into $LIBMOVESCRIPT.  # the end by putting a "movelib" line into $LIBMOVESCRIPT.
   
474  reglib() {  reglib() {
475        ANCHOR=$1
476        RELNAME=$2
477        LIBNAME='$'${ANCHOR}/${RELNAME}
478        ADIR=${SRCDIR}/$3
479        RELDIR=`dirname $RELNAME`
480        RELBASE=`basename $RELNAME`
481        if [ x$RELDIR = x. ] ; then
482            RELDIR=
483        else
484            RELDIR=/$RELDIR
485        fi
486        RELLOC=${RELDIR}/CM/${ARCH}-unix/${RELBASE}
487        SRCFINALLOC=${ADIR}${RELLOC}
488      if [ x$MOVE_LIBRARIES = xtrue ] ; then      if [ x$MOVE_LIBRARIES = xtrue ] ; then
489          FINALLOCATION=$LIBDIR/$1          FINALLOC=${LIBDIR}/${ANCHOR}${RELLOC}
490            FINALCONFIGPATH=${ANCHOR}
491      else      else
492          FINALLOCATION=$SRCDIR/$2          FINALLOC=${SRCFINALLOC}
493            FINALCONFIGPATH=${ADIR}
494      fi      fi
495      if [ -d $FINALLOCATION/CM/$ARCH-unix ] ; then  
496          echo "Library $1 already exists in $FINALLOCATION."      if [ -f ${FINALLOC} ] ; then
497            vsay "$this: Library ${LIBNAME} already exists in ${FINALLOC}"
498      else      else
499          echo "Scheduling library $1 to be built in $FINALLOCATION."          vsay "$this: Scheduling library ${LIBNAME} to be built as ${FINALLOC}."
500          echo "andalso CM.stabilize false \"$1\"" >>$LIBLIST          echo "  andalso CM.stabilize false \"${LIBNAME}\"" >>${LIBLIST}
501          echo $1 $SRCDIR/$2 >>$LOCALPATHCONFIG          echo ${ANCHOR} ${ADIR} >>${LOCALPATHCONFIG}
502          if [ x$MOVE_LIBRARIES = xtrue ] ; then          if [ x$MOVE_LIBRARIES = xtrue ] ; then
503              echo movelibs $SRCDIR/$2 $1 >>$LIBMOVESCRIPT              echo movelib ${SRCFINALLOC} ${FINALLOC} >>${LIBMOVESCRIPT}
504          fi          fi
         echo $1 $FINALLOCATION >>$CM_PATHCONFIG_DEFAULT  
505      fi      fi
506        echo ${ANCHOR} ${FINALCONFIGPATH} >>${CM_PATHCONFIG_DEFAULT}
507  }  }
508    
509  #  #
510  # Function to build a standalone program such as ml-yacc.  The function takes  # Function to build a standalone program such as ml-yacc.  The function takes
511  # 2 or 3 arguments.  First the name of the program which at the same time  # 2 or 3 or 4 arguments.  First the name of the program which at the same time
512  # is the directory name under $SRCDIR where the sources reside.  The second  # is the directory name under $SRCDIR/$4 where the sources reside.  The second
513  # argument is a descriptive name for the program (passed on to "unpack").  # argument is a descriptive name for the program (passed on to "unpack").
514  # The optional third argument specifies the path relative to $SRCDIR/$1  # The optional third argument specifies the path relative to $SRCDIR/$4/$1
515  # of the directory where the program's heap image is to be found.  # of the directory where the program's heap image is to be found.
516    # The fourth argument, if missing, defaults to "."
517  #  #
518    
519  standalone() {  standalone() {
# Line 219  Line 523 
523      else      else
524          TARGETLOC=$TARGET          TARGETLOC=$TARGET
525      fi      fi
526        if [ $# = 4 ] ; then
527             MYSRCDIR=$SRCDIR/$4
528        else
529             MYSRCDIR=$SRCDIR
530        fi
531      if [ -r $HEAPDIR/$TARGET ] ; then      if [ -r $HEAPDIR/$TARGET ] ; then
532          echo Target $TARGET already exists.          vsay $this: Target $TARGET already exists.
533      else      else
534          echo Building $TARGET.          echo $this: Building $TARGET.
535          unpack $2 $SRCDIR $1 $ROOT/$VERSION-$1          unpack $2 $MYSRCDIR $1 $1
536          cd $SRCDIR/$1          cd $MYSRCDIR/$1
537          ./build          # build it, but make sure we don't pick up some (unrelated)
538            # local path configuration...
539            CM_LOCAL_PATHCONFIG=/dev/null ./build
540          if [ -r $TARGETLOC ] ; then          if [ -r $TARGETLOC ] ; then
541              mv $TARGETLOC $HEAPDIR/$TARGET              mv $TARGETLOC $HEAPDIR/$TARGET
542              if [ ! -f $BINDIR/$1 ] ; then              if [ ! -f $BINDIR/$1 ] ; then
# Line 233  Line 544 
544                  ln -s .run-sml $1                  ln -s .run-sml $1
545              fi              fi
546          else          else
547              echo "!!! Build of $TARGET failed."              echo "$this: !!! Build of $TARGET failed."
548          fi          fi
549      fi      fi
550  }  }
551    
552    ######################################################################
553    
554  #  #
555  # create the various sub directories  # create the various sub directories
556  #  #
557  for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR  for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR ; do
 do  
558      makedir $dir      makedir $dir
559  done  done
560    
# Line 250  Line 562 
562  # 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
563  #  #
564  if [ -x $BINDIR/.arch-n-opsys ]; then  if [ -x $BINDIR/.arch-n-opsys ]; then
565      echo Script $BINDIR/.arch-n-opsys already exists.      vsay $this: Script $BINDIR/.arch-n-opsys already exists.
566  else  else
567      cat $CONFIGDIR/_arch-n-opsys \      cat $CONFIGDIR/_arch-n-opsys \
568      | sed -e "s,@SHELL@,$SHELL,g" > $BINDIR/.arch-n-opsys      | sed -e "s,@SHELL@,$SHELL,g" > $BINDIR/.arch-n-opsys
569      chmod 555 $BINDIR/.arch-n-opsys      chmod 555 $BINDIR/.arch-n-opsys
570      if [ ! -x $BINDIR/.arch-n-opsys ]; then      if [ ! -x $BINDIR/.arch-n-opsys ]; then
571          echo "!!! Installation of $BINDIR/.arch-n-opsys failed."          complain "$this: !!! Installation of $BINDIR/.arch-n-opsys failed."
         exit 1  
572      fi      fi
573  fi  fi
574    
575  ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`  ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`
576  if [ "$?" != "0" ]; then  if [ "$?" != "0" ]; then
577      echo "!!! Script $BINDIR/.arch-n-opsys fails on this machine."      echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine."
578      echo "!!! You must patch this by hand and repeat the installation."      echo "$this: !!! You must patch this by hand and repeat the installation."
579      exit 2      exit 2
580  else  else
581      echo Script $BINDIR/.arch-n-opsys reports $ARCH_N_OPSYS.      vsay $this: Script $BINDIR/.arch-n-opsys reports $ARCH_N_OPSYS.
582  fi  fi
583  eval $ARCH_N_OPSYS  eval $ARCH_N_OPSYS
584    
# Line 283  Line 594 
594  # for an outdated driver script, but not all "test" commands understand  # for an outdated driver script, but not all "test" commands understand
595  # the -nt comparison operator....)  # the -nt comparison operator....)
596  #   if [ -x $BINDIR/$ddst ]; then  #   if [ -x $BINDIR/$ddst ]; then
597  #       echo Script $BINDIR/$ddst already exists.  #       echo $this: Script $BINDIR/$ddst already exists.
598  #   else  #   else
599          rm -f $BINDIR/$ddst          rm -f $BINDIR/$ddst
600          cat $CONFIGDIR/$dsrc | \          cat $CONFIGDIR/$dsrc | \
# Line 293  Line 604 
604              > $BINDIR/$ddst              > $BINDIR/$ddst
605          chmod 555 $BINDIR/$ddst          chmod 555 $BINDIR/$ddst
606          if [ ! -x $BINDIR/$ddst ]; then          if [ ! -x $BINDIR/$ddst ]; then
607              echo "!!! Installation of $BINDIR/${ddst} failed."              complain "$this: !!! Installation of $BINDIR/${ddst} failed."
             exit 1  
608          fi          fi
609  #   fi  #   fi
610  }  }
# Line 302  Line 612 
612  installdriver _run-sml .run-sml  installdriver _run-sml .run-sml
613  installdriver _link-sml .link-sml  installdriver _link-sml .link-sml
614  installdriver _ml-build ml-build  installdriver _ml-build ml-build
615    installdriver _ml-makedepend ml-makedepend
616    
617  #  #
618  # set some architecture dependent run-time system flags  # set some architecture dependent run-time system flags
# Line 311  Line 622 
622          ALLOC=1M          ALLOC=1M
623          ;;          ;;
624      x86)      x86)
625            # The following is the _wrong_ value for many popular x86 chips
626            # (i.e., Celerons).  However, the optimal value for those is 32k,
627            # and such a small value is not enough for the runtime system's boot
628            # code.  Therefore, we use 256k here and re-set it to the proper
629            # value in .run-sml.
630          ALLOC=256k          ALLOC=256k
631          ;;          ;;
632      alpha32)      alpha32)
# Line 328  Line 644 
644      linux)      linux)
645          EXTRA_DEFS=`$CONFIGDIR/chk-global-names.sh`          EXTRA_DEFS=`$CONFIGDIR/chk-global-names.sh`
646          if [ "$?" != "0" ]; then          if [ "$?" != "0" ]; then
647              echo "!!! Problems checking for underscores in global names."              complain "$this: !!! Problems checking for underscores in asm names."
             exit 1  
648          fi          fi
649          EXTRA_DEFS="XDEFS=$EXTRA_DEFS"          EXTRA_DEFS="XDEFS=$EXTRA_DEFS"
650          ;;          ;;
# Line 338  Line 653 
653  #  #
654  # the name of the bin files directory  # the name of the bin files directory
655  #  #
656  BOOT_FILES=sml.boot.$ARCH-unix  BOOT_ARCHIVE=boot.$ARCH-unix
657    BOOT_FILES=sml.$BOOT_ARCHIVE
658    
659  #  #
660  # build the run-time system  # build the run-time system
661  #  #
662  unpack "run-time" $SRCDIR runtime $ROOT/$VERSION-runtime  unpack "run-time" $SRCDIR runtime runtime
663  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then
664      echo Run-time system already exists.      vsay $this: Run-time system already exists.
665  else  else
666      cd $SRCDIR/runtime/objs      cd $SRCDIR/runtime/objs
667      echo Compiling the run-time system.      echo $this: Compiling the run-time system.
668      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS
669      if [ -x run.$ARCH-$OPSYS ]; then      if [ -x run.$ARCH-$OPSYS ]; then
670          mv run.$ARCH-$OPSYS $RUNDIR          mv run.$ARCH-$OPSYS $RUNDIR
671          # $MAKE MAKE=$MAKE clean          $MAKE MAKE=$MAKE clean
672      else      else
673          echo "!!! Run-time system build failed for some reason."          complain "$this: !!! Run-time system build failed for some reason."
         exit 1  
674      fi      fi
675  fi  fi
676  cd $SRCDIR  cd $SRCDIR
# Line 364  Line 679 
679  # boot the base SML system  # boot the base SML system
680  #  #
681  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then
682      echo Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.      vsay $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.
683  else  else
684      unpack bin $ROOT $BOOT_FILES $ROOT/$VERSION-$BOOT_FILES      unpack bin $ROOT $BOOT_FILES $BOOT_ARCHIVE
685      cd $ROOT/$BOOT_FILES      cd $ROOT/$BOOT_FILES
686      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC
687      then      then
# Line 380  Line 695 
695              # the pathconfig file.              # the pathconfig file.
696              #              #
697              cd $ROOT/$BOOT_FILES              cd $ROOT/$BOOT_FILES
698              for lib in *.cm ; do              for anchor in * ; do
699                  echo $lib $LIBDIR/$lib >>$CM_PATHCONFIG_DEFAULT                  if [ -d $anchor ] ; then
700                  movelibs $ROOT/$BOOT_FILES/$lib $lib                      echo $anchor $anchor >>$CM_PATHCONFIG_DEFAULT
701                        move $anchor $LIBDIR/$anchor
702                    fi
703              done              done
704              cd $ROOT              cd $ROOT
705              # rm -rf $BOOT_FILES              # $BOOT_FILES is now only an empty skeleton, let's get rid of it.
706                rm -rf $BOOT_FILES
707    
708          else          else
709              echo "!!! Boot code did not produce heap image (sml.$HEAP_SUFFIX)."              complain "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."
             exit 1  
710          fi          fi
711      else      else
712          echo "!!! Boot code failed, no heap image built (sml.$HEAP_SUFFIX)."          complain "$this !!! Boot code failed, no heap image (sml.$HEAP_SUFFIX)."
         exit 1  
713      fi      fi
714  fi  fi
715    
# Line 402  Line 718 
718  #  #
719  cd $ROOT  cd $ROOT
720  rm -f $LOCALPATHCONFIG $LIBLIST  rm -f $LOCALPATHCONFIG $LIBLIST
721  echo 'OS.Process.exit (if true' >$LIBLIST  echo 'ignore (OS.Process.exit (if true' >$LIBLIST
722    
723  #  #
724  # now build (or prepare to build) the individual targets  # now build (or prepare to build) the individual targets
725  #  #
726  cd $SRCDIR  cd $SRCDIR
727  echo Installing other targets.  vsay $this: Installing other targets.
728  for i in $TARGETS ; do  for i in $TARGETS ; do
729      case $i in      case $i in
730        src-smlnj)        src-smlnj)
731          for src in compiler cm MLRISC smlnj-lib ml-yacc system          for src in compiler cm MLRISC smlnj-lib ml-yacc system
732          do          do
733              unpack $src $ROOT/src $src $ROOT/$VERSION-$src              unpack $src $ROOT/src $src $src
734          done          done
735          ;;          ;;
736        ml-yacc)        ml-yacc)
# Line 429  Line 745 
745          standalone ml-burg ML-Burg          standalone ml-burg ML-Burg
746          echo ml-burg $TOOLDIR >>$CM_PATHCONFIG_DEFAULT          echo ml-burg $TOOLDIR >>$CM_PATHCONFIG_DEFAULT
747          ;;          ;;
748          ml-nlffigen)
749            echo standalone ml-nlffigen ML-NLFFI-Gen >>$LATESTANDALONES
750            echo ml-nlffigen $TOOLDIR >>$CM_PATHCONFIG_DEFAULT
751            ;;
752        smlnj-lib)        smlnj-lib)
753          unpack "SML/NJ Library" $SRCDIR smlnj-lib $ROOT/$VERSION-smlnj-lib          unpack "SML/NJ Library" $SRCDIR smlnj-lib smlnj-lib
754    
755          # Don't make the Util library -- it came pre-made and has been          # Don't make the Util library -- it came pre-made and has been
756          # installed when making the base system.  In other words, don't do...          # installed when making the base system.  In other words, don't do...
757              #reglib smlnj-lib.cm smlnj-lib/Util              #reglib smlnj-lib.cm smlnj-lib.cm smlnj-lib/Util
758          # ... and don't make the HTML library ...          # ... and don't make the HTML library ...
759              #reglib html-lib.cm smlnj-lib/HTML              #reglib html-lib.cm html-lib.cm smlnj-lib/HTML
760          # ... and don't make the PP library ...          # ... and don't make the PP library ...
761              #reglib pp-lib.cm smlnj-lib/PP              #reglib pp-lib.cm pp-lib.cm smlnj-lib/PP
762          # make the Unix library          # make the Unix library
763              reglib unix-lib.cm smlnj-lib/Unix              reglib unix-lib.cm unix-lib.cm smlnj-lib/Unix
764          # make the INet library          # make the INet library
765              reglib inet-lib.cm smlnj-lib/INet              reglib inet-lib.cm inet-lib.cm smlnj-lib/INet
766          # make the RegExp library          # make the RegExp library
767              reglib regexp-lib.cm smlnj-lib/RegExp              reglib regexp-lib.cm regexp-lib.cm smlnj-lib/RegExp
768          # make the Reactive library          # make the Reactive library
769              reglib reactive-lib.cm smlnj-lib/Reactive              reglib reactive-lib.cm reactive-lib.cm smlnj-lib/Reactive
770            # make the HashCons library
771                reglib hash-cons-lib.cm hash-cons-lib.cm smlnj-lib/HashCons
772          ;;          ;;
773        cml)        cml)
774          unpack CML $SRCDIR cml $ROOT/$VERSION-cml          unpack CML $SRCDIR cml cml
775          reglib core-cml.cm cml/src/core-cml          reglib cml core-cml.cm cml/src
776          reglib cml.cm cml/src          reglib cml cml-internal.cm cml/src
777          reglib cml-basis.cm cml          reglib cml cml.cm cml/src
778            reglib cml basis.cm cml/src
779          ;;          ;;
780        cml-lib)        cml-lib)
781          unpack CML $SRCDIR cml $ROOT/$VERSION-cml          unpack CML $SRCDIR cml cml
782          reglib cml-lib.cm cml/cml-lib          reglib cml-lib trace-cml.cm cml/cml-lib/cm
783            reglib cml-lib smlnj-lib.cm cml/cml-lib/cm
784          ;;          ;;
785        eXene)        eXene)
786          unpack EXene $SRCDIR eXene $ROOT/$VERSION-eXene          unpack EXene $SRCDIR eXene eXene
787          reglib eXene.cm eXene          reglib eXene.cm eXene.cm eXene
788            ;;
789          ckit)
790            unpack "C-Kit" $ROOT ckit ckit
791            reglib ckit-lib.cm ckit-lib.cm ../ckit/src
792            ;;
793          ml-nlffi-lib)
794            unpack "NLFFI Library" $SRCDIR ml-nlffi-lib ml-nlffi-lib
795            reglib memory.cm memory.cm ml-nlffi-lib/memory
796            reglib c-int.cm c-int.cm ml-nlffi-lib/internals
797            reglib c.cm c.cm ml-nlffi-lib
798            ;;
799          pgraph-util)
800            unpack "CM source code" $SRCDIR cm cm
801            reglib pgraph-util.cm pgraph-util.cm cm/pgraph
802            ;;
803          mlrisc-tools)
804            unpack "MLRISC Tools Library" $SRCDIR MLRISC MLRISC
805            reglib mlrisc-tools pp.cm MLRISC/Tools
806            reglib mlrisc-tools source-map.cm MLRISC/Tools
807            reglib mlrisc-tools sml-ast.cm MLRISC/Tools
808            reglib mlrisc-tools prec-parser.cm MLRISC/Tools
809            reglib mlrisc-tools parser.cm MLRISC/Tools
810            reglib mlrisc-tools match-compiler.cm MLRISC/Tools
811            ;;
812          nowhere)
813            unpack "MLRISC Tools Library" $SRCDIR MLRISC MLRISC
814            echo standalone nowhere NoWhere . MLRISC/Tools >>$LATESTANDALONES
815            echo nowhere $TOOLDIR >>$CM_PATHCONFIG_DEFAULT
816          ;;          ;;
817        doc)        doc)
818          unpack Doc $ROOT doc $ROOT/$VERSION-doc          echo Package doc is currently unavailable.
819          cd $ROOT/doc          # unpack Doc $ROOT doc doc
820          build $ROOT          # cd $ROOT/doc
821            # build $ROOT
822          ;;          ;;
823        *)        *)
824          echo "!!! Unknown target $i."          echo "$this: !!! Unknown target $i."
825          ;;          ;;
826      esac      esac
827  done  done
# Line 479  Line 832 
832  # $SRCDIR, so we must consult $LOCALPATHCONFIG.  # $SRCDIR, so we must consult $LOCALPATHCONFIG.
833  #  #
834    
835  echo Compiling library code.  echo $this: Compiling library code.
836  echo 'then OS.Process.success else OS.Process.failure);' >>$LIBLIST  echo 'then OS.Process.success else OS.Process.failure));' >>$LIBLIST
837  if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then  if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then
838      echo Libraries compiled successfully.      vsay $this: Libraries compiled successfully.
839  else  else
840      echo "!!! Something went wrong when compiling the libraries."      complain "$this: !!! Something went wrong when compiling the libraries."
     exit 1  
841  fi  fi
842    
843  #  #
844  # Finally, move the libraries to their final locations...  # Move the libraries to their final locations...
845  #  #
846    
847  if [ -r $LIBMOVESCRIPT ] ; then  if [ -r $LIBMOVESCRIPT ] ; then
848      echo Moving libraries to $LIBDIR.      vsay $this: Moving libraries to $LIBDIR.
849      . $LIBMOVESCRIPT      . $LIBMOVESCRIPT
850  fi  fi
851    
852    #
853    # Build "late" standalone programs (i.e., those that must be built
854    # after libraries are already in place):
855    #
856    
857    if [ -r $LATESTANDALONES ] ; then
858        vsay $this: Building late standalone programs.
859        . $LATESTANDALONES
860    fi
861    
862    #
863    # Finally, remove duplicate entries from pathconfig file...
864    #
865    if [ -f $CM_PATHCONFIG_DEFAULT ] ; then
866        cp $CM_PATHCONFIG_DEFAULT $PCEDITTMP
867        rm -f $CM_PATHCONFIG_DEFAULT
868        awk <$PCEDITTMP 'NF == 2 { mapping[$1] = $2 }
869    NF != 2 { print $0 }
870    END { for (i in mapping) print i, mapping[i] }' \
871          | sort >$CM_PATHCONFIG_DEFAULT
872    fi
873    
874  exit 0  exit 0

Legend:
Removed from v.569  
changed lines
  Added in v.1073

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