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> Default dynamic-space size for target.
126 This specifies the default dynamic-space size for the SBCL
127 being built. If you need to control the dynamic-space size
128 of the host SBCL, use the --xc-host option.
130 If not provided, the default is platform-specific. <size> is
131 taken to be megabytes unless explicitly suffixed with Gb in
132 order to specify the size in gigabytes.
134 --xc-host=<string> Specify the Common Lisp compilation host.
136 The string provided should be a command to invoke the
137 cross-compilation Lisp system in such a way, that it reads
138 commands from standard input, and terminates when it reaches end
139 of file on standard input.
143 "sbcl --disable-debugger --no-sysinit --no-userinit"
144 Use an existing SBCL binary as a cross-compilation
145 host even though you have stuff in your
146 initialization files which makes it behave in such a
147 non-standard way that it keeps the build from
148 working. Also disable the debugger instead of
149 waiting endlessly for a programmer to help it out
150 with input on *DEBUG-IO*. (This is the default.)
153 Use an existing SBCL binary as a cross-compilation
154 host, including your initialization files and
155 building with the debugger enabled. Not recommended
158 "lisp -noinit -batch"
159 Use an existing CMU CL binary as a cross-compilation
160 host when you have weird things in your .cmucl-init
167 echo "//Starting build: $build_started"
168 # Apparently option parsing succeeded. Print out the results.
169 echo "//Options: --prefix='$SBCL_PREFIX' --xc-host='$SBCL_XC_HOST'"
172 # Save prefix for make and install.sh.
173 echo "SBCL_PREFIX='$SBCL_PREFIX'" > output/prefix.def
174 echo "$SBCL_DYNAMIC_SPACE_SIZE" > output/dynamic-space-size.txt
176 # FIXME: Tweak this script, and the rest of the system, to support
177 # a second bootstrapping pass in which the cross-compilation host is
178 # known to be SBCL itself, so that the cross-compiler can do some
179 # optimizations (especially specializable arrays) that it doesn't
180 # know how to implement how in a portable way. (Or maybe that wouldn't
181 # require a second pass, just testing at build-the-cross-compiler time
182 # whether the cross-compilation host returns suitable values from
183 # UPGRADED-ARRAY-ELEMENT-TYPE?)
185 if [ "$OSTYPE" = "cygwin" -o "$OSTYPE" = "msys" ] ; then
195 # If you're cross-compiling, you should probably just walk through the
196 # make-config.sh script by hand doing the right thing on both the host
197 # and target machines.
200 # Enforce the source policy for no bogus whitespace
201 tools-for-build/canonicalize-whitespace
203 # The make-host-*.sh scripts are run on the cross-compilation host,
204 # and the make-target-*.sh scripts are run on the target machine. In
205 # ordinary compilation, we just do these phases consecutively on the
206 # same machine, but if you wanted to cross-compile from one machine
207 # which supports Common Lisp to another which does not (yet:-) support
208 # Common Lisp, you could do something like this:
209 # Create copies of the source tree on both the host and the target.
210 # Read the make-config.sh script carefully and emulate it by hand
211 # on both machines (e.g. creating "target"-named symlinks to
212 # identify the target architecture).
213 # On the host system:
214 # SBCL_XC_HOST=<whatever> sh make-host-1.sh
215 # Copy src/runtime/genesis/*.h from the host system to the target
217 # On the target system:
218 # sh make-target-1.sh
219 # Copy src/runtime/sbcl.nm and output/stuff-groveled-from-headers.lisp
220 # from the target system to the host system.
221 # On the host system:
222 # SBCL_XC_HOST=<whatever> sh make-host-2.sh
223 # Copy output/cold-sbcl.core from the host system to the target system.
224 # On the target system:
225 # sh make-target-2.sh
226 # sh make-target-contrib.sh
227 # Or, if you can set up the files somewhere shared (with NFS, AFS, or
228 # whatever) between the host machine and the target machine, the basic
229 # procedure above should still work, but you can skip the "copy" steps.
230 time sh make-host-1.sh
231 time sh make-target-1.sh
232 time sh make-host-2.sh
233 time sh make-target-2.sh
234 time sh make-target-contrib.sh
236 NCONTRIBS=`find contrib -name Makefile -print | wc -l`
237 NPASSED=`find contrib -name test-passed -print | wc -l`
239 echo "The build seems to have finished successfully, including $NPASSED (out of $NCONTRIBS)"
240 echo "contributed modules. If you would like to run more extensive tests on"
241 echo "the new SBCL, you can try:"
243 echo " cd tests && sh ./run-tests.sh"
245 echo " (All tests should pass on x86/Linux, x86/FreeBSD4, and ppc/Darwin. On"
246 echo " other platforms some failures are currently expected; patches welcome"
249 echo "To build documentation:"
251 echo " cd doc/manual && make"
253 echo "To install SBCL (more information in INSTALL):"
255 echo " sh install.sh"
257 # This is probably the best place to ensure people will see this.
258 if test -n "$legacy_xc_spec"
261 ******************************************************************************
263 ** Old-style XC-host specification detected: '$SBCL_XC_HOST'
265 ** Since 1.0.41.45 SBCL expects the XC-host to be specified using
266 ** the --xc-host='myhost' command line option, not with a positional
267 ** argument. The legacy style still works, but will not be supported
268 ** indefinitely. Please update your build procedure.
270 ******************************************************************************
274 build_finished=`date`
276 echo "//build started: $build_started"
277 echo "//build finished: $build_finished"