/usr/lib/smlnj/bin/.run-sml is in smlnj-runtime 110.79-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | #!/bin/sh
#
# The standard driver for SML/NJ under the new runtime system
#
CMD=`basename "$0"`
#
# for /bin/ksh, disable reading user's environment file
#
unset ENV
#############################################################################
#
# BEGIN SITE SPECIFIC STUFF
#
#############################################################################
#
# SITE SPECIFIC CONFIGURATION INFO
#
# On cygwin, make sure SMLNJ_HOME is given a POSIX-style pathname.
if [ x"$SMLNJ_HOME" != x ] ; then
if [ x"$SMLNJ_CYGWIN_RUNTIME" != x ] ; then
if [ "`uname -o`" = "Cygwin" ] ; then
# Convert to Unix style, absolute pathname.
SMLNJ_HOME=`cygpath -u -a "$SMLNJ_HOME"`
fi
fi
fi
# the path of the directory in which executables (like this file) are kept.
if [ x"$SMLNJ_HOME" = x ] ; then
BIN_DIR="/usr/lib/smlnj/bin/"
if [ ! -d "$BIN_DIR" ]; then
cmddir=`dirname "$0"`
case "$cmddir" in
/* ) BIN_DIR="$cmddir";;
* ) BIN_DIR=`cd $cmddir; pwd` ;;
esac
fi
else
if [ x"$CM_PATHCONFIG" = x ] ; then
CM_PATHCONFIG=${SMLNJ_HOME}/lib/pathconfig
export CM_PATHCONFIG
fi
BIN_DIR=${SMLNJ_HOME}/bin
fi
# the path of the directory in which the runtime system executables are kept.
RUN_DIR=$BIN_DIR/.run
# the path of the directory in which the heap images are kept.
HEAP_DIR=$BIN_DIR/.heap
#
# the following could be replaced with some site specific code
#
ARCH_N_OPSYS=`"$BIN_DIR/.arch-n-opsys"`
if [ "$?" != "0" ]; then
echo "$CMD: unable to determine architecture/operating system"
exit 1
fi
eval $ARCH_N_OPSYS
#############################################################################
#
# END SITE SPECIFIC STUFF
#
#############################################################################
# special shortcut for frequent use (and for Linux' binfmt)
if [ `basename "$0"` = sml ] ; then
case "$1" in
/* | ./* | ../* )
case "$1" in
*.cm | *.sml | *.sig | *.fun )
;;
* )
HEAP="@SMLload=$1"
shift
;;
esac
;;
esac
fi
ALLOC=""
#
# Process command line arguments
#
while [ "$#" != "0" ]; do
arg=$1
case "$arg" in
@SMLrun=*)
shift
RUN=`echo $arg | sed 's/@SMLrun=//'`
;;
@SMLload=*)
shift
HEAP=$arg
;;
@SMLappl)
shift
if [ "$#" = "0" ]; then
echo "$CMD: missing argument for @SMLappl option"
exit 1
fi
APPL=$1
shift
;;
@SMLversion)
echo "$CMD 110.79"
exit 0
;;
@SMLsuffix)
echo "$HEAP_SUFFIX"
exit 0
;;
@SMLalloc=*)
shift
ALLOC=$arg
;;
*)
break
;;
esac
done
#
# Try to figure out the CPU's cache size and set the allocation area
# size accordingly. This is majorly important for Celeron systems
# which suffer badly when the allocation area is too big.
#
if [ "$ALLOC" = "" ] ; then
if [ -f /proc/cpuinfo ] ; then
# "head" is called to make sure we consider only one matching line.
# (On linux SMP systems there is more than one such line.)
cache=`fgrep 'cache size' </proc/cpuinfo | head -1`
if [ "x$cache" = "x" ] ; then
# No cache info in /proc/cputype. No we are checking the CPU
# type....
cpu=`fgrep 'cpu ' </proc/cpuinfo | head -1`
cputype=`echo $cpu | sed -e 's/^.*:[ \t]*\(.*\)$/\1/'`
case $cputype in
586)
# An old Pentium. Seems to work best with 64k.
# Some extreme cases run best with even less
# (32k, 16k, or even just 8k).
ALLOC="@SMLalloc=64k"
;;
*)
;;
esac
else
kb=`echo $cache | sed -e 's/^[^0-9]*\([0-9]*\).*$/\1/'`
case $kb in
128)
# This is the Celeron case.
# ALLOC="@SMLalloc=32k"
ALLOC="@SMLalloc=64k"
;;
256)
# Do CPUs like this exist?
ALLOC="@SMLalloc=256k"
;;
512)
# The Pentium II case...
ALLOC="@SMLalloc=512k"
;;
1024) ALLOC="@SMLalloc=512k" ;;
2048) ALLOC="@SMLalloc=1024k" ;;
3072) ALLOC="@SMLalloc=1024k" ;;
12288) ALLOC="@SMLalloc=1024k" ;;
*)
;;
esac
fi
elif [ x"$OPSYS" = "darwin" ] ; then
cache=`/usr/sbin/sysctl -n hw.l3cachesize`
if [ x"$cache" = "x" ] ; then
cache=`/usr/sbin/sysctl -n hw.l2cachesize`
if [ x"$cache" = "x" ] ; then
cache=262144 # fallback
fi
fi
# possible cache sizes for Intel Macs
# see list at http://en.wikipedia.org/wiki/List_of_Macintosh_models_grouped_by_CPU_type
case $cache in
262144) kb=256;;
524288) kb=512;;
1048576) kb=512;;
2097152) kb=1024;;
3145728) kb=1024;;
4194304) kb=1024;;
6291456) kb=1024;;
8388608) kb=1024;;
12582912) kb=1024;;
esac
ALLOC="@SMLalloc=$kb"
fi
fi
if [ "$RUN" = "" ]; then
#
# Construct the runtime system path from the ARCH and OS
#
RUN="$RUN_DIR/run.$ARCH-$OPSYS"
if [ ! -x "$RUN" ]; then
if [ "$ALT_OPSYS" = "" ]; then
echo "$CMD: cannot find runtime system $RUN"
exit 1
else
RUN="$RUN_DIR/run.$ARCH-$ALT_OPSYS"
if [ ! -x "$RUN" ]; then
echo "$CMD: cannot find runtime system $RUN"
exit 1
fi
fi
fi
fi
if [ "$HEAP" = "" ]; then
#
# Construct the heap image path from the APPL and ARCH
#
if [ "$APPL" = "" ]; then
APPL=$CMD
fi
HEAP="@SMLload=$HEAP_DIR/$APPL"
fi
#
# run the sucker!
#
exec "$RUN" @SMLcmdname="$0" "$HEAP" $ALLOC "$@"
|