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.60/install.sh
ViewVC logotype

Diff of /config/releases/release-110.60/install.sh

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

revision 569, Tue Mar 7 04:01:07 2000 UTC revision 573, Thu Mar 9 15:23:52 2000 UTC
# Line 57  Line 57 
57  LIBMOVESCRIPT=$ROOT/libmove     # a temporary script  LIBMOVESCRIPT=$ROOT/libmove     # a temporary script
58  LOCALPATHCONFIG=$INSTALLDIR/pathconfig # a temporary pathconfig file  LOCALPATHCONFIG=$INSTALLDIR/pathconfig # a temporary pathconfig file
59    
60    URLGETTER=unknown
61    
62  #  #
63  # the path to the dir where ml-yacc, ml-burg, ml-lex, and ml-build live  # the path to the dir where ml-yacc, ml-burg, ml-lex, and ml-build live
64  #  #
# Line 91  Line 93 
93  echo Installing version $VERSION.  echo Installing version $VERSION.
94    
95  #  #
96    # the URL for the (usually remote) source archive
97    #
98    SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl`
99    echo URL of source archive is $SRCARCHIVEURL.
100    
101    #
102  # Function to make a directory (and advertise such action).  # Function to make a directory (and advertise such action).
103  #  #
104  makedir() {  makedir() {
# Line 106  Line 114 
114  }  }
115    
116  #  #
117    # Function for asking user to fetch source archive.
118    #   $1 - descriptive name
119    #   $2 - base name without extension, without version, and without dir
120    #   $3 - remote directory
121    #
122    askurl() {
123        echo Please, fetch $1 archive '('$VERSION-$2.'*)' from
124        echo '  ' $3
125        echo "and then re-run this script!"
126        exit 1
127    }
128    
129    #
130    # Function for fetching source archives automatically using wget or lynx.
131    #   $1 - command to actually get the stuff
132    #   $2 - descriptive name
133    #   $3 - base name without extension, without version, and without dir
134    #   $4 - remote directory
135    #
136    fetchurl() {
137        getter=$1 ; shift
138        echo Fetching $1 from $2. Please stand by...
139        fetched=no
140        for ext in tgz tar.gz tar.Z tz tar tar.bz2 ; do
141            try=$VERSION-$2.$ext
142            echo Trying $try ...
143            if $getter $3 $try $ROOT/$try ; then
144                fetched=yes
145                echo Success.
146                break
147            else
148                rm -f $ROOT/$try
149            fi
150        done
151        if [ $fetched = no ] ; then
152            echo No success.  You should try to do it manually now.
153            askurl "$1" "$2" "$3"
154        fi
155    }
156    
157    usewget() {
158        wget -nv -O $3 $1/$2
159    }
160    
161    uselynx() {
162        lynx -source $1/$2 >$3
163    }
164    
165    testurlgetter() {
166        (exec >/dev/null 2>&1 ; exec $*)
167    }
168    
169    #
170    # Function to check whether wget or lynx is available.
171    # Set URLGETTER accordingly.
172    #
173    urlgetter() {
174        if [ "$URLGETTER" = unknown ] ; then
175            if testurlgetter wget --help ; then
176                URLGETTER="fetchurl usewget"
177            elif testurlgetter lynx -help ; then
178                URLGETTER="fetchurl uselynx"
179            else
180                URLGETTER="askurl"
181            fi
182        fi
183    }
184    
185    #
186  # Function to unpack a source archive.  # Function to unpack a source archive.
187  #  #
188  # $1: descriptive name of the sources to be unpacked  # $1: descriptive name of the sources to be unpacked
# Line 114  Line 191 
191  # $4: the basename of the source archive (the script will check several  # $4: the basename of the source archive (the script will check several
192  #     different suffixes to determine what kind of de-compression is to  #     different suffixes to determine what kind of de-compression is to
193  #     be used)  #     be used)
194    #
195    # fetch_n_unpack is the helper function that does the real work.  If
196    # on archive is found locally, it invokes $URLGETTER and tries again.
197    # The variable $tryfetch is used to make sure this happens only once.
198    fetch_n_unpack() {
199        larc=$ROOT/$VERSION-$4
200        cd $2
201        if [ -r $larc.tar.Z ] ; then
202            echo "Un-compress-ing and un-tar-ing $1 archive."
203            zcat $larc.tar.Z | tar -xf -
204        elif [ -r $larc.tar ] ; then
205            echo "Un-tar-ing $1 archive."
206            tar -xf $larc.tar
207        elif [ -r $larc.tar.gz ] ; then
208            echo "Un-gzip-ing and un-tar-ing $1 archive."
209            gunzip -c $larc.tar.gz | tar -xf -
210        elif [ -r $larc.tar.bz2 ] ; then
211            echo "Un-bzip2-ing and un-tar-ing $1 archive."
212            bunzip2 -c $larc.tar.bz2 | tar -xf -
213        elif [ -r $larc.tgz ] ; then
214            echo "Un-gzip-ing and un-tar-ing $1 archive."
215            gunzip -c $larc.tgz | tar -xf -
216        elif [ -r $larc.tz ] ; then
217            echo "Un-compress-ing and un-tar-ing $1 archive."
218            zcat $larc.tz | tar -xf -
219        elif [ $tryfetch = yes ] ; then
220            urlgetter
221            $URLGETTER "$1" $4 $SRCARCHIVEURL
222            tryfetch=no
223            fetch_n_unpack "$1" "$2" "$3" "$4"
224        fi
225    }
226    
227    #
228    # The main "unpack" driver function that invokes the above helper.
229    #
230  unpack() {  unpack() {
231        tryfetch=yes
232      if [ -d $2/$3 ]; then      if [ -d $2/$3 ]; then
233          echo "The $1 source tree already exists."          echo "The $1 tree already exists."
     else  
         echo "Unpacking $1 source archive."  
         cd $2  
         if [ -r $4.tar.Z ] ; then  
             zcat $4.tar.Z | tar -xf -  
         elif [ -r $4.tar ] ; then  
             tar -xf $4.tar  
         elif [ -r $4.tar.gz ] ; then  
             gunzip -c $4.tar.gz | tar -xf -  
         elif [ -r $4.tar.bz2 ] ; then  
             bunzip2 -c $4.tar.bz2 | tar -xf -  
         elif [ -r $4.tgz ] ; then  
             gunzip -c $4.tgz | tar -xf -  
         elif [ -r $4.tz ] ; then  
             zcat $4.tz | tar -xf -  
234          else          else
235              echo "!!! The $1 source archive is missing."          fetch_n_unpack "$1" "$2" "$3" "$4"
             exit 1  
236          fi          fi
237          if [ ! -d $2/$3 ]; then          if [ ! -d $2/$3 ]; then
238              echo "!!! Unable to unpack $1 source archive."          echo "!!! Unable to unpack $1 archive."
239              exit 1              exit 1
240          fi          fi
241    }
242    
243    # A function to move all stable library files to a parallel directory
244    # hierarchy.
245    # The first argument must be a simple path (no / inside), and
246    # the second argument must be an absolute path.
247    move() {
248        if [ -d $1 ] ; then
249            if [ ! -d $2 ] ; then
250                if [ -f $2 ] ; then
251                    echo install.sh: $2 exists as a non-directory.
252                    exit 1
253                fi
254                mkdir $2
255            fi
256            cd $1
257            for i in * ; do
258                move $i $2/$i
259            done
260            cd ..
261        elif [ -f $1 ] ; then
262            rm -f $2
263            mv $1 $2
264      fi      fi
265  }  }
266    
# Line 223  Line 344 
344          echo Target $TARGET already exists.          echo Target $TARGET already exists.
345      else      else
346          echo Building $TARGET.          echo Building $TARGET.
347          unpack $2 $SRCDIR $1 $ROOT/$VERSION-$1          unpack $2 $SRCDIR $1 $1
348          cd $SRCDIR/$1          cd $SRCDIR/$1
349          ./build          ./build
350          if [ -r $TARGETLOC ] ; then          if [ -r $TARGETLOC ] ; then
# Line 343  Line 464 
464  #  #
465  # build the run-time system  # build the run-time system
466  #  #
467  unpack "run-time" $SRCDIR runtime $ROOT/$VERSION-runtime  unpack "run-time" $SRCDIR runtime runtime
468  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then  if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then
469      echo Run-time system already exists.      echo Run-time system already exists.
470  else  else
# Line 366  Line 487 
487  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then  if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then
488      echo Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.      echo Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists.
489  else  else
490      unpack bin $ROOT $BOOT_FILES $ROOT/$VERSION-$BOOT_FILES      unpack bin $ROOT $BOOT_FILES $BOOT_FILES
491      cd $ROOT/$BOOT_FILES      cd $ROOT/$BOOT_FILES
492      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC      if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC
493      then      then
# Line 380  Line 501 
501              # the pathconfig file.              # the pathconfig file.
502              #              #
503              cd $ROOT/$BOOT_FILES              cd $ROOT/$BOOT_FILES
504              for lib in *.cm ; do              for anchor in * ; do
505                  echo $lib $LIBDIR/$lib >>$CM_PATHCONFIG_DEFAULT                  if [ -d $anchor ] ; then
506                  movelibs $ROOT/$BOOT_FILES/$lib $lib                      echo $anchor $anchor >>$CM_PATHCONFIG_DEFAULT
507                        move $anchor $LIBDIR/$anchor
508                    fi
509              done              done
510              cd $ROOT              cd $ROOT
511              # rm -rf $BOOT_FILES              # $BOOT_FILES is now only an empty skeleton, let's get rid of it.
512                rm -rf $BOOT_FILES
513    
514          else          else
515              echo "!!! Boot code did not produce heap image (sml.$HEAP_SUFFIX)."              echo "!!! Boot code did not produce heap image (sml.$HEAP_SUFFIX)."
# Line 414  Line 538 
538        src-smlnj)        src-smlnj)
539          for src in compiler cm MLRISC smlnj-lib ml-yacc system          for src in compiler cm MLRISC smlnj-lib ml-yacc system
540          do          do
541              unpack $src $ROOT/src $src $ROOT/$VERSION-$src              unpack $src $ROOT/src $src $src
542          done          done
543          ;;          ;;
544        ml-yacc)        ml-yacc)
# Line 430  Line 554 
554          echo ml-burg $TOOLDIR >>$CM_PATHCONFIG_DEFAULT          echo ml-burg $TOOLDIR >>$CM_PATHCONFIG_DEFAULT
555          ;;          ;;
556        smlnj-lib)        smlnj-lib)
557          unpack "SML/NJ Library" $SRCDIR smlnj-lib $ROOT/$VERSION-smlnj-lib          unpack "SML/NJ Library" $SRCDIR smlnj-lib smlnj-lib
558    
559          # Don't make the Util library -- it came pre-made and has been          # Don't make the Util library -- it came pre-made and has been
560          # installed when making the base system.  In other words, don't do...          # installed when making the base system.  In other words, don't do...
# Line 449  Line 573 
573              reglib reactive-lib.cm smlnj-lib/Reactive              reglib reactive-lib.cm smlnj-lib/Reactive
574          ;;          ;;
575        cml)        cml)
576          unpack CML $SRCDIR cml $ROOT/$VERSION-cml          unpack CML $SRCDIR cml cml
577          reglib core-cml.cm cml/src/core-cml          reglib core-cml.cm cml/src/core-cml
578          reglib cml.cm cml/src          reglib cml.cm cml/src
579          reglib cml-basis.cm cml          reglib cml-basis.cm cml
580          ;;          ;;
581        cml-lib)        cml-lib)
582          unpack CML $SRCDIR cml $ROOT/$VERSION-cml          unpack CML $SRCDIR cml cml
583          reglib cml-lib.cm cml/cml-lib          reglib cml-lib.cm cml/cml-lib
584          ;;          ;;
585        eXene)        eXene)
586          unpack EXene $SRCDIR eXene $ROOT/$VERSION-eXene          unpack EXene $SRCDIR eXene eXene
587          reglib eXene.cm eXene          reglib eXene.cm eXene
588          ;;          ;;
589        doc)        doc)
590          unpack Doc $ROOT doc $ROOT/$VERSION-doc          unpack Doc $ROOT doc doc
591          cd $ROOT/doc          cd $ROOT/doc
592          build $ROOT          build $ROOT
593          ;;          ;;

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

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