2 |
# |
# |
3 |
# Copyright (c) 1994 AT&T Bell Laboratories. |
# Copyright (c) 1994 AT&T Bell Laboratories. |
4 |
# |
# |
5 |
# installation script for SML/NJ and related tools; this is a temporary |
# Installation script for SML/NJ and related tools; this is a temporary |
6 |
# placeholder until the configuration tool is finished. |
# placeholder until the configuration tool is finished. |
7 |
# |
# |
8 |
|
# Significant changes to accommodate (and take advantage of) the new CM |
9 |
#set -x |
# by M.Blume (2/2000). |
10 |
|
# |
11 |
|
|
12 |
# |
# |
13 |
# get the target list |
# get the target list |
28 |
cp config/preloads preloads.standard |
cp config/preloads preloads.standard |
29 |
|
|
30 |
# |
# |
31 |
# some OSs have make in strange places |
# Some OSs have make in strange places, but most of the time it is |
32 |
|
# simply on the PATH: |
33 |
# |
# |
34 |
MAKE=make |
MAKE=make |
35 |
|
|
|
# |
|
|
# check for ksh |
|
|
# |
|
|
# ksh causes some people problems so we will always use /bin/sh |
|
|
# |
|
|
#echo "checking for ksh" |
|
|
#if [ -x /bin/ksh ]; then |
|
|
# SHELL=/bin/ksh |
|
|
#elif [ -x /usr/local/bin/ksh ]; then |
|
|
# SHELL=/usr/local/bin/ksh |
|
|
#else |
|
36 |
SHELL=/bin/sh |
SHELL=/bin/sh |
|
#fi |
|
37 |
echo Using shell $SHELL. |
echo Using shell $SHELL. |
38 |
|
|
39 |
# |
# |
58 |
LOCALPATHCONFIG=$INSTALLDIR/pathconfig # a temporary pathconfig file |
LOCALPATHCONFIG=$INSTALLDIR/pathconfig # a temporary pathconfig file |
59 |
|
|
60 |
# |
# |
61 |
# the paths to ml-yacc, ml-burg, and ml-lex; needed to configure CM |
# the path to the dir where ml-yacc, ml-burg, ml-lex, and ml-build live |
62 |
# |
# |
63 |
YACCPATH=$BINDIR/ml-yacc |
TOOLDIR=$BINDIR |
|
LEXPATH=$BINDIR/ml-lex |
|
|
BURGPATH=$BINDIR/ml-burg |
|
64 |
|
|
65 |
# |
# |
66 |
# set the CM configuration variables (these are environment variables |
# set the CM configuration variables (these are environment variables |
67 |
# that will be queried by the bootstrap code) |
# that will be queried by the bootstrap code) |
68 |
# Especially important is CM_PATHCONFIG_DEFAULT. |
# Especially important is CM_PATHCONFIG_DEFAULT. |
69 |
# |
# |
|
CM_YACC_DEFAULT=$YACCPATH |
|
|
CM_LEX_DEFAULT=$LEXPATH |
|
|
CM_BURG_DEFAULT=$BURGPATH |
|
70 |
CM_PATHCONFIG_DEFAULT=$LIBDIR/pathconfig |
CM_PATHCONFIG_DEFAULT=$LIBDIR/pathconfig |
71 |
export CM_YACC_DEFAULT CM_LEX_DEFAULT CM_BURG_DEFAULT CM_PATHCONFIG_DEFAULT |
export CM_PATHCONFIG_DEFAULT |
72 |
|
|
73 |
# |
# |
74 |
# the release version that we are installing |
# the release version that we are installing |
101 |
# different suffixes to determine what kind of de-compression is to |
# different suffixes to determine what kind of de-compression is to |
102 |
# be used) |
# be used) |
103 |
unpack() { |
unpack() { |
104 |
if [ ! -d $2/$3 ]; then |
if [ -d $2/$3 ]; then |
105 |
echo Unpacking $1 source files. |
echo "The $1 source tree already exists." |
106 |
|
else |
107 |
|
echo "Unpacking $1 source archive." |
108 |
cd $2 |
cd $2 |
109 |
if [ -r $4.tar.Z ] ; then |
if [ -r $4.tar.Z ] ; then |
110 |
zcat $4.tar.Z | tar -xf - |
zcat $4.tar.Z | tar -xf - |
119 |
elif [ -r $4.tz ] ; then |
elif [ -r $4.tz ] ; then |
120 |
zcat $4.tz | tar -xf - |
zcat $4.tz | tar -xf - |
121 |
else |
else |
122 |
echo "!!! The $1 source files are missing." |
echo "!!! The $1 source archive is missing." |
123 |
exit 1 |
exit 1 |
124 |
fi |
fi |
125 |
if [ ! -d $2/$3 ]; then |
if [ ! -d $2/$3 ]; then |
126 |
echo "!!! Unable to unpack $1 source files." |
echo "!!! Unable to unpack $1 source archive." |
127 |
exit 1 |
exit 1 |
128 |
fi |
fi |
129 |
fi |
fi |
143 |
movelibs() { |
movelibs() { |
144 |
for lib in `/bin/ls $1/CM/$ARCH-unix` ; do |
for lib in `/bin/ls $1/CM/$ARCH-unix` ; do |
145 |
case $lib in |
case $lib in |
146 |
*.cm) |
*.cm | *.cmi) |
147 |
if [ $lib != $2 ] ; then |
if [ $lib != $2 ] ; then |
148 |
echo "! Warning:" $lib specified relative to $2 |
echo "! Warning:" $lib specified relative to $2 |
149 |
fi |
fi |
232 |
makedir $dir |
makedir $dir |
233 |
done |
done |
234 |
|
|
|
|
|
235 |
# |
# |
236 |
# 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 |
237 |
# |
# |
238 |
if [ -x $BINDIR/.arch-n-opsys ]; then |
if [ -x $BINDIR/.arch-n-opsys ]; then |
239 |
echo Script $BINDIR/.arch-n-opsys already exists. |
echo Script $BINDIR/.arch-n-opsys already exists. |
240 |
else |
else |
241 |
cat $CONFIGDIR/_arch-n-opsys | sed -e "s,@SHELL@,$SHELL,g" > $BINDIR/.arch-n-opsys |
cat $CONFIGDIR/_arch-n-opsys \ |
242 |
|
| sed -e "s,@SHELL@,$SHELL,g" > $BINDIR/.arch-n-opsys |
243 |
chmod 555 $BINDIR/.arch-n-opsys |
chmod 555 $BINDIR/.arch-n-opsys |
244 |
if [ ! -x $BINDIR/.arch-n-opsys ]; then |
if [ ! -x $BINDIR/.arch-n-opsys ]; then |
245 |
echo "!!! Installation of $BINDIR/.arch-n-opsys failed for some reason." |
echo "!!! Installation of $BINDIR/.arch-n-opsys failed." |
246 |
exit 1 |
exit 1 |
247 |
fi |
fi |
248 |
fi |
fi |
249 |
|
|
250 |
ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys` |
ARCH_N_OPSYS=`$BINDIR/.arch-n-opsys` |
251 |
if [ "$?" != "0" ]; then |
if [ "$?" != "0" ]; then |
252 |
echo "!!! Script $BINDIR/.arch-n-opsys fails on this machine." |
echo "!!! Script $BINDIR/.arch-n-opsys fails on this machine." |
257 |
fi |
fi |
258 |
eval $ARCH_N_OPSYS |
eval $ARCH_N_OPSYS |
259 |
|
|
260 |
if [ -x $BINDIR/.run-sml ]; then |
# |
261 |
echo Script $BINDIR/.run-sml already exists. |
# Function to install a "driver" script... |
262 |
else |
# This takes care of patching the source of the script with the SHELL, |
263 |
cat $CONFIGDIR/_run-sml | \ |
# BINDIR, and VERSION variables to use. |
264 |
sed -e "s,@SHELL@,$SHELL,g" -e "s,@BINDIR@,$BINDIR," -e "s,@VERSION@,$VERSION," \ |
# |
265 |
> $BINDIR/.run-sml |
installdriver() { |
266 |
chmod 555 $BINDIR/.run-sml |
dsrc=$1 |
267 |
if [ ! -x $BINDIR/.run-sml ]; then |
ddst=$2 |
268 |
echo "!!! Installation of $BINDIR/.run-sml failed for some reason." |
if [ -x $BINDIR/$ddst ]; then |
269 |
|
echo Script $BINDIR/$ddst already exists. |
270 |
|
else |
271 |
|
cat $CONFIGDIR/$dsrc | \ |
272 |
|
sed -e "s,@SHELL@,$SHELL,g" \ |
273 |
|
-e "s,@BINDIR@,$BINDIR," \ |
274 |
|
-e "s,@VERSION@,$VERSION," \ |
275 |
|
> $BINDIR/$ddst |
276 |
|
chmod 555 $BINDIR/$ddst |
277 |
|
if [ ! -x $BINDIR/$ddst ]; then |
278 |
|
echo "!!! Installation of $BINDIR/${ddst} failed." |
279 |
exit 1 |
exit 1 |
280 |
fi |
fi |
281 |
fi |
fi |
282 |
|
} |
283 |
|
|
284 |
|
installdriver _run-sml .run-sml |
285 |
|
installdriver _link-sml .link-sml |
286 |
|
installdriver _ml-build ml-build |
287 |
|
|
288 |
# |
# |
289 |
# set some architecture dependent run-time system flags |
# set some architecture dependent run-time system flags |
290 |
# |
# |
291 |
case $ARCH in |
case $ARCH in |
292 |
mips*) ALLOC=1M ;; |
mips*) |
293 |
|
ALLOC=1M |
294 |
|
;; |
295 |
x86) |
x86) |
296 |
ALLOC=256k |
ALLOC=256k |
297 |
;; |
;; |
302 |
ALLOC=512k |
ALLOC=512k |
303 |
;; |
;; |
304 |
esac |
esac |
305 |
|
|
306 |
case $OPSYS in |
case $OPSYS in |
307 |
solaris) |
solaris) |
308 |
MAKE=/usr/ccs/bin/make |
MAKE=/usr/ccs/bin/make |
323 |
BOOT_FILES=sml.boot.$ARCH-unix |
BOOT_FILES=sml.boot.$ARCH-unix |
324 |
|
|
325 |
# |
# |
326 |
|
# files to be deleted after we are done... |
327 |
|
# |
328 |
|
tmpfiles="" |
329 |
|
tmpfiles="$tmpfiles $ROOT/preloads.standard" |
330 |
|
tmpfiles="$tmpfiles $ROOT/$LIBLIST" |
331 |
|
tmpfiles="$tmpfiles $ROOT/$LOCALPATHCONFIG" |
332 |
|
tmpfiles="$tmpfiles $ROOT/$LIBMOVESCRIPT" |
333 |
|
# |
334 |
|
# also remove the boot dir because it won't have anything interesting in |
335 |
|
# it after we are successful... |
336 |
|
# |
337 |
|
tmpfiles="$tmpfiles $ROOT/$BOOT_FILES" |
338 |
|
# |
339 |
|
# make sure we always clean up after ourselves... |
340 |
|
# |
341 |
|
trap 'rm -rf $tmpfiles' 0 1 2 3 15 |
342 |
|
|
343 |
|
# |
344 |
# build the run-time system |
# build the run-time system |
345 |
# |
# |
346 |
unpack "run-time" $SRCDIR runtime $ROOT/$VERSION-runtime |
unpack "run-time" $SRCDIR runtime $ROOT/$VERSION-runtime |
347 |
if [ ! -x $RUNDIR/run.$ARCH-$OPSYS ]; then |
if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then |
348 |
|
echo Run-time system already exists. |
349 |
|
else |
350 |
cd $SRCDIR/runtime/objs |
cd $SRCDIR/runtime/objs |
351 |
echo Compiling the run-time system. |
echo Compiling the run-time system. |
352 |
$MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS |
$MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS |
367 |
echo Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists. |
echo Heap image $HEAPDIR/sml.$HEAP_SUFFIX already exists. |
368 |
else |
else |
369 |
unpack bin $ROOT $BOOT_FILES $ROOT/$VERSION-$BOOT_FILES |
unpack bin $ROOT $BOOT_FILES $ROOT/$VERSION-$BOOT_FILES |
370 |
cd $ROOT |
cd $ROOT/$BOOT_FILES |
371 |
if $RUNDIR/run.$ARCH-$OPSYS @SMLheap=sml \ |
if $BINDIR/.link-sml @SMLheap=$ROOT/sml @SMLboot=BOOTLIST @SMLalloc=$ALLOC |
|
@SMLboot=$ROOT/$BOOT_FILES @SMLrtpid=`cat $BOOT_FILES/RTPID` \ |
|
|
@SMLalloc=$ALLOC |
|
372 |
then |
then |
373 |
|
cd $ROOT |
374 |
if [ -r sml.$HEAP_SUFFIX ]; then |
if [ -r sml.$HEAP_SUFFIX ]; then |
375 |
mv sml.$HEAP_SUFFIX $HEAPDIR |
mv sml.$HEAP_SUFFIX $HEAPDIR |
376 |
cd $BINDIR |
cd $BINDIR |
377 |
ln -s .run-sml sml |
ln -s .run-sml sml |
|
|
|
378 |
# |
# |
379 |
# Now move all stable libraries to #LIBDIR and generate |
# Now move all stable libraries to #LIBDIR and generate |
380 |
# the pathconfig file. |
# the pathconfig file. |
381 |
# |
# |
|
|
|
382 |
cd $ROOT/$BOOT_FILES |
cd $ROOT/$BOOT_FILES |
383 |
for lib in *.cm ; do |
for lib in *.cm ; do |
384 |
echo $lib $LIBDIR/$lib >>$CM_PATHCONFIG_DEFAULT |
echo $lib $LIBDIR/$lib >>$CM_PATHCONFIG_DEFAULT |
419 |
;; |
;; |
420 |
ml-yacc) |
ml-yacc) |
421 |
standalone ml-yacc ML-Yacc src |
standalone ml-yacc ML-Yacc src |
422 |
|
echo ml-yacc $TOOLDIR >>$CM_PATHCONFIG_DEFAULT |
423 |
;; |
;; |
424 |
ml-lex) |
ml-lex) |
425 |
standalone ml-lex ML-Lex |
standalone ml-lex ML-Lex |
426 |
|
echo ml-lex $TOOLDIR >>$CM_PATHCONFIG_DEFAULT |
427 |
;; |
;; |
428 |
ml-burg) |
ml-burg) |
429 |
standalone ml-burg ML-Burg |
standalone ml-burg ML-Burg |
430 |
|
echo ml-burg $TOOLDIR >>$CM_PATHCONFIG_DEFAULT |
431 |
;; |
;; |
432 |
smlnj-lib) |
smlnj-lib) |
433 |
unpack "SML/NJ Library" $SRCDIR smlnj-lib $ROOT/$VERSION-smlnj-lib |
unpack "SML/NJ Library" $SRCDIR smlnj-lib $ROOT/$VERSION-smlnj-lib |
487 |
echo "!!! Something went wrong when compiling the libraries." |
echo "!!! Something went wrong when compiling the libraries." |
488 |
exit 1 |
exit 1 |
489 |
fi |
fi |
|
rm -f $LIBLIST $LOCALPATHCONFIG |
|
490 |
|
|
491 |
# |
# |
492 |
# Finally, move the libraries to their final locations... |
# Finally, move the libraries to their final locations... |
495 |
if [ -r $LIBMOVESCRIPT ] ; then |
if [ -r $LIBMOVESCRIPT ] ; then |
496 |
echo Moving libraries to $LIBDIR. |
echo Moving libraries to $LIBDIR. |
497 |
. $LIBMOVESCRIPT |
. $LIBMOVESCRIPT |
|
rm -f $LIBMOVESCRIPT |
|
498 |
fi |
fi |
499 |
|
|
500 |
# |
exit 0 |
|
# Get rid of preloads.standard |
|
|
# |
|
|
rm -f $ROOT/preloads.standard |
|