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/trunk/config/install.sh revision 1409, Mon Nov 3 22:00:35 2003 UTC config/trunk/install.sh revision 2150, Thu Nov 2 17:52:56 2006 UTC
# Line 12  Line 12 
12  # Author: Matthias Blume (blume@tti-c.org)  # Author: Matthias Blume (blume@tti-c.org)
13  #  #
14    
15    if [ x$1 = xnolib ] ; then
16        nolib=true
17    else
18        nolib=false
19    fi
20    
21  if [ x${INSTALL_QUIETLY} = xtrue ] ; then  if [ x${INSTALL_QUIETLY} = xtrue ] ; then
22      export CM_VERBOSE=false      export CM_VERBOSE
23        CM_VERBOSE=false
24  fi  fi
25    
26  vsay() {  vsay() {
# Line 58  Line 65 
65  ROOT=${PWD:-$REAL_PWD}  ROOT=${PWD:-$REAL_PWD}
66  vsay $this: SML root is $ROOT.  vsay $this: SML root is $ROOT.
67    
68  cd ${INSTALLDIR:=$ROOT}  cd "${INSTALLDIR:=$ROOT}"
69  INSTALLDIR=`pwd`  INSTALLDIR=`pwd`
70  cd $ROOT  cd "$ROOT"
71  vsay $this: Installation directory is ${INSTALLDIR}.  vsay $this: Installation directory is ${INSTALLDIR}.
72    
73  #  #
# Line 70  Line 77 
77  CONFIGDIR=$ROOT/config  CONFIGDIR=$ROOT/config
78  HEAPDIR=$BINDIR/.heap           # where heap images live  HEAPDIR=$BINDIR/.heap           # where heap images live
79  RUNDIR=$BINDIR/.run             # where executables (i.e., the RTS) live  RUNDIR=$BINDIR/.run             # where executables (i.e., the RTS) live
80  SRCDIR=$ROOT/src                # where the source tree is rooted  SRCDIR=$ROOT/base/src           # where the source tree is rooted
81  LIBDIR=$INSTALLDIR/lib          # where libraries live  LIBDIR=$INSTALLDIR/lib          # where libraries live
82    
83  #  #
84  # files to be deleted after we are done...  # files to be deleted after we are done...
85  #  #
86  tmpfiles=""  tmpfiles=""
87  tmpfiles="$tmpfiles $ROOT/preloads.standard"  tmpfiles="$tmpfiles preloads.standard"
88  #  #
89  # make sure we always clean up after ourselves...  # make sure we always clean up after ourselves...
90  #  #
91  trap 'rm -f $tmpfiles' 0 1 2 3 15  trap 'cd "$ROOT"; rm -f $tmpfiles' 0 1 2 3 15
92    
93    
94  #  #
# Line 89  Line 96 
96  # that will be queried by the bootstrap code)  # that will be queried by the bootstrap code)
97  # Especially important is CM_PATHCONFIG.  # Especially important is CM_PATHCONFIG.
98  #  #
 CM_PATHCONFIG=$LIBDIR/pathconfig  
99  export CM_PATHCONFIG  export CM_PATHCONFIG
100    CM_PATHCONFIG=$LIBDIR/pathconfig
101  #  #
102  # the release version that we are installing  # the release version that we are installing
103  #  #
104  VERSION=`cat $CONFIGDIR/version`  VERSION=`cat "$CONFIGDIR/version"`
105  vsay $this: Installing version $VERSION.  vsay $this: Installing version $VERSION.
106    
107  #  #
108  # the URL for the (usually remote) source archive  # the URL for the (usually remote) source archive
109  #  #
110  SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl`  . "$CONFIGDIR"/srcarchiveurl
111  vsay $this: URL of source archive is $SRCARCHIVEURL.  vsay $this: URL of source archive is $SRCARCHIVEURL.
112    
113  #  #
114  # Function to make a directory including its ancestors.  # Function to make a directory including its ancestors.
115  #  #
116  makedir() {  makedir() {
117      if [ x$1 = x ] ; then      if [ x"$1" = x ] ; then
118          :          :
119      elif [ -d $1 ] ; then      elif [ -d "$1" ] ; then
120          :          :
121      else      else
122          makedir `dirname $1`          makedirtmp=`dirname "$1"`
123            makedir "$makedirtmp"
124          if [ x${INSTALL_VERBOSE} = xtrue ] ; then          if [ x${INSTALL_VERBOSE} = xtrue ] ; then
125              vsay "$this: Making directory $1"              vsay "$this: Making directory $1"
126          fi          fi
127          if mkdir $1 ; then          if mkdir "$1" ; then
128              :              :
129          else          else
130              complain "$this: !!! Unable to make directory $1!"              complain "$this: !!! Unable to make directory $1!"
# Line 132  Line 139 
139  # a single subdirectory which is a CM metadata directory:  # a single subdirectory which is a CM metadata directory:
140  #  #
141  fish() {  fish() {
142      cd $1      cd "$1"
143      ORIG_CM_DIR_ARC=unknown      ORIG_CM_DIR_ARC=unknown
144      for i in * .[a-zA-Z0-9]* ; do      for i in * .[a-zA-Z0-9]* ; do
145          if [ -d $i ] ; then          if [ -d $i ] ; then
# Line 153  Line 160 
160  # The first argument must be a simple path (no / inside), and  # The first argument must be a simple path (no / inside), and
161  # the second argument must be an absolute path.  # the second argument must be an absolute path.
162  move() {  move() {
163      if [ -L $1 ] ; then      if [ -L "$1" ] ; then
164          rm -f $1             # remove symbolic link made by diracs (see below)          rm -f "$1"           # remove symbolic link made by diracs (see below)
165      elif [ -d $1 ] ; then      elif [ -d "$1" ] ; then
166          if [ ! -d $2 ] ; then          if [ ! -d "$2" ] ; then
167              if [ -f $2 ] ; then              if [ -f "$2" ] ; then
168                  complain $this: $2 exists as a non-directory.                  complain $this: $2 exists as a non-directory.
169              fi              fi
170              mkdir $2              mkdir "$2"
171          fi          fi
172          cd $1          cd "$1"
173          for i in * .[a-zA-Z0-9]* ; do          for i in * .[a-zA-Z0-9]* ; do
174              move $i $2/$i              move "$i" "$2"/"$i"
175          done          done
176          cd ..          cd ..
177      elif [ -f $1 ] ; then      elif [ -f "$1" ] ; then
178          rm -f $2          rm -f "$2"
179          mv $1 $2          mv "$1" "$2"
180      fi      fi
181  }  }
182    
# Line 179  Line 186 
186  # and establish $1 as a symbolic link to $2:  # and establish $1 as a symbolic link to $2:
187  #  #
188  dirarcs() {  dirarcs() {
189      if [ -d $3 ] ; then      if [ -d "$3" ] ; then
190          if [ $3 = $1 ] ; then          if [ "$3" = "$1" ] ; then
191              mv $1 $2              mv "$1" "$2"
192              ln -s $2 $1              ln -s "$2" "$1"
193          else          else
194              cd $3              cd "$3"
195              for d in * .[a-zA-Z0-9]* ; do              for d in * .[a-zA-Z0-9]* ; do
196                  dirarcs $1 $2 $d                  dirarcs "$1" "$2" "$d"
197              done              done
198              cd ..              cd ..
199          fi          fi
# Line 199  Line 206 
206  #  #
207  # create the various sub directories  # create the various sub directories
208  #  #
209  for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR ; do  for dir in "$BINDIR" "$HEAPDIR" "$RUNDIR" "$LIBDIR" "$SRCDIR" ; do
210      makedir $dir      makedir "$dir"
211  done  done
212    
213  #  #
# Line 217  Line 224 
224  #   if [ -x $BINDIR/$ddst ]; then  #   if [ -x $BINDIR/$ddst ]; then
225  #       echo $this: Script $BINDIR/$ddst already exists.  #       echo $this: Script $BINDIR/$ddst already exists.
226  #   else  #   else
227          rm -f $BINDIR/$ddst          rm -f "$BINDIR"/"$ddst"
228          cat $CONFIGDIR/$dsrc | \          cat "$CONFIGDIR"/"$dsrc" | \
229          sed -e "s,@SHELL@,$SHELL,g" \          sed -e "s,@SHELL@,$SHELL,g" \
230              -e "s,@BINDIR@,$BINDIR," \              -e "s,@BINDIR@,$BINDIR," \
231              -e "s,@VERSION@,$VERSION," \              -e "s,@VERSION@,$VERSION," \
232              > $BINDIR/$ddst              -e "s,@CMDIRARC@,${CM_DIR_ARC:-dummy}," \
233          chmod 555 $BINDIR/$ddst              > "$BINDIR"/"$ddst"
234          if [ ! -x $BINDIR/$ddst ]; then          chmod 555 "$BINDIR"/"$ddst"
235            if [ ! -x "$BINDIR"/"$ddst" ]; then
236              complain "$this: !!! Installation of $BINDIR/${ddst} failed."              complain "$this: !!! Installation of $BINDIR/${ddst} failed."
237          fi          fi
238  #   fi  #   fi
# Line 239  Line 247 
247  # run it to figure out what architecture and os we are using, define  # run it to figure out what architecture and os we are using, define
248  # corresponding variables...  # corresponding variables...
249  #  #
250  ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`  ARCH_N_OPSYS=`"$BINDIR"/.arch-n-opsys`
251  if [ "$?" != "0" ]; then  if [ "$?" != "0" ]; then
252      echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine."      echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine."
253      echo "$this: !!! You must patch this by hand and repeat the installation."      echo "$this: !!! You must patch this by hand and repeat the installation."
# Line 250  Line 258 
258  eval $ARCH_N_OPSYS  eval $ARCH_N_OPSYS
259    
260  #  #
261  # now install all the other driver scripts...  # now install most of the other driver scripts
262    #  (except ml-build, since we don't know $CM_DIR_ARC yet)
263  #  #
264  installdriver _run-sml .run-sml  installdriver _run-sml .run-sml
265  installdriver _link-sml .link-sml  installdriver _link-sml .link-sml
 installdriver _ml-build ml-build  
266  installdriver _ml-makedepend ml-makedepend  installdriver _ml-makedepend ml-makedepend
267    
268    installdriver _heap2exec heap2exec
269    
270  #  #
271  # set some architecture dependent run-time system flags  # set some architecture dependent run-time system flags
272  #  #
# Line 302  Line 312 
312  #  #
313  # build the run-time system  # build the run-time system
314  #  #
315  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then  if [ -x "$RUNDIR"/run.$ARCH-$OPSYS ]; then
316      vsay $this: Run-time system already exists.      vsay $this: Run-time system already exists.
317  else  else
318      $CONFIGDIR/unpack $ROOT runtime      "$CONFIGDIR"/unpack "$ROOT" runtime
319      cd $SRCDIR/runtime/objs      cd "$SRCDIR"/runtime/objs
320      echo $this: Compiling the run-time system.      echo $this: Compiling the run-time system.
321      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS
322      if [ -x run.$ARCH-$OPSYS ]; then      if [ -x run.$ARCH-$OPSYS ]; then
323          mv run.$ARCH-$OPSYS $RUNDIR          mv run.$ARCH-$OPSYS "$RUNDIR"
324            if [ -f runx.$ARCH-$OPSYS ]; then
325                mv runx.$ARCH-$OPSYS "$RUNDIR"
326            fi
327            if [ -f run.$ARCH-$OPSYS.so ]; then
328                mv run.$ARCH-$OPSYS.so "$RUNDIR"
329            fi
330            if [ -f run.$ARCH-$OPSYS.a ]; then
331                mv run.$ARCH-$OPSYS.a "$RUNDIR"
332            fi
333          $MAKE MAKE=$MAKE clean          $MAKE MAKE=$MAKE clean
334      else      else
335          complain "$this: !!! Run-time system build failed for some reason."          complain "$this: !!! Run-time system build failed for some reason."
336      fi      fi
337  fi  fi
338  cd $SRCDIR  cd "$SRCDIR"
339    
340  #  #
341  # boot the base SML system  # boot the base SML system
342  #  #
343  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then  if [ -r "$HEAPDIR"/sml.$HEAP_SUFFIX ]; then
344      vsay $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.      vsay $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.
345      fish $LIBDIR/basis.cm      fish "$LIBDIR"/smlnj/basis
346      # ignore requested arc name since we have to live with what is there:      # ignore requested arc name since we have to live with what is there:
347      export CM_DIR_ARC=$ORIG_CM_DIR_ARC      export CM_DIR_ARC
348        CM_DIR_ARC=$ORIG_CM_DIR_ARC
349        # now re-dump the heap image:
350        vsay "$this: Re-creating a (customized) heap image..."
351        "$BINDIR"/sml @CMredump "$ROOT"/sml
352        cd "$ROOT"
353        if [ -r sml.$HEAP_SUFFIX ]; then
354            mv sml.$HEAP_SUFFIX "$HEAPDIR"
355  else  else
356      $CONFIGDIR/unpack $ROOT $BOOT_ARCHIVE          complain "$this !!! Unable to re-create heap image (sml.$HEAP_SUFFIX)."
357        fi
358    else
359        "$CONFIGDIR"/unpack "$ROOT" "$BOOT_ARCHIVE"
360    
361      fish $ROOT/$BOOT_FILES/basis.cm      fish "$ROOT"/"$BOOT_FILES"/smlnj/basis
362    
363      cd $ROOT      cd "$ROOT"
364    
365      # Target arc:      # Target arc:
366      export CM_DIR_ARC=${CM_DIR_ARC:-".cm"}      export CM_DIR_ARC
367        CM_DIR_ARC=${CM_DIR_ARC:-".cm"}
368    
369      if [ $CM_DIR_ARC = $ORIG_CM_DIR_ARC ] ; then      if [ $CM_DIR_ARC = $ORIG_CM_DIR_ARC ] ; then
370          : we are happy          : we are happy
371      else      else
372          # now we have to make a symbolic link for each occurrence of          # now we have to make a symbolic link for each occurrence of
373          # $ORIG_CM_DIR_ARC to $CM_DIR_ARC          # $ORIG_CM_DIR_ARC to $CM_DIR_ARC
374          dirarcs ${ORIG_CM_DIR_ARC} ${CM_DIR_ARC} $BOOT_FILES          dirarcs "$ORIG_CM_DIR_ARC" "$CM_DIR_ARC" "$BOOT_FILES"
375      fi      fi
376    
377      cd $ROOT/$BOOT_FILES      cd "$ROOT"/"$BOOT_FILES"
378    
379      # now link (boot) the system and let it initialize itself...      # now link (boot) the system and let it initialize itself...
380      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC      if "$BINDIR"/.link-sml @SMLheap="$ROOT"/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC
381      then      then
382          cd $ROOT          cd "$ROOT"
383          if [ -r sml.$HEAP_SUFFIX ]; then          if [ -r sml.$HEAP_SUFFIX ]; then
384              mv sml.$HEAP_SUFFIX $HEAPDIR              mv sml.$HEAP_SUFFIX "$HEAPDIR"
385              cd $BINDIR              cd "$BINDIR"
386              ln -s .run-sml sml              ln -s .run-sml sml
387              #              #
388              # Now move all stable libraries to #LIBDIR and generate              # Now move all stable libraries to #LIBDIR and generate
389              # the pathconfig file.              # the pathconfig file.
390              #              #
391              cd $ROOT/$BOOT_FILES              cd "$ROOT"/"$BOOT_FILES"
392              for anchor in * ; do              for anchor in * ; do
393                  if [ -d $anchor ] ; then                  if [ -d $anchor ] ; then
394                      echo $anchor $anchor >>$CM_PATHCONFIG                      echo $anchor $anchor >>$CM_PATHCONFIG
395                      move $anchor $LIBDIR/$anchor                      move $anchor "$LIBDIR"/$anchor
396                  fi                  fi
397              done              done
398              cd $ROOT              cd "$ROOT"
399              # $BOOT_FILES is now only an empty skeleton, let's get rid of it.              # $BOOT_FILES is now only an empty skeleton, let's get rid of it.
400              rm -rf $BOOT_FILES              rm -rf "$BOOT_FILES"
401    
402          else          else
403              complain "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."              complain "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."
# Line 377  Line 407 
407      fi      fi
408  fi  fi
409    
410  cd $ROOT  #
411    # now that we know CM_DIR_ARC we can install the ml-build driver...
412    #
413    installdriver _ml-build ml-build
414    
415    cd "$ROOT"
416    
417  #  #
418  # Now do all the rest using the precompiled installer:  # Now do all the rest using the precompiled installer:
419  #  #
420    if [ $nolib = false ] ; then
421  echo $this: Installing other libraries and programs:  echo $this: Installing other libraries and programs:
422  export ROOT INSTALLDIR CONFIGDIR BINDIR  export ROOT INSTALLDIR CONFIGDIR BINDIR
423  if $BINDIR/sml -m \$smlnj/installer.cm      if "$BINDIR"/sml -m \$smlnj/installer.cm
424  then  then
425      vsay $this: Installation complete.      vsay $this: Installation complete.
426  else  else
427      complain "$this: !!! Installation of libraries and programs failed."      complain "$this: !!! Installation of libraries and programs failed."
428  fi  fi
429    fi
430    
431  exit 0  exit 0

Legend:
Removed from v.1409  
changed lines
  Added in v.2150

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