43 |
REAL_PWD=`pwd` |
REAL_PWD=`pwd` |
44 |
ROOT=${PWD:-$REAL_PWD} |
ROOT=${PWD:-$REAL_PWD} |
45 |
echo SML root is $ROOT. |
echo SML root is $ROOT. |
46 |
|
echo Installation directory is ${INSTALLDIR:=$ROOT}. |
47 |
|
|
48 |
# |
# |
49 |
# set the various directory and file pathname variables |
# set the various directory and file pathname variables |
50 |
# |
# |
51 |
BINDIR=$ROOT/bin # main dir for binary stuff |
BINDIR=$INSTALLDIR/bin # main dir for binary stuff |
52 |
CONFIGDIR=$ROOT/config |
CONFIGDIR=$ROOT/config |
53 |
HEAPDIR=$BINDIR/.heap # where heap images live |
HEAPDIR=$BINDIR/.heap # where heap images live |
54 |
RUNDIR=$BINDIR/.run # where executables (i.e., the RTS) live |
RUNDIR=$BINDIR/.run # where executables (i.e., the RTS) live |
55 |
SRCDIR=$ROOT/src # where the source tree is rooted |
SRCDIR=$ROOT/src # where the source tree is rooted |
56 |
LIBDIR=$ROOT/lib # where libraries live |
LIBDIR=$INSTALLDIR/lib # where libraries live |
57 |
LIBLIST=$ROOT/liblist # list of commands to stabilize libraries |
LIBLIST=$ROOT/liblist # list of commands to stabilize libraries |
58 |
LIBMOVESCRIPT=$ROOT/libmove # a temporary script |
LIBMOVESCRIPT=$ROOT/libmove # a temporary script |
59 |
LOCALPATHCONFIG=$ROOT/pathconfig # a temporary pathconfig file |
LOCALPATHCONFIG=$ROOT/pathconfig # a temporary pathconfig file |
138 |
# $LIBDIR/$2/CM/$ARCH-unix/$2 so that it appears as if the description file |
# $LIBDIR/$2/CM/$ARCH-unix/$2 so that it appears as if the description file |
139 |
# had been at $LIBDIR/$2/$2 |
# had been at $LIBDIR/$2/$2 |
140 |
# |
# |
141 |
movelib() { |
# (This script will also move all other libraries that show up in |
142 |
if [ -f $1/CM/$ARCH-unix/$2 ] ; then |
# $1/CM/$ARCH-unix because in the case of the boot directory this indicates |
143 |
echo Moving library $2 to $LIBDIR. |
# that some library did not have its own path anchor but was specified |
144 |
|
# relative to $1/$2. Still, don't rely on this to be robust -- rather make |
145 |
|
# separate anchors for every library!) |
146 |
|
# |
147 |
|
movelibs() { |
148 |
|
for lib in `/bin/ls $1/CM/$ARCH-unix` ; do |
149 |
|
case $lib in |
150 |
|
*.cm) |
151 |
|
if [ $lib != $2 ] ; then |
152 |
|
echo "! Warning:" $lib specified relative to $2 |
153 |
|
fi |
154 |
|
echo Moving library $lib to $LIBDIR |
155 |
makedir $LIBDIR/$2 |
makedir $LIBDIR/$2 |
156 |
makedir $LIBDIR/$2/CM |
makedir $LIBDIR/$2/CM |
157 |
makedir $LIBDIR/$2/CM/$ARCH-unix |
makedir $LIBDIR/$2/CM/$ARCH-unix |
158 |
mv $1/CM/$ARCH-unix/$2 $LIBDIR/$2/CM/$ARCH-unix/$2 |
mv $1/CM/$ARCH-unix/$lib $LIBDIR/$2/CM/$ARCH-unix/$lib |
159 |
fi |
;; |
160 |
|
*) |
161 |
|
;; |
162 |
|
esac |
163 |
|
done |
164 |
} |
} |
165 |
|
|
166 |
# A shell function that registers a library for being built. |
# A shell function that registers a library for being built. |
171 |
# |
# |
172 |
# This works by adding ML code to file $LIBLIST. The code in this file |
# This works by adding ML code to file $LIBLIST. The code in this file |
173 |
# will be executed near the end of this script. If $MOVE_LIBRARIES is |
# will be executed near the end of this script. If $MOVE_LIBRARIES is |
174 |
# set to true, then reglib will also register a "movelib" to be executed at |
# set to true, then reglib will also register a "movelibs" to be executed at |
175 |
# the end by putting a "movelib" line into $LIBMOVESCRIPT. |
# the end by putting a "movelibs" line into $LIBMOVESCRIPT. |
176 |
|
|
177 |
reglib() { |
reglib() { |
178 |
if [ x$MOVE_LIBRARIES = xtrue ] ; then |
if [ x$MOVE_LIBRARIES = xtrue ] ; then |
187 |
echo "andalso CM.stabilize false \"$1\"" >>$LIBLIST |
echo "andalso CM.stabilize false \"$1\"" >>$LIBLIST |
188 |
echo $1 $SRCDIR/$2 >>$LOCALPATHCONFIG |
echo $1 $SRCDIR/$2 >>$LOCALPATHCONFIG |
189 |
if [ x$MOVE_LIBRARIES = xtrue ] ; then |
if [ x$MOVE_LIBRARIES = xtrue ] ; then |
190 |
echo movelib $SRCDIR/$2 $1 >>$LIBMOVESCRIPT |
echo movelibs $SRCDIR/$2 $1 >>$LIBMOVESCRIPT |
191 |
fi |
fi |
192 |
echo $1 $FINALLOCATION >>$CM_PATHCONFIG_DEFAULT |
echo $1 $FINALLOCATION >>$CM_PATHCONFIG_DEFAULT |
193 |
fi |
fi |
195 |
|
|
196 |
# |
# |
197 |
# Function to build a standalone program such as ml-yacc. The function takes |
# Function to build a standalone program such as ml-yacc. The function takes |
198 |
# 2 or 3 arguments. First the name of the program with at the same time |
# 2 or 3 arguments. First the name of the program which at the same time |
199 |
# is the directory name under $SRCDIR where the sources reside. The second |
# is the directory name under $SRCDIR where the sources reside. The second |
200 |
# argument is a descriptive name for the program (passed on to "unpack"). |
# argument is a descriptive name for the program (passed on to "unpack"). |
201 |
# The optional third argument specifies the path relative to $SRCDIR/$1 |
# The optional third argument specifies the path relative to $SRCDIR/$1 |
350 |
cd $ROOT/$BOOT_FILES |
cd $ROOT/$BOOT_FILES |
351 |
for lib in *.cm ; do |
for lib in *.cm ; do |
352 |
echo $lib $LIBDIR/$lib >>$CM_PATHCONFIG_DEFAULT |
echo $lib $LIBDIR/$lib >>$CM_PATHCONFIG_DEFAULT |
353 |
movelib $ROOT/$BOOT_FILES/$lib $lib |
movelibs $ROOT/$BOOT_FILES/$lib $lib |
354 |
done |
done |
355 |
cd $ROOT |
cd $ROOT |
356 |
rm -rf $BOOT_FILES |
rm -rf $BOOT_FILES |