From: Nikodemus Siivola Date: Sun, 15 Aug 2010 13:59:00 +0000 (+0000) Subject: 1.0.41.45: make.sh command-line parsing X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=9e4ba79747ea69dc33ef9f6014571dd098d1568d;p=sbcl.git 1.0.41.45: make.sh command-line parsing Based on patches by Daniel Herring: * Simple --option and --option=arg command-line parser in make.sh. * Supported options: ** --xc-host= to specify XC host option instead of a positional argument. (Incompatible change!) ** --prefix= to specify a non-standard install location for both build and install.sh. Addresses https://bugs.launchpad.net/sbcl/+bug/550889 ** --help Semi-related minor cleanup: * Use --no-userinit and --no-sysinit instead of version.lisp-expr as the default inits for self-building: they have been around long enough now that it should not stop anyone from building, and makes for a somewhat less magical looking "//Build options: ..." line in the build log. --- diff --git a/INSTALL b/INSTALL index ec576b0..f840516 100644 --- a/INSTALL +++ b/INSTALL @@ -34,7 +34,11 @@ INSTALLING SBCL $ INSTALL_ROOT=/home/me sh install.sh In other words, "install.sh" installs SBCL under the directory named - by the environment variable "INSTALL_ROOT". + by the environment variable INSTALL_ROOT. + + If INSTALL_ROOT is not specified, SBCL is installed into location + configured at build-time: for official binary distributions under + "/usr/local" directory. If you install SBCL from binary distribution in other location than "/usr/local", see section 1.2, "Finding ancillary files". @@ -114,13 +118,21 @@ INSTALLING SBCL $ sh make.sh + To configure SBCL to install to a non-standard location, you can use + the --prefix option: + + $ sh make.sh --prefix=/opt/mysbcl + + This also sets the default SBCL_HOME to prefix/lib/sbcl/ for the + built binaries. + If you don't already have an SBCL binary installed as "sbcl" on your system, you'll need to tell make.sh what Lisp to use as the cross-compilation host. For example, to use CMUCL (assuming has been installed under its default name "lisp") as the cross-compilation host: - $ sh make.sh 'lisp -batch -noinit' + $ sh make.sh --xc-host='lisp -batch -noinit' The build may take a long time, especially on older hardware. A successful build ends with a message beginning: "The build seems to diff --git a/NEWS b/NEWS index 3c5aca7..e70ebe7 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,12 @@ ;;;; -*- coding: utf-8; fill-column: 78 -*- changes relative to sbcl-1.0.41 - * optimization: the default implementation of + * build changes + ** Cross-compilation host is now specified to make.sh using + command-line argument --xc-host= instead of a positional + argument. (thanks to Daniel Herring) + ** Install location can be specified to make.sh using command-line + argument --prefix=. (lp#550889s, thanks to Daniel Herring) + * optimization: The default implementation of COMPUTE-DISCRIMINATING-FUNCTION does much less wasted work. * enhancement: Explicit memory barrier operations are now available for use by multithreaded code. See documentation for details. diff --git a/install.sh b/install.sh index 1400791..5676dae 100644 --- a/install.sh +++ b/install.sh @@ -10,12 +10,13 @@ ensure_dirs () done; } +. output/prefix.def +DEFAULT_INSTALL_ROOT=$SBCL_PREFIX + if [ "$OSTYPE" = "cygwin" -o "$OSTYPE" = "msys" ] ; then - DEFAULT_INSTALL_ROOT="$PROGRAMFILES/sbcl" RUNTIME=sbcl.exe OLD_RUNTIME=sbcl.exe.old else - DEFAULT_INSTALL_ROOT=/usr/local RUNTIME=sbcl OLD_RUNTIME=sbcl.old fi diff --git a/make.sh b/make.sh index 12e7761..c60f9fa 100755 --- a/make.sh +++ b/make.sh @@ -1,6 +1,10 @@ #!/bin/sh set -e +LANG=C +LC_ALL=C +export LANG LC_ALL + # "When we build software, it's a good idea to have a reliable method # for getting an executable from it. We want any two reconstructions # starting from the same source to end up in the same result. That's @@ -16,34 +20,128 @@ set -e # provided with absolutely no warranty. See the COPYING and CREDITS # files for more information. -# The value of SBCL_XC_HOST should be a command to invoke the -# cross-compilation Lisp system in such a way that it reads commands -# from standard input, and terminates when it reaches end of file on -# standard input. Some suitable values are: -# "sbcl" to use an existing SBCL binary as a cross-compilation host -# "sbcl --sysinit /dev/null --userinit /dev/null" -# to use an existing SBCL binary as a cross-compilation host -# even though you have stuff in your initialization files -# which makes it behave in such a non-standard way that -# it keeps the build from working -# "sbcl --disable-debugger" -# to use an existing SBCL binary as a cross-compilation host -# and tell it to handle errors as best it can by itself -# (probably by dying with an error code) instead of waiting -# endlessly for a programmer to help it out with input -# on *DEBUG-IO* -# "lisp -batch" to use an existing CMU CL binary as a cross-compilation host -# "lisp -noinit -batch" -# to use an existing CMU CL binary as a cross-compilation host -# when you have weird things in your .cmucl-init file -# "openmcl --batch" -# to use an OpenMCL binary as a cross-compilation host -# "clisp" -# to use a CLISP binary as a cross-compilation host -# -# FIXME: Make a more sophisticated command line parser, probably -# accepting "sh make.sh --xc-host foolisp" instead of the -# the present "sh make.sh foolisp". +print_help="no" + +# The classic form here was to use --userinit $DEVNULL --sysinit +# $DEVNULL, but that doesn't work on Win32 because SBCL doesn't handle +# device names properly. We still need $DEVNULL to be NUL on Win32 +# because it's used elsewhere (such as canonicalize-whitespace), so we +# need an alternate solution for the init file overrides. --no-foos +# have now been available long enough that this should not stop anyone +# from building. +if [ "$OSTYPE" = "cygwin" -o "$OSTYPE" = "msys" ] +then + SBCL_PREFIX="$PROGRAMFILES/sbcl" +else + SBCL_PREFIX="/usr/local" +fi +SBCL_XC_HOST="sbcl --disable-debugger --no-userinit --no-sysinit" +export SBCL_XC_HOST + +# Parse command-line options. +for option +do + # Split --foo=bar into --foo and bar. + case $option in + *=*) + optarg=`expr "X$option" : '[^=]*=\(.*\)'` + option=`expr "X$option" : 'X\([^=]*\)=.*'` + ;; + *) + optarg="" + ;; + esac + + case $option in + --help | -help | -h) + print_help="yes" ;; + --prefix) + SBCL_PREFIX=$optarg ;; + --xc-host) + SBCL_XC_HOST=$optarg ;; + + *) + echo "Unknown command-line option to $0: $option" + print_help="yes" + esac +done + +if test "$print_help" = "yes" +then + cat < Specify the install location. + + Script install.sh installs SBCL under the specified prefix + path: runtime as prefix/bin/sbcl, additional files under + prefix/lib/sbcl, and documentation under prefix/share. + + This option also affects the binaries: built-in default for + SBCL_HOME is: prefix/lib/sbcl/ + + Default prefix is: /usr/local + + --xc-host= Specify the Common Lisp compilation host. + + The string provided should be a command to invoke the + cross-compilation Lisp system in such a way, that it reads + commands from standard input, and terminates when it reaches end + of file on standard input. + + Examples: + + "sbcl --disable-debugger --no-sysinit --no-userinit" + Use an existing SBCL binary as a cross-compilation + host even though you have stuff in your + initialization files which makes it behave in such a + non-standard way that it keeps the build from + working. Also disable the debugger instead of + waiting endlessly for a programmer to help it out + with input on *DEBUG-IO*. (This is the default.) + + "sbcl" + Use an existing SBCL binary as a cross-compilation + host, including your initialization files and + building with the debugger enabled. Not recommended + for casual users. + + "lisp -noinit -batch" + Use an existing CMU CL binary as a cross-compilation + host when you have weird things in your .cmucl-init + file. + + "openmcl --batch" + Use an OpenMCL binary as a cross-compilation host. + + "clisp" + Use a CLISP binary as a cross-compilation host. + Note: historically clisp hosted builds have been + frequently broken. While reports of this are always + appreciated, bootstrapping another host is + recommended. +EOF + exit +fi + +build_started=`date` +echo "//Starting build: $build_started" +# Apparently option parsing succeeded. Print out the results. +echo "//Options: --prefix='$SBCL_PREFIX' --xc-host='$SBCL_XC_HOST'" + +# Save prefix for make and install.sh. +echo "SBCL_PREFIX='$SBCL_PREFIX'" > output/prefix.def + # FIXME: Tweak this script, and the rest of the system, to support # a second bootstrapping pass in which the cross-compilation host is # known to be SBCL itself, so that the cross-compiler can do some @@ -53,29 +151,12 @@ set -e # whether the cross-compilation host returns suitable values from # UPGRADED-ARRAY-ELEMENT-TYPE?) -LANG=C -LC_ALL=C -export LANG LC_ALL - -build_started=`date` -echo "//starting build: $build_started" - if [ "$OSTYPE" = "cygwin" -o "$OSTYPE" = "msys" ] ; then DEVNULL=NUL else DEVNULL=/dev/null fi -# The classic form here was to use --userinit $DEVNULL --sysinit -# $DEVNULL, but that doesn't work on Win32 because SBCL doesn't handle -# device names properly. We still need $DEVNULL to be NUL on Win32 -# because it's used elsewhere (such as canonicalize-whitespace), so we -# need an alternate solution for the init file overrides. It turns -# out that version.lisp-expr has no side effects from evaluation, so -# we may as well use that. -SBCL_XC_HOST="${1:-sbcl --disable-debugger --userinit version.lisp-expr --sysinit version.lisp-expr}" export DEVNULL -export SBCL_XC_HOST -echo //SBCL_XC_HOST=\"$SBCL_XC_HOST\" . ./find-gnumake.sh find_gnumake diff --git a/slam.sh b/slam.sh index 7f6987f..63108f3 100644 --- a/slam.sh +++ b/slam.sh @@ -80,7 +80,7 @@ case "$HOST_TYPE" in CORE="-core" ;; sbcl) LISP="sbcl" - INIT="--sysinit version.lisp-expr --userinit version.lisp-expr" + INIT="--no-sysinit --no-userinit" CORE="--core" ;; clisp) LISP="clisp" diff --git a/src/runtime/GNUmakefile b/src/runtime/GNUmakefile index cfaac20..f0fbe19 100644 --- a/src/runtime/GNUmakefile +++ b/src/runtime/GNUmakefile @@ -23,9 +23,11 @@ NM = nm -gp DEPEND_FLAGS = -MM GREP = grep +include ../../output/prefix.def + CFLAGS = -g -Wall -Wsign-compare -O3 ASFLAGS = $(CFLAGS) -CPPFLAGS = -I. +CPPFLAGS = -I. -DSBCL_PREFIX=\"$(SBCL_PREFIX)\" # Give make access to the target Lisp features. include genesis/Makefile.features diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c index 59cead9..7200500 100644 --- a/src/runtime/runtime.c +++ b/src/runtime/runtime.c @@ -67,7 +67,7 @@ #endif #ifndef SBCL_HOME -#define SBCL_HOME "/usr/local/lib/sbcl/" +#define SBCL_HOME SBCL_PREFIX"/lib/sbcl/" #endif #ifdef LISP_FEATURE_HPUX diff --git a/version.lisp-expr b/version.lisp-expr index 0e2c43a..bbc759d 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.41.44" +"1.0.41.45"