1.0.29.51: correctly compute default initargs for FAST-MAKE-INSTANCE
[sbcl/pkhuong.git] / make.sh
blob12e77610dadd4930df5f16650c6745cca057b614
1 #!/bin/sh
2 set -e
4 # "When we build software, it's a good idea to have a reliable method
5 # for getting an executable from it. We want any two reconstructions
6 # starting from the same source to end up in the same result. That's
7 # just a basic intellectual premise."
8 # -- Christian Queinnec, in _Lisp In Small Pieces_, p. 313
10 # This software is part of the SBCL system. See the README file for
11 # more information.
13 # This software is derived from the CMU CL system, which was
14 # written at Carnegie Mellon University and released into the
15 # public domain. The software is in the public domain and is
16 # provided with absolutely no warranty. See the COPYING and CREDITS
17 # files for more information.
19 # The value of SBCL_XC_HOST should be a command to invoke the
20 # cross-compilation Lisp system in such a way that it reads commands
21 # from standard input, and terminates when it reaches end of file on
22 # standard input. Some suitable values are:
23 # "sbcl" to use an existing SBCL binary as a cross-compilation host
24 # "sbcl --sysinit /dev/null --userinit /dev/null"
25 # to use an existing SBCL binary as a cross-compilation host
26 # even though you have stuff in your initialization files
27 # which makes it behave in such a non-standard way that
28 # it keeps the build from working
29 # "sbcl --disable-debugger"
30 # to use an existing SBCL binary as a cross-compilation host
31 # and tell it to handle errors as best it can by itself
32 # (probably by dying with an error code) instead of waiting
33 # endlessly for a programmer to help it out with input
34 # on *DEBUG-IO*
35 # "lisp -batch" to use an existing CMU CL binary as a cross-compilation host
36 # "lisp -noinit -batch"
37 # to use an existing CMU CL binary as a cross-compilation host
38 # when you have weird things in your .cmucl-init file
39 # "openmcl --batch"
40 # to use an OpenMCL binary as a cross-compilation host
41 # "clisp"
42 # to use a CLISP binary as a cross-compilation host
44 # FIXME: Make a more sophisticated command line parser, probably
45 # accepting "sh make.sh --xc-host foolisp" instead of the
46 # the present "sh make.sh foolisp".
47 # FIXME: Tweak this script, and the rest of the system, to support
48 # a second bootstrapping pass in which the cross-compilation host is
49 # known to be SBCL itself, so that the cross-compiler can do some
50 # optimizations (especially specializable arrays) that it doesn't
51 # know how to implement how in a portable way. (Or maybe that wouldn't
52 # require a second pass, just testing at build-the-cross-compiler time
53 # whether the cross-compilation host returns suitable values from
54 # UPGRADED-ARRAY-ELEMENT-TYPE?)
56 LANG=C
57 LC_ALL=C
58 export LANG LC_ALL
60 build_started=`date`
61 echo "//starting build: $build_started"
63 if [ "$OSTYPE" = "cygwin" -o "$OSTYPE" = "msys" ] ; then
64 DEVNULL=NUL
65 else
66 DEVNULL=/dev/null
68 # The classic form here was to use --userinit $DEVNULL --sysinit
69 # $DEVNULL, but that doesn't work on Win32 because SBCL doesn't handle
70 # device names properly. We still need $DEVNULL to be NUL on Win32
71 # because it's used elsewhere (such as canonicalize-whitespace), so we
72 # need an alternate solution for the init file overrides. It turns
73 # out that version.lisp-expr has no side effects from evaluation, so
74 # we may as well use that.
75 SBCL_XC_HOST="${1:-sbcl --disable-debugger --userinit version.lisp-expr --sysinit version.lisp-expr}"
76 export DEVNULL
77 export SBCL_XC_HOST
78 echo //SBCL_XC_HOST=\"$SBCL_XC_HOST\"
80 . ./find-gnumake.sh
81 find_gnumake
83 # If you're cross-compiling, you should probably just walk through the
84 # make-config.sh script by hand doing the right thing on both the host
85 # and target machines.
86 sh make-config.sh
88 # Enforce the source policy for no bogus whitespace
89 tools-for-build/canonicalize-whitespace
91 # The make-host-*.sh scripts are run on the cross-compilation host,
92 # and the make-target-*.sh scripts are run on the target machine. In
93 # ordinary compilation, we just do these phases consecutively on the
94 # same machine, but if you wanted to cross-compile from one machine
95 # which supports Common Lisp to another which does not (yet:-) support
96 # Common Lisp, you could do something like this:
97 # Create copies of the source tree on both the host and the target.
98 # Read the make-config.sh script carefully and emulate it by hand
99 # on both machines (e.g. creating "target"-named symlinks to
100 # identify the target architecture).
101 # On the host system:
102 # SBCL_XC_HOST=<whatever> sh make-host-1.sh
103 # Copy src/runtime/genesis/*.h from the host system to the target
104 # system.
105 # On the target system:
106 # sh make-target-1.sh
107 # Copy src/runtime/sbcl.nm and output/stuff-groveled-from-headers.lisp
108 # from the target system to the host system.
109 # On the host system:
110 # SBCL_XC_HOST=<whatever> sh make-host-2.sh
111 # Copy output/cold-sbcl.core from the host system to the target system.
112 # On the target system:
113 # sh make-target-2.sh
114 # sh make-target-contrib.sh
115 # Or, if you can set up the files somewhere shared (with NFS, AFS, or
116 # whatever) between the host machine and the target machine, the basic
117 # procedure above should still work, but you can skip the "copy" steps.
118 time sh make-host-1.sh
119 time sh make-target-1.sh
120 time sh make-host-2.sh
121 time sh make-target-2.sh
122 time sh make-target-contrib.sh
124 NCONTRIBS=`find contrib -name Makefile -print | wc -l`
125 NPASSED=`find contrib -name test-passed -print | wc -l`
126 echo
127 echo "The build seems to have finished successfully, including $NPASSED (out of $NCONTRIBS)"
128 echo "contributed modules. If you would like to run more extensive tests on"
129 echo "the new SBCL, you can try:"
130 echo
131 echo " cd tests && sh ./run-tests.sh"
132 echo
133 echo " (All tests should pass on x86/Linux, x86/FreeBSD4, and ppc/Darwin. On"
134 echo " other platforms some failures are currently expected; patches welcome"
135 echo " as always.)"
136 echo
137 echo "To build documentation:"
138 echo
139 echo " cd doc/manual && make"
140 echo
141 echo "To install SBCL (more information in INSTALL):"
142 echo
143 echo " sh install.sh"
145 build_finished=`date`
146 echo
147 echo "//build started: $build_started"
148 echo "//build finished: $build_finished"