122 |
# $3 - remote directory |
# $3 - remote directory |
123 |
# |
# |
124 |
askurl() { |
askurl() { |
125 |
echo $this: Please, fetch $1 archive '('$VERSION-$2.'*)' from |
echo "$this: Please, fetch $1 archive" |
126 |
echo ' ' $3 |
echo ' ('$2.'*' or $VERSION-$2.'*)' |
127 |
|
echo " from $3" |
128 |
echo "and then re-run this script!" |
echo "and then re-run this script!" |
129 |
exit 1 |
exit 1 |
130 |
} |
} |
133 |
# Function for fetching source archives automatically using wget or lynx. |
# Function for fetching source archives automatically using wget or lynx. |
134 |
# $1 - command to actually get the stuff |
# $1 - command to actually get the stuff |
135 |
# $2 - descriptive name |
# $2 - descriptive name |
136 |
# $3 - base name without extension, without version, and without dir |
# $3 - base name without extension and without dir |
137 |
# $4 - remote directory |
# $4 - remote directory |
138 |
# |
# |
139 |
fetchurl() { |
fetchurl() { |
140 |
getter=$1 ; shift |
getter=$1 ; shift |
141 |
echo $this: Fetching $1 from $3. Please stand by... |
echo $this: Fetching $1 from $3. Please stand by... |
142 |
fetched=no |
fetched=no |
143 |
for ext in tgz tar.gz tar.Z tz tar tar.bz2 ; do |
for base in $2 $VERSION-$2 ; do |
144 |
try=$VERSION-$2.$ext |
for ext in tar.gz tgz tar.Z tz tar tar.bz2 ; do |
145 |
|
try=$base.$ext |
146 |
echo $this: Trying $try ... |
echo $this: Trying $try ... |
147 |
if $getter $3 $try $ROOT/$try ; then |
if $getter $3 $try $ROOT/$try ; then |
148 |
fetched=yes |
fetched=yes |
149 |
echo $this: Fetching $try was a success. |
echo $this: Fetching $try was a success. |
150 |
break |
break 2 # get out of both for-loops |
151 |
else |
else |
152 |
rm -f $ROOT/$try |
rm -f $ROOT/$try |
153 |
fi |
fi |
154 |
done |
done |
155 |
|
done |
156 |
if [ $fetched = no ] ; then |
if [ $fetched = no ] ; then |
157 |
echo $this: Fetching $try was no success. |
echo $this: Fetching $try was no success. |
158 |
echo ' ' You should try to do it manually now. |
echo ' ' You should try to do it manually now. |
188 |
fi |
fi |
189 |
} |
} |
190 |
|
|
191 |
|
un_tar() { |
192 |
|
echo "$this: Un-TAR-ing $1 archive." |
193 |
|
tar -xf $2 |
194 |
|
} |
195 |
|
|
196 |
|
un_tar_Z() { |
197 |
|
echo "$this: Un-COMPRESS-ing and un-TAR-ing $1 archive." |
198 |
|
zcat $2 | tar -xf - |
199 |
|
} |
200 |
|
|
201 |
|
un_tar_gz() { |
202 |
|
echo "$this: Un-GZIP-ing and un-TAR-ing $1 archive." |
203 |
|
gunzip -c $2 | tar -xf - |
204 |
|
} |
205 |
|
|
206 |
|
un_tar_bz2() { |
207 |
|
echo "$this: Un-BZIP2-ing and un-TAR-ing $1 archive." |
208 |
|
bunzip2 -c $2 | tar -xf - |
209 |
|
} |
210 |
|
|
211 |
|
unarchive() { |
212 |
|
# $1: descriptive string, $2: archive, $3: unpacker |
213 |
|
if [ -r $ROOT/$2 ] ; then |
214 |
|
$3 "$1" $ROOT/$2 |
215 |
|
elif [ -r $ROOT/$VERSION-$2 ]; then |
216 |
|
$3 "$1" $ROOT/$VERSION-$2 |
217 |
|
else |
218 |
|
return 1 |
219 |
|
fi |
220 |
|
} |
221 |
|
|
222 |
# |
# |
223 |
# Function to unpack a source archive. |
# Function to unpack a source archive. |
224 |
# |
# |
233 |
# no archive is found locally, it invokes $URLGETTER and tries again. |
# no archive is found locally, it invokes $URLGETTER and tries again. |
234 |
# The variable $tryfetch is used to make sure this happens only once. |
# The variable $tryfetch is used to make sure this happens only once. |
235 |
fetch_n_unpack() { |
fetch_n_unpack() { |
|
larc=$ROOT/$VERSION-$4 |
|
236 |
cd $2 |
cd $2 |
237 |
if [ -r $larc.tar.Z ] ; then |
if unarchive "$1" $4.tar.gz un_tar_gz || |
238 |
echo "$this: Un-COMPRESS-ing and un-TAR-ing $1 archive." |
unarchive "$1" $4.tgz un_tar_gz || |
239 |
zcat $larc.tar.Z | tar -xf - |
unarchive "$1" $4.tar.Z un_tar_Z || |
240 |
elif [ -r $larc.tar ] ; then |
unarchive "$1" $4.tar un_tar || |
241 |
echo "$this: Un-TAR-ing $1 archive." |
unarchive "$1" $4.tar.bz1 un_tar_bz2 || |
242 |
tar -xf $larc.tar |
unarchive "$1" $4.tz un_tar_Z |
243 |
elif [ -r $larc.tar.gz ] ; then |
then |
244 |
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 - |
|
245 |
elif [ $tryfetch = yes ] ; then |
elif [ $tryfetch = yes ] ; then |
246 |
urlgetter |
urlgetter |
247 |
$URLGETTER "$1" $4 $SRCARCHIVEURL |
$URLGETTER "$1" $4 $SRCARCHIVEURL |
489 |
# |
# |
490 |
# the name of the bin files directory |
# the name of the bin files directory |
491 |
# |
# |
492 |
BOOT_FILES=sml.boot.$ARCH-unix |
BOOT_ARCHIVE=boot.$ARCH-unix |
493 |
|
BOOT_FILES=sml.$BOOT_ARCHIVE |
494 |
|
|
495 |
# |
# |
496 |
# build the run-time system |
# build the run-time system |
518 |
if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then |
if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then |
519 |
echo $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists. |
echo $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists. |
520 |
else |
else |
521 |
unpack bin $ROOT $BOOT_FILES $BOOT_FILES |
unpack bin $ROOT $BOOT_FILES $BOOT_ARCHIVE |
522 |
cd $ROOT/$BOOT_FILES |
cd $ROOT/$BOOT_FILES |
523 |
if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC |
if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC |
524 |
then |
then |
557 |
# |
# |
558 |
cd $ROOT |
cd $ROOT |
559 |
rm -f $LOCALPATHCONFIG $LIBLIST |
rm -f $LOCALPATHCONFIG $LIBLIST |
560 |
echo 'OS.Process.exit (if true' >$LIBLIST |
echo 'ignore (OS.Process.exit (if true' >$LIBLIST |
561 |
|
|
562 |
# |
# |
563 |
# now build (or prepare to build) the individual targets |
# now build (or prepare to build) the individual targets |
635 |
# |
# |
636 |
|
|
637 |
echo $this: Compiling library code. |
echo $this: Compiling library code. |
638 |
echo 'then OS.Process.success else OS.Process.failure);' >>$LIBLIST |
echo 'then OS.Process.success else OS.Process.failure));' >>$LIBLIST |
639 |
if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then |
if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then |
640 |
echo $this: Libraries compiled successfully. |
echo $this: Libraries compiled successfully. |
641 |
else |
else |