Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /config/trunk/install.sh
ViewVC logotype

Diff of /config/trunk/install.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 573, Thu Mar 9 15:23:52 2000 UTC revision 578, Tue Mar 14 05:16:29 2000 UTC
# Line 9  Line 9 
9  # by M.Blume (2/2000).  # by M.Blume (2/2000).
10  #  #
11    
12    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 "!!! File config/targets is missing."      echo "$this: !!! File config/targets is missing."
19      exit 1      exit 1
20  fi  fi
21  . config/targets  . config/targets
# Line 22  Line 24 
24  # create the preloads.standard file  # create the preloads.standard file
25  #  #
26  if [ ! -r config/preloads ]; then  if [ ! -r config/preloads ]; then
27      echo "!!! File config/preloads is missing."      echo "$this: !!! File config/preloads is missing."
28      exit 1      exit 1
29  fi  fi
30  cp config/preloads preloads.standard  cp config/preloads preloads.standard
# Line 34  Line 36 
36  MAKE=make  MAKE=make
37    
38  SHELL=/bin/sh  SHELL=/bin/sh
39  echo Using shell $SHELL.  echo $this: Using shell $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 Installation directory is ${INSTALLDIR:=$ROOT}.  echo $this: Installation directory is ${INSTALLDIR:=$ROOT}.
48    
49  #  #
50  # set the various directory and file pathname variables  # set the various directory and file pathname variables
# Line 90  Line 92 
92  # the release version that we are installing  # the release version that we are installing
93  #  #
94  VERSION=`cat $CONFIGDIR/version`  VERSION=`cat $CONFIGDIR/version`
95  echo Installing version $VERSION.  echo $this: Installing version $VERSION.
96    
97  #  #
98  # the URL for the (usually remote) source archive  # the URL for the (usually remote) source archive
99  #  #
100  SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl`  SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl`
101  echo URL of source archive is $SRCARCHIVEURL.  echo $this: URL of source archive is $SRCARCHIVEURL.
102    
103  #  #
104  # Function to make a directory (and advertise such action).  # Function to make a directory (and advertise such action).
105  #  #
106  makedir() {  makedir() {
107      if [ ! -d $1 ] ; then      if [ ! -d $1 ] ; then
108          echo Making directory $1          echo $this: Making directory $1
109          if mkdir $1 ; then          if mkdir $1 ; then
110              : everything is fine              : everything is fine
111          else          else
112              echo "!!! Unable to make directory $1!"              echo "$this: !!! Unable to make directory $1!"
113              exit 1              exit 1
114          fi          fi
115      fi      fi
# Line 120  Line 122 
122  #   $3 - remote directory  #   $3 - remote directory
123  #  #
124  askurl() {  askurl() {
125      echo Please, fetch $1 archive '('$VERSION-$2.'*)' from      echo $this: Please, fetch $1 archive '('$VERSION-$2.'*)' from
126      echo '  ' $3      echo '  ' $3
127      echo "and then re-run this script!"      echo "and then re-run this script!"
128      exit 1      exit 1
# Line 135  Line 137 
137  #  #
138  fetchurl() {  fetchurl() {
139      getter=$1 ; shift      getter=$1 ; shift
140      echo Fetching $1 from $2. Please stand by...      echo $this: Fetching $1 from $3. Please stand by...
141      fetched=no      fetched=no
142      for ext in tgz tar.gz tar.Z tz tar tar.bz2 ; do      for ext in tgz tar.gz tar.Z tz tar tar.bz2 ; do
143          try=$VERSION-$2.$ext          try=$VERSION-$2.$ext
144          echo Trying $try ...          echo $this: Trying $try ...
145          if $getter $3 $try $ROOT/$try ; then          if $getter $3 $try $ROOT/$try ; then
146              fetched=yes              fetched=yes
147              echo Success.              echo $this: Fetching $try was a success.
148              break              break
149          else          else
150              rm -f $ROOT/$try              rm -f $ROOT/$try
151          fi          fi
152      done      done
153      if [ $fetched = no ] ; then      if [ $fetched = no ] ; then
154          echo No success.  You should try to do it manually now.          echo $this: Fetching $try was no success.
155            echo '  ' You should try to do it manually now.
156          askurl "$1" "$2" "$3"          askurl "$1" "$2" "$3"
157      fi      fi
158  }  }
# Line 193  Line 196 
196  #     be used)  #     be used)
197  #  #
198  # fetch_n_unpack is the helper function that does the real work.  If  # fetch_n_unpack is the helper function that does the real work.  If
199  # on archive is found locally, it invokes $URLGETTER and tries again.  # no archive is found locally, it invokes $URLGETTER and tries again.
200  # The variable $tryfetch is used to make sure this happens only once.  # The variable $tryfetch is used to make sure this happens only once.
201  fetch_n_unpack() {  fetch_n_unpack() {
202      larc=$ROOT/$VERSION-$4      larc=$ROOT/$VERSION-$4
203      cd $2      cd $2
204      if [ -r $larc.tar.Z ] ; then      if [ -r $larc.tar.Z ] ; then
205          echo "Un-compress-ing and un-tar-ing $1 archive."          echo "$this: Un-COMPRESS-ing and un-TAR-ing $1 archive."
206          zcat $larc.tar.Z | tar -xf -          zcat $larc.tar.Z | tar -xf -
207      elif [ -r $larc.tar ] ; then      elif [ -r $larc.tar ] ; then
208          echo "Un-tar-ing $1 archive."          echo "$this: Un-TAR-ing $1 archive."
209          tar -xf $larc.tar          tar -xf $larc.tar
210      elif [ -r $larc.tar.gz ] ; then      elif [ -r $larc.tar.gz ] ; then
211          echo "Un-gzip-ing and un-tar-ing $1 archive."          echo "$this: Un-GZIP-ing and un-TAR-ing $1 archive."
212          gunzip -c $larc.tar.gz | tar -xf -          gunzip -c $larc.tar.gz | tar -xf -
213      elif [ -r $larc.tar.bz2 ] ; then      elif [ -r $larc.tar.bz2 ] ; then
214          echo "Un-bzip2-ing and un-tar-ing $1 archive."          echo "$this: Un-BZIP2-ing and un-TAR-ing $1 archive."
215          bunzip2 -c $larc.tar.bz2 | tar -xf -          bunzip2 -c $larc.tar.bz2 | tar -xf -
216      elif [ -r $larc.tgz ] ; then      elif [ -r $larc.tgz ] ; then
217          echo "Un-gzip-ing and un-tar-ing $1 archive."          echo "$this: Un-GZIP-ing and un-TAR-ing $1 archive."
218          gunzip -c $larc.tgz | tar -xf -          gunzip -c $larc.tgz | tar -xf -
219      elif [ -r $larc.tz ] ; then      elif [ -r $larc.tz ] ; then
220          echo "Un-compress-ing and un-tar-ing $1 archive."          echo "$this: Un-COMPRESS-ing and un-TAR-ing $1 archive."
221          zcat $larc.tz | tar -xf -          zcat $larc.tz | tar -xf -
222      elif [ $tryfetch = yes ] ; then      elif [ $tryfetch = yes ] ; then
223          urlgetter          urlgetter
# Line 230  Line 233 
233  unpack() {  unpack() {
234      tryfetch=yes      tryfetch=yes
235      if [ -d $2/$3 ]; then      if [ -d $2/$3 ]; then
236          echo "The $1 tree already exists."          echo "$this: The $1 tree already exists."
237      else      else
238          fetch_n_unpack "$1" "$2" "$3" "$4"          fetch_n_unpack "$1" "$2" "$3" "$4"
239      fi      fi
240      if [ ! -d $2/$3 ]; then      if [ ! -d $2/$3 ]; then
241          echo "!!! Unable to unpack $1 archive."          echo "$this: !!! Unable to unpack $1 archive."
242          exit 1          exit 1
243      fi      fi
244  }  }
# Line 248  Line 251 
251      if [ -d $1 ] ; then      if [ -d $1 ] ; then
252          if [ ! -d $2 ] ; then          if [ ! -d $2 ] ; then
253              if [ -f $2 ] ; then              if [ -f $2 ] ; then
254                  echo install.sh: $2 exists as a non-directory.                  echo $this: $2 exists as a non-directory.
255                  exit 1                  exit 1
256              fi              fi
257              mkdir $2              mkdir $2
# Line 280  Line 283 
283          case $lib in          case $lib in
284          *.cm | *.cmi)          *.cm | *.cmi)
285              if [ $lib != $2 ] ; then              if [ $lib != $2 ] ; then
286                  echo "! Warning:" $lib specified relative to $2                  echo "$this: Warning:" $lib specified relative to $2
287              fi              fi
288              echo Moving library $lib to $LIBDIR              echo $this: Moving library $lib to $LIBDIR
289              makedir $LIBDIR/$2              makedir $LIBDIR/$2
290              makedir $LIBDIR/$2/CM              makedir $LIBDIR/$2/CM
291              makedir $LIBDIR/$2/CM/$ARCH-unix              makedir $LIBDIR/$2/CM/$ARCH-unix
# Line 312  Line 315 
315          FINALLOCATION=$SRCDIR/$2          FINALLOCATION=$SRCDIR/$2
316      fi      fi
317      if [ -d $FINALLOCATION/CM/$ARCH-unix ] ; then      if [ -d $FINALLOCATION/CM/$ARCH-unix ] ; then
318          echo "Library $1 already exists in $FINALLOCATION."          echo "$this: Library $1 already exists in $FINALLOCATION."
319      else      else
320          echo "Scheduling library $1 to be built in $FINALLOCATION."          echo "$this: Scheduling library $1 to be built in $FINALLOCATION."
321          echo "andalso CM.stabilize false \"$1\"" >>$LIBLIST          echo "andalso CM.stabilize false \"$1\"" >>$LIBLIST
322          echo $1 $SRCDIR/$2 >>$LOCALPATHCONFIG          echo $1 $SRCDIR/$2 >>$LOCALPATHCONFIG
323          if [ x$MOVE_LIBRARIES = xtrue ] ; then          if [ x$MOVE_LIBRARIES = xtrue ] ; then
# Line 341  Line 344 
344          TARGETLOC=$TARGET          TARGETLOC=$TARGET
345      fi      fi
346      if [ -r $HEAPDIR/$TARGET ] ; then      if [ -r $HEAPDIR/$TARGET ] ; then
347          echo Target $TARGET already exists.          echo $this: Target $TARGET already exists.
348      else      else
349          echo Building $TARGET.          echo $this: Building $TARGET.
350          unpack $2 $SRCDIR $1 $1          unpack $2 $SRCDIR $1 $1
351          cd $SRCDIR/$1          cd $SRCDIR/$1
352          ./build          ./build
# Line 354  Line 357 
357                  ln -s .run-sml $1                  ln -s .run-sml $1
358              fi              fi
359          else          else
360              echo "!!! Build of $TARGET failed."              echo "$this: !!! Build of $TARGET failed."
361          fi          fi
362      fi      fi
363  }  }
# Line 362  Line 365 
365  #  #
366  # create the various sub directories  # create the various sub directories
367  #  #
368  for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR  for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR ; do
 do  
369      makedir $dir      makedir $dir
370  done  done
371    
# Line 371  Line 373 
373  # 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
374  #  #
375  if [ -x $BINDIR/.arch-n-opsys ]; then  if [ -x $BINDIR/.arch-n-opsys ]; then
376      echo Script $BINDIR/.arch-n-opsys already exists.      echo $this: Script $BINDIR/.arch-n-opsys already exists.
377  else  else
378      cat $CONFIGDIR/_arch-n-opsys \      cat $CONFIGDIR/_arch-n-opsys \
379      | sed -e "s,@SHELL@,$SHELL,g" > $BINDIR/.arch-n-opsys      | sed -e "s,@SHELL@,$SHELL,g" > $BINDIR/.arch-n-opsys
380      chmod 555 $BINDIR/.arch-n-opsys      chmod 555 $BINDIR/.arch-n-opsys
381      if [ ! -x $BINDIR/.arch-n-opsys ]; then      if [ ! -x $BINDIR/.arch-n-opsys ]; then
382          echo "!!! Installation of $BINDIR/.arch-n-opsys failed."          echo "$this: !!! Installation of $BINDIR/.arch-n-opsys failed."
383          exit 1          exit 1
384      fi      fi
385  fi  fi
386    
387  ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`  ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`
388  if [ "$?" != "0" ]; then  if [ "$?" != "0" ]; then
389      echo "!!! Script $BINDIR/.arch-n-opsys fails on this machine."      echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine."
390      echo "!!! You must patch this by hand and repeat the installation."      echo "$this: !!! You must patch this by hand and repeat the installation."
391      exit 2      exit 2
392  else  else
393      echo Script $BINDIR/.arch-n-opsys reports $ARCH_N_OPSYS.      echo $this: Script $BINDIR/.arch-n-opsys reports $ARCH_N_OPSYS.
394  fi  fi
395  eval $ARCH_N_OPSYS  eval $ARCH_N_OPSYS
396    
# Line 404  Line 406 
406  # for an outdated driver script, but not all "test" commands understand  # for an outdated driver script, but not all "test" commands understand
407  # the -nt comparison operator....)  # the -nt comparison operator....)
408  #   if [ -x $BINDIR/$ddst ]; then  #   if [ -x $BINDIR/$ddst ]; then
409  #       echo Script $BINDIR/$ddst already exists.  #       echo $this: Script $BINDIR/$ddst already exists.
410  #   else  #   else
411          rm -f $BINDIR/$ddst          rm -f $BINDIR/$ddst
412          cat $CONFIGDIR/$dsrc | \          cat $CONFIGDIR/$dsrc | \
# Line 414  Line 416 
416              > $BINDIR/$ddst              > $BINDIR/$ddst
417          chmod 555 $BINDIR/$ddst          chmod 555 $BINDIR/$ddst
418          if [ ! -x $BINDIR/$ddst ]; then          if [ ! -x $BINDIR/$ddst ]; then
419              echo "!!! Installation of $BINDIR/${ddst} failed."              echo "$this: !!! Installation of $BINDIR/${ddst} failed."
420              exit 1              exit 1
421          fi          fi
422  #   fi  #   fi
# Line 432  Line 434 
434          ALLOC=1M          ALLOC=1M
435          ;;          ;;
436      x86)      x86)
437            # The following is the _wrong_ value for many popular x86 chips
438            # (i.e., Celerons).  However, the optimal value for those is 32k,
439            # and such a small value is not enough for the runtime system's boot
440            # code.  Therefore, we use 256k here and re-set it to the proper
441            # value in .run-sml.
442          ALLOC=256k          ALLOC=256k
443          ;;          ;;
444      alpha32)      alpha32)
# Line 449  Line 456 
456      linux)      linux)
457          EXTRA_DEFS=`$CONFIGDIR/chk-global-names.sh`          EXTRA_DEFS=`$CONFIGDIR/chk-global-names.sh`
458          if [ "$?" != "0" ]; then          if [ "$?" != "0" ]; then
459              echo "!!! Problems checking for underscores in global names."              echo "$this: !!! Problems checking for underscores in asm names."
460              exit 1              exit 1
461          fi          fi
462          EXTRA_DEFS="XDEFS=$EXTRA_DEFS"          EXTRA_DEFS="XDEFS=$EXTRA_DEFS"
# Line 466  Line 473 
473  #  #
474  unpack "run-time" $SRCDIR runtime runtime  unpack "run-time" $SRCDIR runtime runtime
475  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then
476      echo Run-time system already exists.      echo $this: Run-time system already exists.
477  else  else
478      cd $SRCDIR/runtime/objs      cd $SRCDIR/runtime/objs
479      echo Compiling the run-time system.      echo $this: Compiling the run-time system.
480      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS
481      if [ -x run.$ARCH-$OPSYS ]; then      if [ -x run.$ARCH-$OPSYS ]; then
482          mv run.$ARCH-$OPSYS $RUNDIR          mv run.$ARCH-$OPSYS $RUNDIR
483          # $MAKE MAKE=$MAKE clean          # $MAKE MAKE=$MAKE clean
484      else      else
485          echo "!!! Run-time system build failed for some reason."          echo "$this: !!! Run-time system build failed for some reason."
486          exit 1          exit 1
487      fi      fi
488  fi  fi
# Line 485  Line 492 
492  # boot the base SML system  # boot the base SML system
493  #  #
494  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then
495      echo Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.      echo $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.
496  else  else
497      unpack bin $ROOT $BOOT_FILES $BOOT_FILES      unpack bin $ROOT $BOOT_FILES $BOOT_FILES
498      cd $ROOT/$BOOT_FILES      cd $ROOT/$BOOT_FILES
# Line 512  Line 519 
519              rm -rf $BOOT_FILES              rm -rf $BOOT_FILES
520    
521          else          else
522              echo "!!! Boot code did not produce heap image (sml.$HEAP_SUFFIX)."              echo "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."
523              exit 1              exit 1
524          fi          fi
525      else      else
526          echo "!!! Boot code failed, no heap image built (sml.$HEAP_SUFFIX)."          echo "$this !!! Boot code failed, no heap image (sml.$HEAP_SUFFIX)."
527          exit 1          exit 1
528      fi      fi
529  fi  fi
# Line 532  Line 539 
539  # now build (or prepare to build) the individual targets  # now build (or prepare to build) the individual targets
540  #  #
541  cd $SRCDIR  cd $SRCDIR
542  echo Installing other targets.  echo $this: Installing other targets.
543  for i in $TARGETS ; do  for i in $TARGETS ; do
544      case $i in      case $i in
545        src-smlnj)        src-smlnj)
# Line 592  Line 599 
599          build $ROOT          build $ROOT
600          ;;          ;;
601        *)        *)
602          echo "!!! Unknown target $i."          echo "$this: !!! Unknown target $i."
603          ;;          ;;
604      esac      esac
605  done  done
# Line 603  Line 610 
610  # $SRCDIR, so we must consult $LOCALPATHCONFIG.  # $SRCDIR, so we must consult $LOCALPATHCONFIG.
611  #  #
612    
613  echo Compiling library code.  echo $this: Compiling library code.
614  echo 'then OS.Process.success else OS.Process.failure);' >>$LIBLIST  echo 'then OS.Process.success else OS.Process.failure);' >>$LIBLIST
615  if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then  if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then
616      echo Libraries compiled successfully.      echo $this: Libraries compiled successfully.
617  else  else
618      echo "!!! Something went wrong when compiling the libraries."      echo "$this: !!! Something went wrong when compiling the libraries."
619      exit 1      exit 1
620  fi  fi
621    
# Line 617  Line 624 
624  #  #
625    
626  if [ -r $LIBMOVESCRIPT ] ; then  if [ -r $LIBMOVESCRIPT ] ; then
627      echo Moving libraries to $LIBDIR.      echo $this: Moving libraries to $LIBDIR.
628      . $LIBMOVESCRIPT      . $LIBMOVESCRIPT
629  fi  fi
630    

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

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