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 1494, Thu May 20 03:09:17 2004 UTC revision 1794, Wed May 18 16:59:22 2005 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 77  Line 84 
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  #  #
103  # the release version that we are installing  # the release version that we are installing
104  #  #
105  VERSION=`cat $CONFIGDIR/version`  VERSION=`cat "$CONFIGDIR/version"`
106  vsay $this: Installing version $VERSION.  vsay $this: Installing version $VERSION.
107    
108  #  #
109  # the URL for the (usually remote) source archive  # the URL for the (usually remote) source archive
110  #  #
111  SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl`  . "$CONFIGDIR"/srcarchiveurl
112  vsay $this: URL of source archive is $SRCARCHIVEURL.  vsay $this: URL of source archive is $SRCARCHIVEURL.
113    
114  #  #
115  # Function to make a directory including its ancestors.  # Function to make a directory including its ancestors.
116  #  #
117  makedir() {  makedir() {
118      if [ x$1 = x ] ; then      if [ x"$1" = x ] ; then
119          :          :
120      elif [ -d $1 ] ; then      elif [ -d "$1" ] ; then
121          :          :
122      else      else
123          makedir `dirname $1`          makedirtmp=`dirname "$1"`
124            makedir "$makedirtmp"
125          if [ x${INSTALL_VERBOSE} = xtrue ] ; then          if [ x${INSTALL_VERBOSE} = xtrue ] ; then
126              vsay "$this: Making directory $1"              vsay "$this: Making directory $1"
127          fi          fi
128          if mkdir $1 ; then          if mkdir "$1" ; then
129              :              :
130          else          else
131              complain "$this: !!! Unable to make directory $1!"              complain "$this: !!! Unable to make directory $1!"
# Line 132  Line 140 
140  # a single subdirectory which is a CM metadata directory:  # a single subdirectory which is a CM metadata directory:
141  #  #
142  fish() {  fish() {
143      cd $1      cd "$1"
144      ORIG_CM_DIR_ARC=unknown      ORIG_CM_DIR_ARC=unknown
145      for i in * .[a-zA-Z0-9]* ; do      for i in * .[a-zA-Z0-9]* ; do
146          if [ -d $i ] ; then          if [ -d $i ] ; then
# Line 153  Line 161 
161  # The first argument must be a simple path (no / inside), and  # The first argument must be a simple path (no / inside), and
162  # the second argument must be an absolute path.  # the second argument must be an absolute path.
163  move() {  move() {
164      if [ -L $1 ] ; then      if [ -L "$1" ] ; then
165          rm -f $1             # remove symbolic link made by diracs (see below)          rm -f "$1"           # remove symbolic link made by diracs (see below)
166      elif [ -d $1 ] ; then      elif [ -d "$1" ] ; then
167          if [ ! -d $2 ] ; then          if [ ! -d "$2" ] ; then
168              if [ -f $2 ] ; then              if [ -f "$2" ] ; then
169                  complain $this: $2 exists as a non-directory.                  complain $this: $2 exists as a non-directory.
170              fi              fi
171              mkdir $2              mkdir "$2"
172          fi          fi
173          cd $1          cd "$1"
174          for i in * .[a-zA-Z0-9]* ; do          for i in * .[a-zA-Z0-9]* ; do
175              move $i $2/$i              move "$i" "$2"/"$i"
176          done          done
177          cd ..          cd ..
178      elif [ -f $1 ] ; then      elif [ -f "$1" ] ; then
179          rm -f $2          rm -f "$2"
180          mv $1 $2          mv "$1" "$2"
181      fi      fi
182  }  }
183    
# Line 179  Line 187 
187  # and establish $1 as a symbolic link to $2:  # and establish $1 as a symbolic link to $2:
188  #  #
189  dirarcs() {  dirarcs() {
190      if [ -d $3 ] ; then      if [ -d "$3" ] ; then
191          if [ $3 = $1 ] ; then          if [ "$3" = "$1" ] ; then
192              mv $1 $2              mv "$1" "$2"
193              ln -s $2 $1              ln -s "$2" "$1"
194          else          else
195              cd $3              cd "$3"
196              for d in * .[a-zA-Z0-9]* ; do              for d in * .[a-zA-Z0-9]* ; do
197                  dirarcs $1 $2 $d                  dirarcs "$1" "$2" "$d"
198              done              done
199              cd ..              cd ..
200          fi          fi
# Line 199  Line 207 
207  #  #
208  # create the various sub directories  # create the various sub directories
209  #  #
210  for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR ; do  for dir in "$BINDIR" "$HEAPDIR" "$RUNDIR" "$LIBDIR" "$SRCDIR" ; do
211      makedir $dir      makedir "$dir"
212  done  done
213    
214  #  #
# Line 217  Line 225 
225  #   if [ -x $BINDIR/$ddst ]; then  #   if [ -x $BINDIR/$ddst ]; then
226  #       echo $this: Script $BINDIR/$ddst already exists.  #       echo $this: Script $BINDIR/$ddst already exists.
227  #   else  #   else
228          rm -f $BINDIR/$ddst          rm -f "$BINDIR"/"$ddst"
229          cat $CONFIGDIR/$dsrc | \          cat "$CONFIGDIR"/"$dsrc" | \
230          sed -e "s,@SHELL@,$SHELL,g" \          sed -e "s,@SHELL@,$SHELL,g" \
231              -e "s,@BINDIR@,$BINDIR," \              -e "s,@BINDIR@,$BINDIR," \
232              -e "s,@VERSION@,$VERSION," \              -e "s,@VERSION@,$VERSION," \
233              -e "s,@CMDIRARC@,${CM_DIR_ARC:-dummy}," \              -e "s,@CMDIRARC@,${CM_DIR_ARC:-dummy}," \
234              > $BINDIR/$ddst              > "$BINDIR"/"$ddst"
235          chmod 555 $BINDIR/$ddst          chmod 555 "$BINDIR"/"$ddst"
236          if [ ! -x $BINDIR/$ddst ]; then          if [ ! -x "$BINDIR"/"$ddst" ]; then
237              complain "$this: !!! Installation of $BINDIR/${ddst} failed."              complain "$this: !!! Installation of $BINDIR/${ddst} failed."
238          fi          fi
239  #   fi  #   fi
# Line 240  Line 248 
248  # 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
249  # corresponding variables...  # corresponding variables...
250  #  #
251  ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`  ARCH_N_OPSYS=`"$BINDIR"/.arch-n-opsys`
252  if [ "$?" != "0" ]; then  if [ "$?" != "0" ]; then
253      echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine."      echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine."
254      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 258  Line 266 
266  installdriver _link-sml .link-sml  installdriver _link-sml .link-sml
267  installdriver _ml-makedepend ml-makedepend  installdriver _ml-makedepend ml-makedepend
268    
269    installdriver _heap2exec heap2exec
270    
271  #  #
272  # set some architecture dependent run-time system flags  # set some architecture dependent run-time system flags
273  #  #
# Line 303  Line 313 
313  #  #
314  # build the run-time system  # build the run-time system
315  #  #
316  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then  if [ -x "$RUNDIR"/run.$ARCH-$OPSYS ]; then
317      vsay $this: Run-time system already exists.      vsay $this: Run-time system already exists.
318  else  else
319      $CONFIGDIR/unpack $ROOT runtime      "$CONFIGDIR"/unpack "$ROOT" runtime
320      cd $SRCDIR/runtime/objs      cd "$SRCDIR"/runtime/objs
321      echo $this: Compiling the run-time system.      echo $this: Compiling the run-time system.
322      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS
323      if [ -x run.$ARCH-$OPSYS ]; then      if [ -x run.$ARCH-$OPSYS ]; then
324          mv run.$ARCH-$OPSYS $RUNDIR          mv run.$ARCH-$OPSYS "$RUNDIR"
325            if [ -f runx.$ARCH-$OPSYS ]; then
326                mv runx.$ARCH-$OPSYS "$RUNDIR"
327            fi
328          $MAKE MAKE=$MAKE clean          $MAKE MAKE=$MAKE clean
329      else      else
330          complain "$this: !!! Run-time system build failed for some reason."          complain "$this: !!! Run-time system build failed for some reason."
331      fi      fi
332  fi  fi
333  cd $SRCDIR  cd "$SRCDIR"
334    
335  #  #
336  # boot the base SML system  # boot the base SML system
337  #  #
338  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then  if [ -r "$HEAPDIR"/sml.$HEAP_SUFFIX ]; then
339      vsay $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.      vsay $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.
340      fish $LIBDIR/basis.cm      fish "$LIBDIR"/basis.cm
341      # 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:
342      export CM_DIR_ARC=$ORIG_CM_DIR_ARC      export CM_DIR_ARC
343        CM_DIR_ARC=$ORIG_CM_DIR_ARC
344        # now re-dump the heap image:
345        vsay "$this: Re-creating a (customized) heap image..."
346        "$BINDIR"/sml @CMredump "$ROOT"/sml
347        cd "$ROOT"
348        if [ -r sml.$HEAP_SUFFIX ]; then
349            mv sml.$HEAP_SUFFIX "$HEAPDIR"
350  else  else
351      $CONFIGDIR/unpack $ROOT $BOOT_ARCHIVE          complain "$this !!! Unable to re-create heap image (sml.$HEAP_SUFFIX)."
352        fi
353    else
354        "$CONFIGDIR"/unpack "$ROOT" "$BOOT_ARCHIVE"
355    
356      fish $ROOT/$BOOT_FILES/basis.cm      fish "$ROOT"/"$BOOT_FILES"/basis.cm
357    
358      cd $ROOT      cd "$ROOT"
359    
360      # Target arc:      # Target arc:
361      export CM_DIR_ARC=${CM_DIR_ARC:-".cm"}      export CM_DIR_ARC
362        CM_DIR_ARC=${CM_DIR_ARC:-".cm"}
363    
364      if [ $CM_DIR_ARC = $ORIG_CM_DIR_ARC ] ; then      if [ $CM_DIR_ARC = $ORIG_CM_DIR_ARC ] ; then
365          : we are happy          : we are happy
366      else      else
367          # now we have to make a symbolic link for each occurrence of          # now we have to make a symbolic link for each occurrence of
368          # $ORIG_CM_DIR_ARC to $CM_DIR_ARC          # $ORIG_CM_DIR_ARC to $CM_DIR_ARC
369          dirarcs ${ORIG_CM_DIR_ARC} ${CM_DIR_ARC} $BOOT_FILES          dirarcs "$ORIG_CM_DIR_ARC" "$CM_DIR_ARC" "$BOOT_FILES"
370      fi      fi
371    
372      cd $ROOT/$BOOT_FILES      cd "$ROOT"/"$BOOT_FILES"
373    
374      # now link (boot) the system and let it initialize itself...      # now link (boot) the system and let it initialize itself...
375      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC      if "$BINDIR"/.link-sml @SMLheap="$ROOT"/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC
376      then      then
377          cd $ROOT          cd "$ROOT"
378          if [ -r sml.$HEAP_SUFFIX ]; then          if [ -r sml.$HEAP_SUFFIX ]; then
379              mv sml.$HEAP_SUFFIX $HEAPDIR              mv sml.$HEAP_SUFFIX "$HEAPDIR"
380              cd $BINDIR              cd "$BINDIR"
381              ln -s .run-sml sml              ln -s .run-sml sml
382              #              #
383              # Now move all stable libraries to #LIBDIR and generate              # Now move all stable libraries to #LIBDIR and generate
384              # the pathconfig file.              # the pathconfig file.
385              #              #
386              cd $ROOT/$BOOT_FILES              cd "$ROOT"/"$BOOT_FILES"
387              for anchor in * ; do              for anchor in * ; do
388                  if [ -d $anchor ] ; then                  if [ -d $anchor ] ; then
389                      echo $anchor $anchor >>$CM_PATHCONFIG                      echo $anchor $anchor >>$CM_PATHCONFIG
390                      move $anchor $LIBDIR/$anchor                      move $anchor "$LIBDIR"/$anchor
391                  fi                  fi
392              done              done
393              cd $ROOT              cd "$ROOT"
394              # $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.
395              rm -rf $BOOT_FILES              rm -rf "$BOOT_FILES"
396    
397          else          else
398              complain "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."              complain "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."
# Line 383  Line 407 
407  #  #
408  installdriver _ml-build ml-build  installdriver _ml-build ml-build
409    
410  cd $ROOT  cd "$ROOT"
411    
412  #  #
413  # Now do all the rest using the precompiled installer:  # Now do all the rest using the precompiled installer:
414  #  #
415    if [ $nolib = false ] ; then
416  echo $this: Installing other libraries and programs:  echo $this: Installing other libraries and programs:
417  export ROOT INSTALLDIR CONFIGDIR BINDIR  export ROOT INSTALLDIR CONFIGDIR BINDIR
418  if $BINDIR/sml -m \$smlnj/installer.cm      if "$BINDIR"/sml -m \$smlnj/installer.cm
419  then  then
420      vsay $this: Installation complete.      vsay $this: Installation complete.
421  else  else
422      complain "$this: !!! Installation of libraries and programs failed."      complain "$this: !!! Installation of libraries and programs failed."
423  fi  fi
424    fi
425    
426  exit 0  exit 0

Legend:
Removed from v.1494  
changed lines
  Added in v.1794

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