1.0.31.10: run-sbcl.sh to support --core
[sbcl.git] / run-sbcl.sh
1 #!/bin/sh
2 # A simple shell-script to run the freshly build SBCL without
3 # installing it.
4
5 # This software is part of the SBCL system. See the README file for
6 # more information.
7 #
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.
13
14 set -e
15
16 BASE=`dirname "$0"`
17 CORE_DEFINED=no
18
19 for arg in $*; do
20     case $arg in
21         (--core)
22           CORE_DEFINED=yes
23           ;;
24         (--help)
25           echo "usage: run-sbcl.sh sbcl-options*"
26           echo
27           echo "Runs SBCL from the build directory or binary tarball without need for"
28           echo "installation. Except for --help, accepts all the same command-line options"
29           echo "as SBCL does."
30           echo
31           exit 1
32           ;;
33     esac
34 done
35
36 ARGUMENTS=""
37
38 if [ "$CORE_DEFINED" = "no" ]; then
39     ARGUMENTS="--core "$BASE"/output/sbcl.core"
40 fi
41
42 if [ -x "$BASE"/src/runtime/sbcl -a -f "$BASE"/output/sbcl.core ]; then
43     echo "(running SBCL from: `pwd`)"
44     SBCL_HOME="$BASE"/contrib "$BASE"/src/runtime/sbcl $ARGUMENTS "$@"
45 else
46     echo "No built SBCL here ($BASE): run 'sh make.sh' first!"
47     exit 1
48 fi