This repository has been archived by the owner on Sep 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathrun_lisp.sh
executable file
·79 lines (70 loc) · 1.68 KB
/
run_lisp.sh
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
#!/usr/bin/env sh
# This is just to find and start a Lisp, to run a Lisp based script.
fail()
{
echo "$0: $*"
exit 1
}
script_name="$1"
if [ ! -n "$script_name" ]; then
fail "Script name argument is missing."
fi
if [ ! -e "$script_name" ]; then
fail "Script file doesn't exist."
fi
if [ ! -n "$LISP" ] ; then
LISPS="sbcl ccl lisp clisp ecl"
for l in $LISPS ; do
if [ x"`command -v $l`" != x ] ; then
LISP=$l
break;
fi
done
fi
if [ ! -n "$LISP" -o ! -n "`command -v $LISP`" ] ; then
echo "I can't find a Lisp to run. Please set the environment variable LISP to"
echo "the name of an installed Common Lisp, and re-run this script."
echo "For example: "
echo
echo "LISP=/usr/bin/sbcl sh ./build.sh"
echo
exit 1
fi
try_to_figure_flags()
{
LOAD_ARGS=""
BATCH_ARGS=""
case "$LISP" in
*sbcl*)
OUR_PLAIN_LISP_FLAGS="--no-userinit" ;
BATCH_ARGS="--noinform --noprint --disable-debugger --no-sysinit"
;;
*ccl*)
OUR_PLAIN_LISP_FLAGS="--no-init"
#BATCH_ARGS="--batch"
BATCH_ARGS="--quiet"
;;
*clisp*)
OUR_PLAIN_LISP_FLAGS="-norc"
;;
*abcl*)
OUR_PLAIN_LISP_FLAGS="--noinit"
;;
*ecl*)
OUR_PLAIN_LISP_FLAGS="--norc"
BATCH_ARGS="-q"
;;
*)
echo "I'm not sure how to set flags for $LISP."
;;
esac
}
try_to_figure_flags
export LISH_PLAIN_FLAGS="${LISH_PLAIN_FLAGS:=$OUR_PLAIN_LISP_FLAGS}"
export LISH_FLAGS="${BATCH_ARGS}"
echo "[Using ${LISP} ${LISH_FLAGS} ${LISH_PLAIN_FLAGS}]"
echo "[Running $script_name]"
echo $LISP $LISH_FLAGS $LISH_PLAIN_FLAGS
echo '(load "'"$script_name"'")' |
$LISP $LISH_FLAGS $LISH_PLAIN_FLAGS || fail "somehow failed"
exit 0