9 |
# by M.Blume (2/2000). |
# by M.Blume (2/2000). |
10 |
# |
# |
11 |
|
|
12 |
|
this=$0 |
13 |
|
|
14 |
# |
# |
15 |
# get the target list |
# get the target list |
16 |
# |
# |
17 |
if [ ! -r config/targets ]; then |
if [ ! -r config/targets ]; then |
18 |
echo "!!! File config/targets is missing." |
echo "$this: !!! File config/targets is missing." |
19 |
exit 1 |
exit 1 |
20 |
fi |
fi |
21 |
. config/targets |
. config/targets |
24 |
# create the preloads.standard file |
# create the preloads.standard file |
25 |
# |
# |
26 |
if [ ! -r config/preloads ]; then |
if [ ! -r config/preloads ]; then |
27 |
echo "!!! File config/preloads is missing." |
echo "$this: !!! File config/preloads is missing." |
28 |
exit 1 |
exit 1 |
29 |
fi |
fi |
30 |
cp config/preloads preloads.standard |
cp config/preloads preloads.standard |
36 |
MAKE=make |
MAKE=make |
37 |
|
|
38 |
SHELL=/bin/sh |
SHELL=/bin/sh |
39 |
echo Using shell $SHELL. |
echo $this: Using shell $SHELL. |
40 |
|
|
41 |
# |
# |
42 |
# set the SML root directory |
# set the SML root directory |
43 |
# |
# |
44 |
REAL_PWD=`pwd` |
REAL_PWD=`pwd` |
45 |
ROOT=${PWD:-$REAL_PWD} |
ROOT=${PWD:-$REAL_PWD} |
46 |
echo SML root is $ROOT. |
echo $this: SML root is $ROOT. |
47 |
echo Installation directory is ${INSTALLDIR:=$ROOT}. |
echo $this: Installation directory is ${INSTALLDIR:=$ROOT}. |
48 |
|
|
49 |
# |
# |
50 |
# set the various directory and file pathname variables |
# set the various directory and file pathname variables |
92 |
# the release version that we are installing |
# the release version that we are installing |
93 |
# |
# |
94 |
VERSION=`cat $CONFIGDIR/version` |
VERSION=`cat $CONFIGDIR/version` |
95 |
echo Installing version $VERSION. |
echo $this: Installing version $VERSION. |
96 |
|
|
97 |
# |
# |
98 |
# the URL for the (usually remote) source archive |
# the URL for the (usually remote) source archive |
99 |
# |
# |
100 |
SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl` |
SRCARCHIVEURL=`cat $CONFIGDIR/srcarchiveurl` |
101 |
echo URL of source archive is $SRCARCHIVEURL. |
echo $this: URL of source archive is $SRCARCHIVEURL. |
102 |
|
|
103 |
# |
# |
104 |
# Function to make a directory (and advertise such action). |
# Function to make a directory (and advertise such action). |
105 |
# |
# |
106 |
makedir() { |
makedir() { |
107 |
if [ ! -d $1 ] ; then |
if [ ! -d $1 ] ; then |
108 |
echo Making directory $1 |
echo $this: Making directory $1 |
109 |
if mkdir $1 ; then |
if mkdir $1 ; then |
110 |
: everything is fine |
: everything is fine |
111 |
else |
else |
112 |
echo "!!! Unable to make directory $1!" |
echo "$this: !!! Unable to make directory $1!" |
113 |
exit 1 |
exit 1 |
114 |
fi |
fi |
115 |
fi |
fi |
122 |
# $3 - remote directory |
# $3 - remote directory |
123 |
# |
# |
124 |
askurl() { |
askurl() { |
125 |
echo Please, fetch $1 archive '('$VERSION-$2.'*)' from |
echo $this: Please, fetch $1 archive '('$VERSION-$2.'*)' from |
126 |
echo ' ' $3 |
echo ' ' $3 |
127 |
echo "and then re-run this script!" |
echo "and then re-run this script!" |
128 |
exit 1 |
exit 1 |
137 |
# |
# |
138 |
fetchurl() { |
fetchurl() { |
139 |
getter=$1 ; shift |
getter=$1 ; shift |
140 |
echo Fetching $1 from $2. Please stand by... |
echo $this: Fetching $1 from $2. Please stand by... |
141 |
fetched=no |
fetched=no |
142 |
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 |
143 |
try=$VERSION-$2.$ext |
try=$VERSION-$2.$ext |
144 |
echo Trying $try ... |
echo $this: Trying $try ... |
145 |
if $getter $3 $try $ROOT/$try ; then |
if $getter $3 $try $ROOT/$try ; then |
146 |
fetched=yes |
fetched=yes |
147 |
echo Success. |
echo $this: Fetching $try was a success. |
148 |
break |
break |
149 |
else |
else |
150 |
rm -f $ROOT/$try |
rm -f $ROOT/$try |
151 |
fi |
fi |
152 |
done |
done |
153 |
if [ $fetched = no ] ; then |
if [ $fetched = no ] ; then |
154 |
echo No success. You should try to do it manually now. |
echo $this: Fetching $try was no success. |
155 |
|
echo ' ' You should try to do it manually now. |
156 |
askurl "$1" "$2" "$3" |
askurl "$1" "$2" "$3" |
157 |
fi |
fi |
158 |
} |
} |
202 |
larc=$ROOT/$VERSION-$4 |
larc=$ROOT/$VERSION-$4 |
203 |
cd $2 |
cd $2 |
204 |
if [ -r $larc.tar.Z ] ; then |
if [ -r $larc.tar.Z ] ; then |
205 |
echo "Un-compress-ing and un-tar-ing $1 archive." |
echo "$this: Un-compress-ing and un-tar-ing $1 archive." |
206 |
zcat $larc.tar.Z | tar -xf - |
zcat $larc.tar.Z | tar -xf - |
207 |
elif [ -r $larc.tar ] ; then |
elif [ -r $larc.tar ] ; then |
208 |
echo "Un-tar-ing $1 archive." |
echo "$this: Un-tar-ing $1 archive." |
209 |
tar -xf $larc.tar |
tar -xf $larc.tar |
210 |
elif [ -r $larc.tar.gz ] ; then |
elif [ -r $larc.tar.gz ] ; then |
211 |
echo "Un-gzip-ing and un-tar-ing $1 archive." |
echo "$this: Un-gzip-ing and un-tar-ing $1 archive." |
212 |
gunzip -c $larc.tar.gz | tar -xf - |
gunzip -c $larc.tar.gz | tar -xf - |
213 |
elif [ -r $larc.tar.bz2 ] ; then |
elif [ -r $larc.tar.bz2 ] ; then |
214 |
echo "Un-bzip2-ing and un-tar-ing $1 archive." |
echo "$this: Un-bzip2-ing and un-tar-ing $1 archive." |
215 |
bunzip2 -c $larc.tar.bz2 | tar -xf - |
bunzip2 -c $larc.tar.bz2 | tar -xf - |
216 |
elif [ -r $larc.tgz ] ; then |
elif [ -r $larc.tgz ] ; then |
217 |
echo "Un-gzip-ing and un-tar-ing $1 archive." |
echo "$this: Un-gzip-ing and un-tar-ing $1 archive." |
218 |
gunzip -c $larc.tgz | tar -xf - |
gunzip -c $larc.tgz | tar -xf - |
219 |
elif [ -r $larc.tz ] ; then |
elif [ -r $larc.tz ] ; then |
220 |
echo "Un-compress-ing and un-tar-ing $1 archive." |
echo "$this: Un-compress-ing and un-tar-ing $1 archive." |
221 |
zcat $larc.tz | tar -xf - |
zcat $larc.tz | tar -xf - |
222 |
elif [ $tryfetch = yes ] ; then |
elif [ $tryfetch = yes ] ; then |
223 |
urlgetter |
urlgetter |
233 |
unpack() { |
unpack() { |
234 |
tryfetch=yes |
tryfetch=yes |
235 |
if [ -d $2/$3 ]; then |
if [ -d $2/$3 ]; then |
236 |
echo "The $1 tree already exists." |
echo "$this: The $1 tree already exists." |
237 |
else |
else |
238 |
fetch_n_unpack "$1" "$2" "$3" "$4" |
fetch_n_unpack "$1" "$2" "$3" "$4" |
239 |
fi |
fi |
240 |
if [ ! -d $2/$3 ]; then |
if [ ! -d $2/$3 ]; then |
241 |
echo "!!! Unable to unpack $1 archive." |
echo "$this: !!! Unable to unpack $1 archive." |
242 |
exit 1 |
exit 1 |
243 |
fi |
fi |
244 |
} |
} |
251 |
if [ -d $1 ] ; then |
if [ -d $1 ] ; then |
252 |
if [ ! -d $2 ] ; then |
if [ ! -d $2 ] ; then |
253 |
if [ -f $2 ] ; then |
if [ -f $2 ] ; then |
254 |
echo install.sh: $2 exists as a non-directory. |
echo $this: $2 exists as a non-directory. |
255 |
exit 1 |
exit 1 |
256 |
fi |
fi |
257 |
mkdir $2 |
mkdir $2 |
283 |
case $lib in |
case $lib in |
284 |
*.cm | *.cmi) |
*.cm | *.cmi) |
285 |
if [ $lib != $2 ] ; then |
if [ $lib != $2 ] ; then |
286 |
echo "! Warning:" $lib specified relative to $2 |
echo "$this: Warning:" $lib specified relative to $2 |
287 |
fi |
fi |
288 |
echo Moving library $lib to $LIBDIR |
echo $this: Moving library $lib to $LIBDIR |
289 |
makedir $LIBDIR/$2 |
makedir $LIBDIR/$2 |
290 |
makedir $LIBDIR/$2/CM |
makedir $LIBDIR/$2/CM |
291 |
makedir $LIBDIR/$2/CM/$ARCH-unix |
makedir $LIBDIR/$2/CM/$ARCH-unix |
315 |
FINALLOCATION=$SRCDIR/$2 |
FINALLOCATION=$SRCDIR/$2 |
316 |
fi |
fi |
317 |
if [ -d $FINALLOCATION/CM/$ARCH-unix ] ; then |
if [ -d $FINALLOCATION/CM/$ARCH-unix ] ; then |
318 |
echo "Library $1 already exists in $FINALLOCATION." |
echo "$this: Library $1 already exists in $FINALLOCATION." |
319 |
else |
else |
320 |
echo "Scheduling library $1 to be built in $FINALLOCATION." |
echo "$this: Scheduling library $1 to be built in $FINALLOCATION." |
321 |
echo "andalso CM.stabilize false \"$1\"" >>$LIBLIST |
echo "andalso CM.stabilize false \"$1\"" >>$LIBLIST |
322 |
echo $1 $SRCDIR/$2 >>$LOCALPATHCONFIG |
echo $1 $SRCDIR/$2 >>$LOCALPATHCONFIG |
323 |
if [ x$MOVE_LIBRARIES = xtrue ] ; then |
if [ x$MOVE_LIBRARIES = xtrue ] ; then |
344 |
TARGETLOC=$TARGET |
TARGETLOC=$TARGET |
345 |
fi |
fi |
346 |
if [ -r $HEAPDIR/$TARGET ] ; then |
if [ -r $HEAPDIR/$TARGET ] ; then |
347 |
echo Target $TARGET already exists. |
echo $this: Target $TARGET already exists. |
348 |
else |
else |
349 |
echo Building $TARGET. |
echo $this: Building $TARGET. |
350 |
unpack $2 $SRCDIR $1 $1 |
unpack $2 $SRCDIR $1 $1 |
351 |
cd $SRCDIR/$1 |
cd $SRCDIR/$1 |
352 |
./build |
./build |
357 |
ln -s .run-sml $1 |
ln -s .run-sml $1 |
358 |
fi |
fi |
359 |
else |
else |
360 |
echo "!!! Build of $TARGET failed." |
echo "$this: !!! Build of $TARGET failed." |
361 |
fi |
fi |
362 |
fi |
fi |
363 |
} |
} |
374 |
# install the script that tests the architecture, and make sure that it works |
# install the script that tests the architecture, and make sure that it works |
375 |
# |
# |
376 |
if [ -x $BINDIR/.arch-n-opsys ]; then |
if [ -x $BINDIR/.arch-n-opsys ]; then |
377 |
echo Script $BINDIR/.arch-n-opsys already exists. |
echo $this: Script $BINDIR/.arch-n-opsys already exists. |
378 |
else |
else |
379 |
cat $CONFIGDIR/_arch-n-opsys \ |
cat $CONFIGDIR/_arch-n-opsys \ |
380 |
| sed -e "s,@SHELL@,$SHELL,g" > $BINDIR/.arch-n-opsys |
| sed -e "s,@SHELL@,$SHELL,g" > $BINDIR/.arch-n-opsys |
381 |
chmod 555 $BINDIR/.arch-n-opsys |
chmod 555 $BINDIR/.arch-n-opsys |
382 |
if [ ! -x $BINDIR/.arch-n-opsys ]; then |
if [ ! -x $BINDIR/.arch-n-opsys ]; then |
383 |
echo "!!! Installation of $BINDIR/.arch-n-opsys failed." |
echo "$this: !!! Installation of $BINDIR/.arch-n-opsys failed." |
384 |
exit 1 |
exit 1 |
385 |
fi |
fi |
386 |
fi |
fi |
387 |
|
|
388 |
ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys` |
ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys` |
389 |
if [ "$?" != "0" ]; then |
if [ "$?" != "0" ]; then |
390 |
echo "!!! Script $BINDIR/.arch-n-opsys fails on this machine." |
echo "$this: !!! Script $BINDIR/.arch-n-opsys fails on this machine." |
391 |
echo "!!! You must patch this by hand and repeat the installation." |
echo "$this: !!! You must patch this by hand and repeat the installation." |
392 |
exit 2 |
exit 2 |
393 |
else |
else |
394 |
echo Script $BINDIR/.arch-n-opsys reports $ARCH_N_OPSYS. |
echo $this: Script $BINDIR/.arch-n-opsys reports $ARCH_N_OPSYS. |
395 |
fi |
fi |
396 |
eval $ARCH_N_OPSYS |
eval $ARCH_N_OPSYS |
397 |
|
|
407 |
# for an outdated driver script, but not all "test" commands understand |
# for an outdated driver script, but not all "test" commands understand |
408 |
# the -nt comparison operator....) |
# the -nt comparison operator....) |
409 |
# if [ -x $BINDIR/$ddst ]; then |
# if [ -x $BINDIR/$ddst ]; then |
410 |
# echo Script $BINDIR/$ddst already exists. |
# echo $this: Script $BINDIR/$ddst already exists. |
411 |
# else |
# else |
412 |
rm -f $BINDIR/$ddst |
rm -f $BINDIR/$ddst |
413 |
cat $CONFIGDIR/$dsrc | \ |
cat $CONFIGDIR/$dsrc | \ |
417 |
> $BINDIR/$ddst |
> $BINDIR/$ddst |
418 |
chmod 555 $BINDIR/$ddst |
chmod 555 $BINDIR/$ddst |
419 |
if [ ! -x $BINDIR/$ddst ]; then |
if [ ! -x $BINDIR/$ddst ]; then |
420 |
echo "!!! Installation of $BINDIR/${ddst} failed." |
echo "$this: !!! Installation of $BINDIR/${ddst} failed." |
421 |
exit 1 |
exit 1 |
422 |
fi |
fi |
423 |
# fi |
# fi |
452 |
linux) |
linux) |
453 |
EXTRA_DEFS=`$CONFIGDIR/chk-global-names.sh` |
EXTRA_DEFS=`$CONFIGDIR/chk-global-names.sh` |
454 |
if [ "$?" != "0" ]; then |
if [ "$?" != "0" ]; then |
455 |
echo "!!! Problems checking for underscores in global names." |
echo "$this: !!! Problems checking for underscores in asm names." |
456 |
exit 1 |
exit 1 |
457 |
fi |
fi |
458 |
EXTRA_DEFS="XDEFS=$EXTRA_DEFS" |
EXTRA_DEFS="XDEFS=$EXTRA_DEFS" |
469 |
# |
# |
470 |
unpack "run-time" $SRCDIR runtime runtime |
unpack "run-time" $SRCDIR runtime runtime |
471 |
if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then |
if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then |
472 |
echo Run-time system already exists. |
echo $this: Run-time system already exists. |
473 |
else |
else |
474 |
cd $SRCDIR/runtime/objs |
cd $SRCDIR/runtime/objs |
475 |
echo Compiling the run-time system. |
echo $this: Compiling the run-time system. |
476 |
$MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS |
$MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS |
477 |
if [ -x run.$ARCH-$OPSYS ]; then |
if [ -x run.$ARCH-$OPSYS ]; then |
478 |
mv run.$ARCH-$OPSYS $RUNDIR |
mv run.$ARCH-$OPSYS $RUNDIR |
479 |
# $MAKE MAKE=$MAKE clean |
# $MAKE MAKE=$MAKE clean |
480 |
else |
else |
481 |
echo "!!! Run-time system build failed for some reason." |
echo "$this: !!! Run-time system build failed for some reason." |
482 |
exit 1 |
exit 1 |
483 |
fi |
fi |
484 |
fi |
fi |
488 |
# boot the base SML system |
# boot the base SML system |
489 |
# |
# |
490 |
if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then |
if [ -r $HEAPDIR/sml.$HEAP_SUFFIX ]; then |
491 |
echo Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists. |
echo $this: Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists. |
492 |
else |
else |
493 |
unpack bin $ROOT $BOOT_FILES $BOOT_FILES |
unpack bin $ROOT $BOOT_FILES $BOOT_FILES |
494 |
cd $ROOT/$BOOT_FILES |
cd $ROOT/$BOOT_FILES |
515 |
rm -rf $BOOT_FILES |
rm -rf $BOOT_FILES |
516 |
|
|
517 |
else |
else |
518 |
echo "!!! Boot code did not produce heap image (sml.$HEAP_SUFFIX)." |
echo "$this !!! No heap image generated (sml.$HEAP_SUFFIX)." |
519 |
exit 1 |
exit 1 |
520 |
fi |
fi |
521 |
else |
else |
522 |
echo "!!! Boot code failed, no heap image built (sml.$HEAP_SUFFIX)." |
echo "$this !!! Boot code failed, no heap image (sml.$HEAP_SUFFIX)." |
523 |
exit 1 |
exit 1 |
524 |
fi |
fi |
525 |
fi |
fi |
535 |
# now build (or prepare to build) the individual targets |
# now build (or prepare to build) the individual targets |
536 |
# |
# |
537 |
cd $SRCDIR |
cd $SRCDIR |
538 |
echo Installing other targets. |
echo $this: Installing other targets. |
539 |
for i in $TARGETS ; do |
for i in $TARGETS ; do |
540 |
case $i in |
case $i in |
541 |
src-smlnj) |
src-smlnj) |
595 |
build $ROOT |
build $ROOT |
596 |
;; |
;; |
597 |
*) |
*) |
598 |
echo "!!! Unknown target $i." |
echo "$this: !!! Unknown target $i." |
599 |
;; |
;; |
600 |
esac |
esac |
601 |
done |
done |
606 |
# $SRCDIR, so we must consult $LOCALPATHCONFIG. |
# $SRCDIR, so we must consult $LOCALPATHCONFIG. |
607 |
# |
# |
608 |
|
|
609 |
echo Compiling library code. |
echo $this: Compiling library code. |
610 |
echo 'then OS.Process.success else OS.Process.failure);' >>$LIBLIST |
echo 'then OS.Process.success else OS.Process.failure);' >>$LIBLIST |
611 |
if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then |
if CM_LOCAL_PATHCONFIG=$LOCALPATHCONFIG $BINDIR/sml <$LIBLIST ; then |
612 |
echo Libraries compiled successfully. |
echo $this: Libraries compiled successfully. |
613 |
else |
else |
614 |
echo "!!! Something went wrong when compiling the libraries." |
echo "$this: !!! Something went wrong when compiling the libraries." |
615 |
exit 1 |
exit 1 |
616 |
fi |
fi |
617 |
|
|
620 |
# |
# |
621 |
|
|
622 |
if [ -r $LIBMOVESCRIPT ] ; then |
if [ -r $LIBMOVESCRIPT ] ; then |
623 |
echo Moving libraries to $LIBDIR. |
echo $this: Moving libraries to $LIBDIR. |
624 |
. $LIBMOVESCRIPT |
. $LIBMOVESCRIPT |
625 |
fi |
fi |
626 |
|
|