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/unpack
ViewVC logotype

Diff of /config/trunk/unpack

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

sml/trunk/config/unpack revision 1485, Tue May 11 16:36:07 2004 UTC config/trunk/unpack revision 2180, Fri Nov 3 17:19:57 2006 UTC
# Line 15  Line 15 
15  shift  shift
16    
17  CONFIGDIR=$ROOT/config  CONFIGDIR=$ROOT/config
 SRCDIR=$ROOT/src  
18    
19  VERSION=`cat $CONFIGDIR/version`  VERSION=`cat "$CONFIGDIR"/version`
20  SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl`  . "$CONFIGDIR"/srcarchiveurl
21    
22  vsay() {  vsay() {
23      if [ x${INSTALL_DEBUG} = xtrue ] ; then      if [ x${INSTALL_DEBUG} = xtrue ] ; then
# Line 59  Line 58 
58          for ext in tgz tar.gz tar.Z tz tar tar.bz2 ; do          for ext in tgz tar.gz tar.Z tz tar tar.bz2 ; do
59              try=$base.$ext              try=$base.$ext
60              vsay $this: Trying $try ...              vsay $this: Trying $try ...
61              if $getter $3/$try $ROOT/$try ; then              if "$getter" "$3"/"$try" "$ROOT"/"$try" ; then
62                  fetched=yes                  fetched=yes
63                  vsay $this: Fetching $try was a success.                  vsay $this: Fetching $try was a success.
64                  break 2         # get out of both for-loops                  break 2         # get out of both for-loops
65              else              else
66                  rm -f $ROOT/$try                  rm -f "$ROOT"/"$try"
67              fi              fi
68          done          done
69      done      done
# Line 77  Line 76 
76    
77  # wrapper for wget  # wrapper for wget
78  usewget() {  usewget() {
79      wget -nv -O $2 $1      wget -nv -O "$2" "$1"
80  }  }
81    
82  # wrapper for lynx  # wrapper for lynx
83  uselynx() {  uselynx() {
84      lynx -source $1 >$2      lynx -source "$1" >"$2"
85  }  }
86    
87  # wrapper for curl  # wrapper for curl
88  usecurl() {  usecurl() {
89      curl -s $1 >$2      curl -s "$1" >"$2"
90  }  }
91    
92  testurlgetter() {  testurlgetter() {
# Line 133  Line 132 
132  # wrapper for tar  # wrapper for tar
133  un_tar() {  un_tar() {
134      vsay "$this: Un-TAR-ing $1 archive."      vsay "$this: Un-TAR-ing $1 archive."
135      tar -xf $2      tar -xf "$2"
136  }  }
137    
138  # wrapper for zcat followed by tar  # wrapper for zcat followed by tar
139  un_tar_Z() {  un_tar_Z() {
140      vsay "$this: Un-COMPRESS-ing and un-TAR-ing $1 archive."      vsay "$this: Un-COMPRESS-ing and un-TAR-ing $1 archive."
141      zcat $2 | tar -xf -      zcat "$2" | tar -xf -
142  }  }
143    
144  # wrapper for gunzip followed by tar  # wrapper for gunzip followed by tar
145  un_tar_gz() {  un_tar_gz() {
146      vsay "$this: Un-GZIP-ing and un-TAR-ing $1 archive."      vsay "$this: Un-GZIP-ing and un-TAR-ing $1 archive."
147      gunzip -c $2 | tar -xf -      gunzip -c "$2" | tar -xf -
148  }  }
149    
150  # wrapper for bunzip2 followed by tar  # wrapper for bunzip2 followed by tar
151  un_tar_bz2() {  un_tar_bz2() {
152      vsay "$this: Un-BZIP2-ing and un-TAR-ing $1 archive."      vsay "$this: Un-BZIP2-ing and un-TAR-ing $1 archive."
153      bunzip2 -c $2 | tar -xf -      bunzip2 -c "$2" | tar -xf -
154  }  }
155    
156  # unarchive archive without and with version number attached  # unarchive archive without and with version number attached
157  unarchive() {  unarchive() {
158      # $1: descriptive string, $2: archive, $3: unpacker      # $1: descriptive string, $2: archive, $3: unpacker
159      if [ -r $ROOT/$2 ] ; then      if [ -r "$ROOT"/"$2" ] ; then
160          $3 "$1" $ROOT/$2          "$3" "$1" "$ROOT"/"$2"
161      elif [ -r $ROOT/$VERSION-$2 ]; then      elif [ -r "$ROOT"/"$VERSION"-"$2" ]; then
162          $3 "$1" $ROOT/$VERSION-$2          $3 "$1" "$ROOT"/"$VERSION"-"$2"
163      else      else
164          return 1          return 1
165      fi      fi
# Line 180  Line 179 
179  # no archive is found locally, it invokes $URLGETTER and tries again.  # no archive is found locally, it invokes $URLGETTER and tries again.
180  # The variable $tryfetch is used to make sure this happens only once.  # The variable $tryfetch is used to make sure this happens only once.
181  fetch_n_unpack() {  fetch_n_unpack() {
182      cd $2      cd "$2"
183      if unarchive "$1" $4.tgz un_tar_gz ||      if unarchive "$1" "$4".tgz un_tar_gz ||
184         unarchive "$1" $4.tar.gz un_tar_gz ||         unarchive "$1" "$4".tar.gz un_tar_gz ||
185         unarchive "$1" $4.tar.Z un_tar_Z ||         unarchive "$1" "$4".tar.Z un_tar_Z ||
186         unarchive "$1" $4.tar un_tar ||         unarchive "$1" "$4".tar un_tar ||
187         unarchive "$1" $4.tar.bz2 un_tar_bz2 ||         unarchive "$1" "$4".tar.bz2 un_tar_bz2 ||
188         unarchive "$1" $4.tz un_tar_Z         unarchive "$1" "$4".tz un_tar_Z
189      then      then
190          : we are done          : we are done
191      elif [ $tryfetch = yes ] ; then      elif [ $tryfetch = yes ] ; then
192          urlgetter          urlgetter
193          $URLGETTER "$1" $4 $SRCARCHIVEURL          $URLGETTER "$1" "$4" "$SRCARCHIVEURL"
194          tryfetch=no          tryfetch=no
195          fetch_n_unpack "$1" "$2" "$3" "$4"          fetch_n_unpack "$1" "$2" "$3" "$4"
196      fi      fi
# Line 202  Line 201 
201  #  #
202  unpack() {  unpack() {
203      tryfetch=yes      tryfetch=yes
204      if [ -d $2/$3 ]; then      if [ -d "$2"/"$3" ]; then
205          vsay "$this: The $1 tree already exists."          vsay "$this: The $1 tree already exists."
206      else      else
207          fetch_n_unpack "$1" "$2" "$3" "$4"          fetch_n_unpack "$1" "$2" "$3" "$4"
208      fi      fi
209      if [ ! -d $2/$3 ]; then      if [ ! -d "$2"/"$3" ]; then
210          echo "$this: !!! Unable to unpack $1 archive."          echo "$this: !!! Unable to unpack $1 archive."
211          exit 1          exit 1
212      fi      fi
# Line 219  Line 218 
218    
219  for i  for i
220  do  do
221      case $i in      case "$i" in
222        runtime)        runtime)
223          unpack run-time $ROOT/src runtime runtime          unpack run-time "$ROOT"/base runtime runtime
224          ;;          ;;
225        boot.*)        boot.*)
226          unpack bootfiles $ROOT sml.$i $i          unpack bootfiles "$ROOT" sml.$i $i
227          ;;          ;;
228        compiler)        compiler)
229          unpack compiler $ROOT/src compiler compiler          unpack compiler "$ROOT"/base compiler compiler
230          ;;          ;;
231        cm)        cm)
232          unpack compiler $ROOT/src cm cm          unpack compiler "$ROOT"/base cm cm
233          ;;          ;;
234        system)        system)
235          unpack compiler $ROOT/src system system          unpack compiler "$ROOT"/base system system
236          ;;          ;;
237        ml-yacc)        ml-yacc)
238          unpack ML-Yacc $ROOT/src ml-yacc ml-yacc          unpack ML-Yacc "$ROOT" ml-yacc ml-yacc
239          ;;          ;;
240        ml-lex)        ml-lex)
241          unpack ML-Lex $ROOT/src ml-lex ml-lex          unpack ML-Lex "$ROOT" ml-lex ml-lex
242            ;;
243          lexgen)
244            unpack LexGen "$ROOT" lexgen lexgen
245          ;;          ;;
246        ml-burg)        ml-burg)
247          unpack ML-Burg $ROOT/src ml-burg ml-burg          unpack ML-Burg "$ROOT" ml-burg ml-burg
248          ;;          ;;
249        ml-nlffigen)        ml-nlffigen)
250          unpack ML-NLFFI-Gen $ROOT/src ml-nlffigen ml-nlffigen          unpack ML-NLFFI-Gen "$ROOT" nlffi nlffi
251          ;;          ;;
252        nowhere)        nowhere)
253          unpack "MLRISC Tools Library" $SRCDIR MLRISC MLRISC          unpack "MLRISC Tools Library" "$ROOT" MLRISC MLRISC
254          ;;          ;;
255        smlnj-lib)        smlnj-lib)
256          unpack "SML/NJ Library" $SRCDIR smlnj-lib smlnj-lib          unpack "SML/NJ Library" "$ROOT" smlnj-lib smlnj-lib
257          ;;          ;;
258        cml)        cml)
259          unpack CML $SRCDIR cml cml          unpack CML "$ROOT" cml cml
260          ;;          ;;
261        cml-lib)        cml-lib)
262          unpack CML $SRCDIR cml cml          unpack CML "$ROOT" cml cml
263          ;;          ;;
264        eXene)        eXene)
265          unpack EXene $SRCDIR eXene eXene          unpack EXene "$ROOT" eXene eXene
266          ;;          ;;
267        ckit)        ckit)
268          unpack "C-Kit" $ROOT ckit ckit          unpack "C-Kit" "$ROOT" ckit ckit
269          ;;          ;;
270        ml-nlffi-lib)        ml-nlffi-lib)
271          unpack "NLFFI Library" $SRCDIR ml-nlffi-lib ml-nlffi-lib          unpack "NLFFI Library" "$ROOT" nlffi nlffi
272          ;;          ;;
273        pgraph-util)        pgraph-util)
274          unpack "CM source code" $SRCDIR cm cm          unpack "CM source code" "$ROOT" pgraph pgraph
275            ;;
276          tdp-util)
277            unpack "Trace/Debug/Profile code" "$ROOT" trace-debug-profile trace-debug-profile
278          ;;          ;;
279        mlrisc)        mlrisc)
280          unpack "MLRISC Library" $SRCDIR MLRISC MLRISC          unpack "MLRISC Library" "$ROOT" MLRISC MLRISC
281          ;;          ;;
282        mlrisc-tools)        mlrisc-tools)
283          unpack "MLRISC Tools Library" $SRCDIR MLRISC MLRISC          unpack "MLRISC Tools Library" "$ROOT" MLRISC MLRISC
284          ;;          ;;
285        smlnj-c)        smlnj-c)
286          unpack "SML/NJ-C FFI" $SRCDIR smlnj-c smlnj-c          unpack "SML/NJ-C FFI" "$ROOT" smlnj-c smlnj-c
287            ;;
288          heap2asm)
289            unpack "Heap->ASM tool" "$ROOT" heap2asm heap2asm
290            ;;
291          tools)
292            unpack "debugging tools" "$ROOT"/base tools tools
293          ;;          ;;
294        doc)        doc)
295          echo Package doc is currently unavailable.          echo Package doc is currently unavailable.
# Line 288  Line 299 
299          ;;          ;;
300        *)        *)
301          echo Unknown package: ${i}.          echo Unknown package: ${i}.
302          exit 1          echo Trying default method...
303            unpack ${i} "$ROOT" ${i} ${i}
304          ;;          ;;
305      esac      esac
306  done  done

Legend:
Removed from v.1485  
changed lines
  Added in v.2180

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