Remove yet another wacky half-baked lambda-list parser.
[sbcl.git] / run-sbcl.sh
blobda5775be178a2b8769563610f35c400f03647a26
1 #!/bin/sh
2 # A simple shell-script to run the freshly build SBCL without
3 # installing it.
5 # This software is part of the SBCL system. See the README file for
6 # more information.
8 # This software is derived from the CMU CL system, which was
9 # written at Carnegie Mellon University and released into the
10 # public domain. The software is in the public domain and is
11 # provided with absolutely no warranty. See the COPYING and CREDITS
12 # files for more information.
14 set -e
16 this="$0"
18 # OSX 10.8 readlink doesn't have -f
19 while [ -h "$this" ]; do
20 # [ -h should guarantee that readlink output will be non-null
21 link=`readlink -n "$this"`
22 # if absolute path
23 if expr "$link" : '^/.*' > /dev/null; then
24 this="$link"
25 else
26 this=`dirname "$this"`/"$link"
28 done
29 BASE=`dirname "$this"`
31 CORE_DEFINED=no
33 for arg in "$@"; do
34 case "$arg" in
35 --core)
36 CORE_DEFINED=yes
38 --help)
39 echo "usage: run-sbcl.sh sbcl-options*"
40 echo
41 echo "Runs SBCL from the build directory or binary tarball without need for"
42 echo "installation. Except for --help, accepts all the same command-line options"
43 echo "as SBCL does."
44 echo
45 exit 1
47 esac
48 done
50 ARGUMENTS=""
52 if [ "$CORE_DEFINED" = "no" ]; then
53 ARGUMENTS="--core "$BASE"/output/sbcl.core"
56 if [ -x "$BASE"/src/runtime/sbcl -a -f "$BASE"/output/sbcl.core ]; then
57 echo "(running SBCL from: $BASE)" 1>&2
58 SBCL_HOME="$BASE/obj/sbcl-home" exec "$BASE"/src/runtime/sbcl $ARGUMENTS "$@"
59 else
60 echo "No built SBCL here ($BASE): run 'sh make.sh' first!"
61 exit 1