0.7.1.18:
[sbcl.git] / make.sh
1 '#!/bin/sh
2
3 # "When we build software, it's a good idea to have a reliable method
4 # for getting an executable from it. We want any two reconstructions
5 # starting from the same source to end up in the same result. That's
6 # just a basic intellectual premise."
7 #     -- Christian Queinnec, in _Lisp In Small Pieces_, p. 313
8
9 # This software is part of the SBCL system. See the README file for
10 # more information.
11 #
12 # This software is derived from the CMU CL system, which was
13 # written at Carnegie Mellon University and released into the
14 # public domain. The software is in the public domain and is
15 # provided with absolutely no warranty. See the COPYING and CREDITS
16 # files for more information.
17
18 # The value of SBCL_XC_HOST should be a command to invoke the
19 # cross-compilation Lisp system in such a way that it reads commands
20 # from standard input, and terminates when it reaches end of file on
21 # standard input. Some suitable values are:
22 #   "sbcl"        to use an existing SBCL binary as a cross-compilation host
23 #   "sbcl --sysinit /dev/null --userinit /dev/null"
24 #                 to use an existing SBCL binary as a cross-compilation host
25 #                 even though you have stuff in your initialization files
26 #                 which makes it behave in such a non-standard way that
27 #                 it keeps the build from working
28 #   "sbcl --noprogrammer"
29 #                 to use an existing SBCL binary as a cross-compilation host
30 #                 and tell it to handle errors as best it can by itself,
31 #                 without trying to use *DEBUG-IO* to ask for help from
32 #                 the programmer
33 #   "lisp -batch" to use an existing CMU CL binary as a cross-compilation host
34 #   "lisp -noinit -batch" 
35 #                 to use an existing CMU CL binary as a cross-compilation host
36 #                 when you have weird things in your .cmucl-init file
37 # Someday CLISP should work
38 #   "clisp"
39 # but as of sbcl-0.7.1.17, it still doesn't. (SBCL's fault: too much 
40 # unportable code!)
41 #
42 # FIXME: Make a more sophisticated command line parser, probably
43 # accepting "sh make.sh --xc-host foolisp" instead of the
44 # the present "sh make.sh foolisp".
45 # FIXME: Tweak this script, and the rest of the system, to support
46 # a second bootstrapping pass in which the cross-compilation host is
47 # known to be SBCL itself, so that the cross-compiler can do some
48 # optimizations (especially specializable arrays) that it doesn't
49 # know how to implement how in a portable way. (Or maybe that wouldn't
50 # require a second pass, just testing at build-the-cross-compiler time
51 # whether the cross-compilation host returns suitable values from 
52 # UPGRADED-ARRAY-ELEMENT-TYPE?)
53 export SBCL_XC_HOST="${1:-sbcl --noprogrammer}"
54 echo //SBCL_XC_HOST=\"$SBCL_XC_HOST\"
55
56 # If you're cross-compiling, you should probably just walk through the
57 # make-config.sh script by hand doing the right thing on both the host
58 # and target machines.
59 sh make-config.sh || exit 1
60
61 # The make-host-*.sh scripts are run on the cross-compilation host,
62 # and the make-target-*.sh scripts are run on the target machine. In
63 # ordinary compilation, we just do these phases consecutively on the
64 # same machine, but if you wanted to cross-compile from one machine
65 # which supports Common Lisp to another which does not (yet:-) support
66 # Common Lisp, you could do something like this:
67 #   Create copies of the source tree on both the host and the target.
68 #   Read the make-config.sh script carefully and emulate it by hand
69 #     on both machines (e.g. creating "target"-named symlinks to
70 #     identify the target architecture).
71 #   On the host system:
72 #     SBCL_XC_HOST=<whatever> sh make-host-1.sh
73 #   Copy src/runtime/sbcl.h from the host system to the target system.
74 #   On the target system:
75 #     sh make-target-1.sh
76 #   Copy src/runtime/sbcl.nm from the target system to the host system.
77 #   On the host system:
78 #     SBCL_XC_HOST=<whatever> sh make-host-2.sh
79 #   Copy output/cold-sbcl.core from the host system to the target system.
80 #   On the target system:
81 #     sh make-host-2.sh
82 sh make-host-1.sh   || exit 1
83 sh make-target-1.sh || exit 1
84 sh make-host-2.sh   || exit 1
85 sh make-target-2.sh || exit 1
86 date