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 578, Tue Mar 14 05:16:29 2000 UTC revision 653, Wed Jun 7 07:59:06 2000 UTC
# Line 67  Line 67 
67  TOOLDIR=$BINDIR  TOOLDIR=$BINDIR
68    
69  #  #
70    # A temporary file for post-editing the pathconfig file...
71    #
72    PCEDITTMP=/usr/tmp/pcedittmp.$$
73    
74    #
75  # files to be deleted after we are done...  # files to be deleted after we are done...
76  #  #
77  tmpfiles=""  tmpfiles=""
# Line 74  Line 79 
79  tmpfiles="$tmpfiles $LIBLIST"  tmpfiles="$tmpfiles $LIBLIST"
80  tmpfiles="$tmpfiles $LOCALPATHCONFIG"  tmpfiles="$tmpfiles $LOCALPATHCONFIG"
81  tmpfiles="$tmpfiles $LIBMOVESCRIPT"  tmpfiles="$tmpfiles $LIBMOVESCRIPT"
82    tmpfiles="$tmpfiles $PCEDITTMP"
83  #  #
84  # make sure we always clean up after ourselves...  # make sure we always clean up after ourselves...
85  #  #
# Line 122  Line 128 
128  #   $3 - remote directory  #   $3 - remote directory
129  #  #
130  askurl() {  askurl() {
131      echo $this: Please, fetch $1 archive '('$VERSION-$2.'*)' from      echo "$this: Please, fetch $1 archive"
132      echo '  ' $3      echo ' ('$2.'*' or $VERSION-$2.'*)'
133        echo " from $3"
134      echo "and then re-run this script!"      echo "and then re-run this script!"
135      exit 1      exit 1
136  }  }
# Line 132  Line 139 
139  # Function for fetching source archives automatically using wget or lynx.  # Function for fetching source archives automatically using wget or lynx.
140  #   $1 - command to actually get the stuff  #   $1 - command to actually get the stuff
141  #   $2 - descriptive name  #   $2 - descriptive name
142  #   $3 - base name without extension, without version, and without dir  #   $3 - base name without extension and without dir
143  #   $4 - remote directory  #   $4 - remote directory
144  #  #
145  fetchurl() {  fetchurl() {
146      getter=$1 ; shift      getter=$1 ; shift
147      echo $this: Fetching $1 from $3. Please stand by...      echo $this: Fetching $1 from $3. Please stand by...
148      fetched=no      fetched=no
149      for ext in tgz tar.gz tar.Z tz tar tar.bz2 ; do      for base in $2 $VERSION-$2 ; do
150          try=$VERSION-$2.$ext          for ext in tar.gz tgz tar.Z tz tar tar.bz2 ; do
151                try=$base.$ext
152          echo $this: Trying $try ...          echo $this: Trying $try ...
153          if $getter $3 $try $ROOT/$try ; then          if $getter $3 $try $ROOT/$try ; then
154              fetched=yes              fetched=yes
155              echo $this: Fetching $try was a success.              echo $this: Fetching $try was a success.
156              break                  break 2         # get out of both for-loops
157          else          else
158              rm -f $ROOT/$try              rm -f $ROOT/$try
159          fi          fi
160      done      done
161        done
162      if [ $fetched = no ] ; then      if [ $fetched = no ] ; then
163          echo $this: Fetching $try was no success.          echo $this: Fetching $try was no success.
164          echo '  ' You should try to do it manually now.          echo '  ' You should try to do it manually now.
# Line 185  Line 194 
194      fi      fi
195  }  }
196    
197    un_tar() {
198        echo "$this: Un-TAR-ing $1 archive."
199        tar -xf $2
200    }
201    
202    un_tar_Z() {
203        echo "$this: Un-COMPRESS-ing and un-TAR-ing $1 archive."
204        zcat $2 | tar -xf -
205    }
206    
207    un_tar_gz() {
208        echo "$this: Un-GZIP-ing and un-TAR-ing $1 archive."
209        gunzip -c $2 | tar -xf -
210    }
211    
212    un_tar_bz2() {
213        echo "$this: Un-BZIP2-ing and un-TAR-ing $1 archive."
214        bunzip2 -c $2 | tar -xf -
215    }
216    
217    unarchive() {
218        # $1: descriptive string, $2: archive, $3: unpacker
219        if [ -r $ROOT/$2 ] ; then
220            $3 "$1" $ROOT/$2
221        elif [ -r $ROOT/$VERSION-$2 ]; then
222            $3 "$1" $ROOT/$VERSION-$2
223        else
224            return 1
225        fi
226    }
227    
228  #  #
229  # Function to unpack a source archive.  # Function to unpack a source archive.
230  #  #
# Line 199  Line 239 
239  # no archive is found locally, it invokes $URLGETTER and tries again.  # no archive is found locally, it invokes $URLGETTER and tries again.
240  # The variable $tryfetch is used to make sure this happens only once.  # The variable $tryfetch is used to make sure this happens only once.
241  fetch_n_unpack() {  fetch_n_unpack() {
     larc=$ROOT/$VERSION-$4  
242      cd $2      cd $2
243      if [ -r $larc.tar.Z ] ; then      if unarchive "$1" $4.tar.gz un_tar_gz ||
244          echo "$this: Un-COMPRESS-ing and un-TAR-ing $1 archive."         unarchive "$1" $4.tgz un_tar_gz ||
245          zcat $larc.tar.Z | tar -xf -         unarchive "$1" $4.tar.Z un_tar_Z ||
246      elif [ -r $larc.tar ] ; then         unarchive "$1" $4.tar un_tar ||
247          echo "$this: Un-TAR-ing $1 archive."         unarchive "$1" $4.tar.bz1 un_tar_bz2 ||
248          tar -xf $larc.tar         unarchive "$1" $4.tz un_tar_Z
249      elif [ -r $larc.tar.gz ] ; then      then
250          echo "$this: Un-GZIP-ing and un-TAR-ing $1 archive."          : we are done
         gunzip -c $larc.tar.gz | tar -xf -  
     elif [ -r $larc.tar.bz2 ] ; then  
         echo "$this: Un-BZIP2-ing and un-TAR-ing $1 archive."  
         bunzip2 -c $larc.tar.bz2 | tar -xf -  
     elif [ -r $larc.tgz ] ; then  
         echo "$this: Un-GZIP-ing and un-TAR-ing $1 archive."  
         gunzip -c $larc.tgz | tar -xf -  
     elif [ -r $larc.tz ] ; then  
         echo "$this: Un-COMPRESS-ing and un-TAR-ing $1 archive."  
         zcat $larc.tz | tar -xf -  
251      elif [ $tryfetch = yes ] ; then      elif [ $tryfetch = yes ] ; then
252          urlgetter          urlgetter
253          $URLGETTER "$1" $4 $SRCARCHIVEURL          $URLGETTER "$1" $4 $SRCARCHIVEURL
# Line 311  Line 340 
340  reglib() {  reglib() {
341      if [ x$MOVE_LIBRARIES = xtrue ] ; then      if [ x$MOVE_LIBRARIES = xtrue ] ; then
342          FINALLOCATION=$LIBDIR/$1          FINALLOCATION=$LIBDIR/$1
343            FINALCONFIGPATH=$1
344      else      else
345          FINALLOCATION=$SRCDIR/$2          FINALLOCATION=$SRCDIR/$2
346            FINALCONFIGPATH=$FINALLOCATION
347      fi      fi
348      if [ -d $FINALLOCATION/CM/$ARCH-unix ] ; then      if [ -d $FINALLOCATION/CM/$ARCH-unix ] ; then
349          echo "$this: Library $1 already exists in $FINALLOCATION."          echo "$this: Library $1 already exists in $FINALLOCATION."
350      else      else
351          echo "$this: Scheduling library $1 to be built in $FINALLOCATION."          echo "$this: Scheduling library $1 to be built in $FINALLOCATION."
352          echo "  andalso CM.stabilize false \"$1\"" >>$LIBLIST          echo "  andalso CM.stabilize false \"\$/$1\"" >>$LIBLIST
353          echo $1 $SRCDIR/$2 >>$LOCALPATHCONFIG          echo $1 $SRCDIR/$2 >>$LOCALPATHCONFIG
354          if [ x$MOVE_LIBRARIES = xtrue ] ; then          if [ x$MOVE_LIBRARIES = xtrue ] ; then
355              echo movelibs $SRCDIR/$2 $1 >>$LIBMOVESCRIPT              echo movelibs $SRCDIR/$2 $1 >>$LIBMOVESCRIPT
356          fi          fi
         echo $1 $FINALLOCATION >>$CM_PATHCONFIG_DEFAULT  
357      fi      fi
358        echo $1 $FINALCONFIGPATH >>$CM_PATHCONFIG_DEFAULT
359  }  }
360    
361  #  #
# Line 466  Line 497 
497  #  #
498  # the name of the bin files directory  # the name of the bin files directory
499  #  #
500  BOOT_FILES=sml.boot.$ARCH-unix  BOOT_ARCHIVE=boot.$ARCH-unix
501    BOOT_FILES=sml.$BOOT_ARCHIVE
502    
503  #  #
504  # build the run-time system  # build the run-time system
# Line 494  Line 526 
526  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then
527      echo $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.      echo $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.
528  else  else
529      unpack bin $ROOT $BOOT_FILES $BOOT_FILES      unpack bin $ROOT $BOOT_FILES $BOOT_ARCHIVE
530      cd $ROOT/$BOOT_FILES      cd $ROOT/$BOOT_FILES
531      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC
532      then      then
# Line 533  Line 565 
565  #  #
566  cd $ROOT  cd $ROOT
567  rm -f $LOCALPATHCONFIG $LIBLIST  rm -f $LOCALPATHCONFIG $LIBLIST
568  echo 'OS.Process.exit (if true' >$LIBLIST  echo 'ignore (OS.Process.exit (if true' >$LIBLIST
569    
570  #  #
571  # now build (or prepare to build) the individual targets  # now build (or prepare to build) the individual targets
# Line 611  Line 643 
643  #  #
644    
645  echo $this: Compiling library code.  echo $this: Compiling library code.
646  echo 'then OS.Process.success else OS.Process.failure);' >>$LIBLIST  echo 'then OS.Process.success else OS.Process.failure));' >>$LIBLIST
647  if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then  if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then
648      echo $this: Libraries compiled successfully.      echo $this: Libraries compiled successfully.
649  else  else
# Line 620  Line 652 
652  fi  fi
653    
654  #  #
655  # Finally, move the libraries to their final locations...  # Move the libraries to their final locations...
656  #  #
657    
658  if [ -r $LIBMOVESCRIPT ] ; then  if [ -r $LIBMOVESCRIPT ] ; then
# Line 628  Line 660 
660      . $LIBMOVESCRIPT      . $LIBMOVESCRIPT
661  fi  fi
662    
663    #
664    # Finally, remove duplicate entries from pathconfig file...
665    #
666    if [ -f $CM_PATHCONFIG_DEFAULT ] ; then
667        cp $CM_PATHCONFIG_DEFAULT $PCEDITTMP
668        rm -f $CM_PATHCONFIG_DEFAULT
669        awk <$PCEDITTMP 'NF == 2 { mapping[$1] = $2 }
670    NF != 2 { print $0 }
671    END { for (i in mapping) print i, mapping[i] }' \
672          | sort >$CM_PATHCONFIG_DEFAULT
673    fi
674    
675  exit 0  exit 0

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

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