8 # "When we build software, it's a good idea to have a reliable method
9 # for getting an executable from it. We want any two reconstructions
10 # starting from the same source to end up in the same result. That's
11 # just a basic intellectual premise."
12 # -- Christian Queinnec, in _Lisp In Small Pieces_, p. 313
14 # This software is part of the SBCL system. See the README file for
17 # This software is derived from the CMU CL system, which was
18 # written at Carnegie Mellon University and released into the
19 # public domain. The software is in the public domain and is
20 # provided with absolutely no warranty. See the COPYING and CREDITS
21 # files for more information.
25 # The classic form here was to use --userinit $DEVNULL --sysinit
26 # $DEVNULL, but that doesn't work on Win32 because SBCL doesn't handle
27 # device names properly. We still need $DEVNULL to be NUL on Win32
28 # because it's used elsewhere (such as canonicalize-whitespace), so we
29 # need an alternate solution for the init file overrides. --no-foos
30 # have now been available long enough that this should not stop anyone
32 if [ "$OSTYPE" = "cygwin" -o "$OSTYPE" = "msys" ]
34 SBCL_PREFIX="$PROGRAMFILES/sbcl"
36 SBCL_PREFIX="/usr/local"
38 SBCL_XC_HOST="sbcl --disable-debugger --no-userinit --no-sysinit"
41 # Parse command-line options.
44 echo "Enter \"$0 --help\" for list of valid options."
52 # Split --foo=bar into --foo and bar.
55 # For ease of scripting treat skip valued options with empty
57 optarg=`expr "X$option" : '[^=]*=\(.*\)'` || optarg_ok=false
58 option=`expr "X$option" : 'X\([^=]*=\).*'`
69 $optarg_ok && SBCL_PREFIX=$optarg
72 $optarg_ok && SBCL_XC_HOST=$optarg
74 --dynamic-space-size=)
75 $optarg_ok && SBCL_DYNAMIC_SPACE_SIZE=$optarg
78 bad_option "Unknown command-line option to $0: \"$option\""
83 bad_option "Unknown command-line option to $0: \"$option\""
85 legacy_xc_spec=$option
92 # Previously XC host was provided as a positional argument.
93 if test -n "$legacy_xc_spec"
95 SBCL_XC_HOST="$legacy_xc_spec"
98 if test "$print_help" = "yes"
101 \`make.sh' drives the SBCL build.
103 Usage: $0 [OPTION]...
105 Important: make.sh does not currently control the entirety of the
106 build: configuration file customize-target-features.lisp and certain
107 environment variables play a role as well. see file INSTALL for
111 -h, --help Display this help and exit.
113 --prefix=<path> Specify the install location.
115 Script install.sh installs SBCL under the specified prefix
116 path: runtime as prefix/bin/sbcl, additional files under
117 prefix/lib/sbcl, and documentation under prefix/share.
119 This option also affects the binaries: built-in default for
120 SBCL_HOME is: prefix/lib/sbcl/
122 Default prefix is: /usr/local
124 --dynamic-space-size=<size> Specify default dynamic-space size.
126 If not provided, the default is platform-specific. <size> is
127 taken to be megabytes unless explicitly suffixed with Gb in
128 order to specify the size in gigabytes.
130 --xc-host=<string> Specify the Common Lisp compilation host.
132 The string provided should be a command to invoke the
133 cross-compilation Lisp system in such a way, that it reads
134 commands from standard input, and terminates when it reaches end
135 of file on standard input.
139 "sbcl --disable-debugger --no-sysinit --no-userinit"
140 Use an existing SBCL binary as a cross-compilation
141 host even though you have stuff in your
142 initialization files which makes it behave in such a
143 non-standard way that it keeps the build from
144 working. Also disable the debugger instead of
145 waiting endlessly for a programmer to help it out
146 with input on *DEBUG-IO*. (This is the default.)
149 Use an existing SBCL binary as a cross-compilation
150 host, including your initialization files and
151 building with the debugger enabled. Not recommended
154 "lisp -noinit -batch"
155 Use an existing CMU CL binary as a cross-compilation
156 host when you have weird things in your .cmucl-init
163 echo "//Starting build: $build_started"
164 # Apparently option parsing succeeded. Print out the results.
165 echo "//Options: --prefix='$SBCL_PREFIX' --xc-host='$SBCL_XC_HOST'"
168 # Save prefix for make and install.sh.
169 echo "SBCL_PREFIX='$SBCL_PREFIX'" > output/prefix.def
170 echo "$SBCL_DYNAMIC_SPACE_SIZE" > output/dynamic-space-size.txt
172 # FIXME: Tweak this script, and the rest of the system, to support
173 # a second bootstrapping pass in which the cross-compilation host is
174 # known to be SBCL itself, so that the cross-compiler can do some
175 # optimizations (especially specializable arrays) that it doesn't
176 # know how to implement how in a portable way. (Or maybe that wouldn't
177 # require a second pass, just testing at build-the-cross-compiler time
178 # whether the cross-compilation host returns suitable values from
179 # UPGRADED-ARRAY-ELEMENT-TYPE?)
181 if [ "$OSTYPE" = "cygwin" -o "$OSTYPE" = "msys" ] ; then
191 # If you're cross-compiling, you should probably just walk through the
192 # make-config.sh script by hand doing the right thing on both the host
193 # and target machines.
196 # Enforce the source policy for no bogus whitespace
197 tools-for-build/canonicalize-whitespace
199 # The make-host-*.sh scripts are run on the cross-compilation host,
200 # and the make-target-*.sh scripts are run on the target machine. In
201 # ordinary compilation, we just do these phases consecutively on the
202 # same machine, but if you wanted to cross-compile from one machine
203 # which supports Common Lisp to another which does not (yet:-) support
204 # Common Lisp, you could do something like this:
205 # Create copies of the source tree on both the host and the target.
206 # Read the make-config.sh script carefully and emulate it by hand
207 # on both machines (e.g. creating "target"-named symlinks to
208 # identify the target architecture).
209 # On the host system:
210 # SBCL_XC_HOST=<whatever> sh make-host-1.sh
211 # Copy src/runtime/genesis/*.h from the host system to the target
213 # On the target system:
214 # sh make-target-1.sh
215 # Copy src/runtime/sbcl.nm and output/stuff-groveled-from-headers.lisp
216 # from the target system to the host system.
217 # On the host system:
218 # SBCL_XC_HOST=<whatever> sh make-host-2.sh
219 # Copy output/cold-sbcl.core from the host system to the target system.
220 # On the target system:
221 # sh make-target-2.sh
222 # sh make-target-contrib.sh
223 # Or, if you can set up the files somewhere shared (with NFS, AFS, or
224 # whatever) between the host machine and the target machine, the basic
225 # procedure above should still work, but you can skip the "copy" steps.
226 time sh make-host-1.sh
227 time sh make-target-1.sh
228 time sh make-host-2.sh
229 time sh make-target-2.sh
230 time sh make-target-contrib.sh
232 NCONTRIBS=`find contrib -name Makefile -print | wc -l`
233 NPASSED=`find contrib -name test-passed -print | wc -l`
235 echo "The build seems to have finished successfully, including $NPASSED (out of $NCONTRIBS)"
236 echo "contributed modules. If you would like to run more extensive tests on"
237 echo "the new SBCL, you can try:"
239 echo " cd tests && sh ./run-tests.sh"
241 echo " (All tests should pass on x86/Linux, x86/FreeBSD4, and ppc/Darwin. On"
242 echo " other platforms some failures are currently expected; patches welcome"
245 echo "To build documentation:"
247 echo " cd doc/manual && make"
249 echo "To install SBCL (more information in INSTALL):"
251 echo " sh install.sh"
253 # This is probably the best place to ensure people will see this.
254 if test -n "$legacy_xc_spec"
257 ******************************************************************************
259 ** Old-style XC-host specification detected: '$SBCL_XC_HOST'
261 ** Since 1.0.41.45 SBCL expects the XC-host to be specified using
262 ** the --xc-host='myhost' command line option, not with a positional
263 ** argument. The legacy style still works, but will not be supported
264 ** indefinitely. Please update your build procedure.
266 ******************************************************************************
270 build_finished=`date`
272 echo "//build started: $build_started"
273 echo "//build finished: $build_finished"