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 /sml/trunk/config/install.sh
ViewVC logotype

Diff of /sml/trunk/config/install.sh

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

revision 1391, Wed Sep 24 21:31:51 2003 UTC revision 1725, Tue Dec 14 23:23:41 2004 UTC
# Line 13  Line 13 
13  #  #
14    
15  if [ x${INSTALL_QUIETLY} = xtrue ] ; then  if [ x${INSTALL_QUIETLY} = xtrue ] ; then
16      export CM_VERBOSE=false      export CM_VERBOSE
17        CM_VERBOSE=false
18  fi  fi
19    
20  vsay() {  vsay() {
# Line 57  Line 58 
58  REAL_PWD=`pwd`  REAL_PWD=`pwd`
59  ROOT=${PWD:-$REAL_PWD}  ROOT=${PWD:-$REAL_PWD}
60  vsay $this: SML root is $ROOT.  vsay $this: SML root is $ROOT.
61  vsay $this: Installation directory is ${INSTALLDIR:=$ROOT}.  
62    cd "${INSTALLDIR:=$ROOT}"
63    INSTALLDIR=`pwd`
64    cd "$ROOT"
65    vsay $this: Installation directory is ${INSTALLDIR}.
66    
67  #  #
68  # set the various directory and file pathname variables  # set the various directory and file pathname variables
# Line 73  Line 78 
78  # files to be deleted after we are done...  # files to be deleted after we are done...
79  #  #
80  tmpfiles=""  tmpfiles=""
81  tmpfiles="$tmpfiles $ROOT/preloads.standard"  tmpfiles="$tmpfiles preloads.standard"
82  #  #
83  # make sure we always clean up after ourselves...  # make sure we always clean up after ourselves...
84  #  #
85  trap 'rm -f $tmpfiles' 0 1 2 3 15  trap 'cd "$ROOT"; rm -f $tmpfiles' 0 1 2 3 15
86    
87    
88  #  #
# Line 85  Line 90 
90  # that will be queried by the bootstrap code)  # that will be queried by the bootstrap code)
91  # Especially important is CM_PATHCONFIG.  # Especially important is CM_PATHCONFIG.
92  #  #
 CM_PATHCONFIG=$LIBDIR/pathconfig  
93  export CM_PATHCONFIG  export CM_PATHCONFIG
94    CM_PATHCONFIG=$LIBDIR/pathconfig
95    
96  #  #
97  # the release version that we are installing  # the release version that we are installing
98  #  #
99  VERSION=`cat $CONFIGDIR/version`  VERSION=`cat "$CONFIGDIR/version"`
100  vsay $this: Installing version $VERSION.  vsay $this: Installing version $VERSION.
101    
102  #  #
103  # the URL for the (usually remote) source archive  # the URL for the (usually remote) source archive
104  #  #
105  SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl`  . "$CONFIGDIR"/srcarchiveurl
106  vsay $this: URL of source archive is $SRCARCHIVEURL.  vsay $this: URL of source archive is $SRCARCHIVEURL.
107    
108  #  #
109  # Function to make a directory including its ancestors.  # Function to make a directory including its ancestors.
110  #  #
111  makedir() {  makedir() {
112      if [ x$1 = x ] ; then      if [ x"$1" = x ] ; then
113          :          :
114      elif [ -d $1 ] ; then      elif [ -d "$1" ] ; then
115          :          :
116      else      else
117          makedir `dirname $1`          makedirtmp=`dirname "$1"`
118            makedir "$makedirtmp"
119          if [ x${INSTALL_VERBOSE} = xtrue ] ; then          if [ x${INSTALL_VERBOSE} = xtrue ] ; then
120              vsay "$this: Making directory $1"              vsay "$this: Making directory $1"
121          fi          fi
122          if mkdir $1 ; then          if mkdir "$1" ; then
123              :              :
124          else          else
125              complain "$this: !!! Unable to make directory $1!"              complain "$this: !!! Unable to make directory $1!"
# Line 128  Line 134 
134  # a single subdirectory which is a CM metadata directory:  # a single subdirectory which is a CM metadata directory:
135  #  #
136  fish() {  fish() {
137      cd $1      cd "$1"
138      ORIG_CM_DIR_ARC=unknown      ORIG_CM_DIR_ARC=unknown
139      for i in * .[a-zA-Z0-9]* ; do      for i in * .[a-zA-Z0-9]* ; do
140          if [ -d $i ] ; then          if [ -d $i ] ; then
# Line 149  Line 155 
155  # The first argument must be a simple path (no / inside), and  # The first argument must be a simple path (no / inside), and
156  # the second argument must be an absolute path.  # the second argument must be an absolute path.
157  move() {  move() {
158      if [ -L $1 ] ; then      if [ -L "$1" ] ; then
159          rm -f $1             # remove symbolic link made by diracs (see below)          rm -f "$1"           # remove symbolic link made by diracs (see below)
160      elif [ -d $1 ] ; then      elif [ -d "$1" ] ; then
161          if [ ! -d $2 ] ; then          if [ ! -d "$2" ] ; then
162              if [ -f $2 ] ; then              if [ -f "$2" ] ; then
163                  complain $this: $2 exists as a non-directory.                  complain $this: $2 exists as a non-directory.
164              fi              fi
165              mkdir $2              mkdir "$2"
166          fi          fi
167          cd $1          cd "$1"
168          for i in * .[a-zA-Z0-9]* ; do          for i in * .[a-zA-Z0-9]* ; do
169              move $i $2/$i              move "$i" "$2"/"$i"
170          done          done
171          cd ..          cd ..
172      elif [ -f $1 ] ; then      elif [ -f "$1" ] ; then
173          rm -f $2          rm -f "$2"
174          mv $1 $2          mv "$1" "$2"
175      fi      fi
176  }  }
177    
# Line 175  Line 181 
181  # and establish $1 as a symbolic link to $2:  # and establish $1 as a symbolic link to $2:
182  #  #
183  dirarcs() {  dirarcs() {
184      if [ -d $3 ] ; then      if [ -d "$3" ] ; then
185          if [ $3 = $1 ] ; then          if [ "$3" = "$1" ] ; then
186              mv $1 $2              mv "$1" "$2"
187              ln -s $2 $1              ln -s "$2" "$1"
188          else          else
189              cd $3              cd "$3"
190              for d in * .[a-zA-Z0-9]* ; do              for d in * .[a-zA-Z0-9]* ; do
191                  dirarcs $1 $2 $d                  dirarcs "$1" "$2" "$d"
192              done              done
193              cd ..              cd ..
194          fi          fi
# Line 195  Line 201 
201  #  #
202  # create the various sub directories  # create the various sub directories
203  #  #
204  for dir in $BINDIR $HEAPDIR $RUNDIR $LIBDIR $SRCDIR ; do  for dir in "$BINDIR" "$HEAPDIR" "$RUNDIR" "$LIBDIR" "$SRCDIR" ; do
205      makedir $dir      makedir "$dir"
206  done  done
207    
208  #  #
# Line 213  Line 219 
219  #   if [ -x $BINDIR/$ddst ]; then  #   if [ -x $BINDIR/$ddst ]; then
220  #       echo $this: Script $BINDIR/$ddst already exists.  #       echo $this: Script $BINDIR/$ddst already exists.
221  #   else  #   else
222          rm -f $BINDIR/$ddst          rm -f "$BINDIR"/"$ddst"
223          cat $CONFIGDIR/$dsrc | \          cat "$CONFIGDIR"/"$dsrc" | \
224          sed -e "s,@SHELL@,$SHELL,g" \          sed -e "s,@SHELL@,$SHELL,g" \
225              -e "s,@BINDIR@,$BINDIR," \              -e "s,@BINDIR@,$BINDIR," \
226              -e "s,@VERSION@,$VERSION," \              -e "s,@VERSION@,$VERSION," \
227              > $BINDIR/$ddst              -e "s,@CMDIRARC@,${CM_DIR_ARC:-dummy}," \
228          chmod 555 $BINDIR/$ddst              > "$BINDIR"/"$ddst"
229          if [ ! -x $BINDIR/$ddst ]; then          chmod 555 "$BINDIR"/"$ddst"
230            if [ ! -x "$BINDIR"/"$ddst" ]; then
231              complain "$this: !!! Installation of $BINDIR/${ddst} failed."              complain "$this: !!! Installation of $BINDIR/${ddst} failed."
232          fi          fi
233  #   fi  #   fi
# Line 235  Line 242 
242  # 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
243  # corresponding variables...  # corresponding variables...
244  #  #
245  ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys`  ARCH_N_OPSYS=`"$BINDIR"/.arch-n-opsys`
246  if [ "$?" != "0" ]; then  if [ "$?" != "0" ]; then
247      echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine."      echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine."
248      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 246  Line 253 
253  eval $ARCH_N_OPSYS  eval $ARCH_N_OPSYS
254    
255  #  #
256  # now install all the other driver scripts...  # now install most of the other driver scripts
257    #  (except ml-build, since we don't know $CM_DIR_ARC yet)
258  #  #
259  installdriver _run-sml .run-sml  installdriver _run-sml .run-sml
260  installdriver _link-sml .link-sml  installdriver _link-sml .link-sml
 installdriver _ml-build ml-build  
261  installdriver _ml-makedepend ml-makedepend  installdriver _ml-makedepend ml-makedepend
262    
263  #  #
# Line 298  Line 305 
305  #  #
306  # build the run-time system  # build the run-time system
307  #  #
308  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then  if [ -x "$RUNDIR"/run.$ARCH-$OPSYS ]; then
309      vsay $this: Run-time system already exists.      vsay $this: Run-time system already exists.
310  else  else
311      $CONFIGDIR/unpack $ROOT runtime      "$CONFIGDIR"/unpack "$ROOT" runtime
312      cd $SRCDIR/runtime/objs      cd "$SRCDIR"/runtime/objs
313      echo $this: Compiling the run-time system.      echo $this: Compiling the run-time system.
314      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS      $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS
315      if [ -x run.$ARCH-$OPSYS ]; then      if [ -x run.$ARCH-$OPSYS ]; then
316          mv run.$ARCH-$OPSYS $RUNDIR          mv run.$ARCH-$OPSYS "$RUNDIR"
317          $MAKE MAKE=$MAKE clean          $MAKE MAKE=$MAKE clean
318      else      else
319          complain "$this: !!! Run-time system build failed for some reason."          complain "$this: !!! Run-time system build failed for some reason."
320      fi      fi
321  fi  fi
322  cd $SRCDIR  cd "$SRCDIR"
323    
324  #  #
325  # boot the base SML system  # boot the base SML system
326  #  #
327  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then  if [ -r "$HEAPDIR"/sml.$HEAP_SUFFIX ]; then
328      vsay $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.      vsay $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.
329      fish $LIBDIR/basis.cm      fish "$LIBDIR"/basis.cm
330      # 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:
331      export CM_DIR_ARC=$ORIG_CM_DIR_ARC      export CM_DIR_ARC
332        CM_DIR_ARC=$ORIG_CM_DIR_ARC
333  else  else
334      $CONFIGDIR/unpack $ROOT $BOOT_ARCHIVE      "$CONFIGDIR"/unpack "$ROOT" "$BOOT_ARCHIVE"
335    
336      fish $ROOT/$BOOT_FILES/basis.cm      fish "$ROOT"/"$BOOT_FILES"/basis.cm
337    
338      cd $ROOT      cd "$ROOT"
339    
340      # Target arc:      # Target arc:
341      export CM_DIR_ARC=${CM_DIR_ARC:-".cm"}      export CM_DIR_ARC
342        CM_DIR_ARC=${CM_DIR_ARC:-".cm"}
343    
344      if [ $CM_DIR_ARC = $ORIG_CM_DIR_ARC ] ; then      if [ $CM_DIR_ARC = $ORIG_CM_DIR_ARC ] ; then
345          : we are happy          : we are happy
346      else      else
347          # now we have to make a symbolic link for each occurrence of          # now we have to make a symbolic link for each occurrence of
348          # $ORIG_CM_DIR_ARC to $CM_DIR_ARC          # $ORIG_CM_DIR_ARC to $CM_DIR_ARC
349          dirarcs ${ORIG_CM_DIR_ARC} ${CM_DIR_ARC} $BOOT_FILES          dirarcs "$ORIG_CM_DIR_ARC" "$CM_DIR_ARC" "$BOOT_FILES"
350      fi      fi
351    
352      cd $ROOT/$BOOT_FILES      cd "$ROOT"/"$BOOT_FILES"
353    
354      # now link (boot) the system and let it initialize itself...      # now link (boot) the system and let it initialize itself...
355      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC      if "$BINDIR"/.link-sml @SMLheap="$ROOT"/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC
356      then      then
357          cd $ROOT          cd "$ROOT"
358          if [ -r sml.$HEAP_SUFFIX ]; then          if [ -r sml.$HEAP_SUFFIX ]; then
359              mv sml.$HEAP_SUFFIX $HEAPDIR              mv sml.$HEAP_SUFFIX "$HEAPDIR"
360              cd $BINDIR              cd "$BINDIR"
361              ln -s .run-sml sml              ln -s .run-sml sml
362              #              #
363              # Now move all stable libraries to #LIBDIR and generate              # Now move all stable libraries to #LIBDIR and generate
364              # the pathconfig file.              # the pathconfig file.
365              #              #
366              cd $ROOT/$BOOT_FILES              cd "$ROOT"/"$BOOT_FILES"
367              for anchor in * ; do              for anchor in * ; do
368                  if [ -d $anchor ] ; then                  if [ -d $anchor ] ; then
369                      echo $anchor $anchor >>$CM_PATHCONFIG                      echo $anchor $anchor >>$CM_PATHCONFIG
370                      move $anchor $LIBDIR/$anchor                      move $anchor "$LIBDIR"/$anchor
371                  fi                  fi
372              done              done
373              cd $ROOT              cd "$ROOT"
374              # $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.
375              rm -rf $BOOT_FILES              rm -rf "$BOOT_FILES"
376    
377          else          else
378              complain "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."              complain "$this !!! No heap image generated (sml.$HEAP_SUFFIX)."
# Line 373  Line 382 
382      fi      fi
383  fi  fi
384    
385  cd $ROOT  #
386    # now that we know CM_DIR_ARC we can install the ml-build driver...
387    #
388    installdriver _ml-build ml-build
389    
390    cd "$ROOT"
391    
392  #  #
393  # Now do all the rest using the precompiled installer:  # Now do all the rest using the precompiled installer:
394  #  #
395  echo $this: Installing other libraries and programs:  echo $this: Installing other libraries and programs:
396  export ROOT CONFIGDIR BINDIR  export ROOT INSTALLDIR CONFIGDIR BINDIR
397  if $BINDIR/sml -m \$smlnj/installer.cm  if "$BINDIR"/sml -m \$smlnj/installer.cm
398  then  then
399      vsay $this: Installation complete.      vsay $this: Installation complete.
400  else  else

Legend:
Removed from v.1391  
changed lines
  Added in v.1725

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