0.9.1.2:
[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 --disable-debugger"
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 #                 (probably by dying with an error code) instead of waiting
32 #                 endlessly for a programmer to help it out with input
33 #                 on *DEBUG-IO*
34 #   "lisp -batch" to use an existing CMU CL binary as a cross-compilation host
35 #   "lisp -noinit -batch" 
36 #                 to use an existing CMU CL binary as a cross-compilation host
37 #                 when you have weird things in your .cmucl-init file
38 #   "openmcl --batch"
39 #                 to use an OpenMCL binary as a cross-compilation host
40 #   "clisp"
41 #                 to use a CLISP binary as a cross-compilation host
42 #
43 # FIXME: Make a more sophisticated command line parser, probably
44 # accepting "sh make.sh --xc-host foolisp" instead of the
45 # the present "sh make.sh foolisp".
46 # FIXME: Tweak this script, and the rest of the system, to support
47 # a second bootstrapping pass in which the cross-compilation host is
48 # known to be SBCL itself, so that the cross-compiler can do some
49 # optimizations (especially specializable arrays) that it doesn't
50 # know how to implement how in a portable way. (Or maybe that wouldn't
51 # require a second pass, just testing at build-the-cross-compiler time
52 # whether the cross-compilation host returns suitable values from 
53 # UPGRADED-ARRAY-ELEMENT-TYPE?)
54
55 LANG=C
56 export LANG
57
58 build_started=`date`
59 echo "//starting build: $build_started"
60
61 SBCL_XC_HOST="${1:-sbcl --disable-debugger --userinit /dev/null --sysinit /dev/null}"
62 export SBCL_XC_HOST
63 echo //SBCL_XC_HOST=\"$SBCL_XC_HOST\"
64
65 . ./find-gnumake.sh
66 find_gnumake
67
68 # If you're cross-compiling, you should probably just walk through the
69 # make-config.sh script by hand doing the right thing on both the host
70 # and target machines.
71 sh make-config.sh || exit 1
72
73 # The make-host-*.sh scripts are run on the cross-compilation host,
74 # and the make-target-*.sh scripts are run on the target machine. In
75 # ordinary compilation, we just do these phases consecutively on the
76 # same machine, but if you wanted to cross-compile from one machine
77 # which supports Common Lisp to another which does not (yet:-) support
78 # Common Lisp, you could do something like this:
79 #   Create copies of the source tree on both the host and the target.
80 #   Read the make-config.sh script carefully and emulate it by hand
81 #     on both machines (e.g. creating "target"-named symlinks to
82 #     identify the target architecture).
83 #   On the host system:
84 #     SBCL_XC_HOST=<whatever> sh make-host-1.sh
85 #   Copy src/runtime/genesis/*.h from the host system to the target 
86 #     system.
87 #   On the target system:
88 #     sh make-target-1.sh
89 #   Copy src/runtime/sbcl.nm and output/stuff-groveled-from-headers.lisp
90 #     from the target system to the host system.
91 #   On the host system:
92 #     SBCL_XC_HOST=<whatever> sh make-host-2.sh
93 #   Copy output/cold-sbcl.core from the host system to the target system.
94 #   On the target system:
95 #     sh make-target-2.sh
96 #     sh make-target-contrib.sh
97 # Or, if you can set up the files somewhere shared (with NFS, AFS, or
98 # whatever) between the host machine and the target machine, the basic
99 # procedure above should still work, but you can skip the "copy" steps.
100 time sh make-host-1.sh   || exit 1
101 time sh make-target-1.sh || exit 1
102 time sh make-host-2.sh   || exit 1
103 time sh make-target-2.sh || exit 1
104 time sh make-target-contrib.sh || exit 1
105
106 # Sometimes people used to see the "No tests failed." output from the last
107 # DEFTEST in contrib self-tests and think that's all that is. So...
108 HEADER_HAS_BEEN_PRINTED=false
109 for dir in contrib/*
110 do
111   if [ -d "$dir" -a -f "$dir/Makefile" -a ! -f "$dir/test-passed" ]; then
112       if $HEADER_HAS_BEEN_PRINTED; then
113           echo > /dev/null
114       else
115           echo "Failed contribs:"
116           HEADER_HAS_BEEN_PRINTED=true
117       fi
118       echo "  `basename $dir`"
119   fi
120 done
121
122 NCONTRIBS=`find contrib -name Makefile -print | wc -l`
123 NPASSED=`find contrib -name test-passed -print | wc -l`
124
125 echo
126 echo "The build seems to have finished successfully, including $NPASSED (out of $NCONTRIBS)"
127 echo "contributed modules. If you would like to run more extensive tests on" 
128 echo "the new SBCL, you can try:"
129 echo
130 echo "  cd tests && sh ./run-tests.sh"
131 echo
132 echo "  (All tests should pass on x86/Linux, x86/FreeBSD4, and ppc/Darwin. On"
133 echo "  other platforms some failures are currently expected; patches welcome"
134 echo "  as always.)"
135 echo
136 echo "To build documentation:"
137 echo
138 echo "  cd doc/manual && make"
139 echo
140 echo "To install SBCL (more information in INSTALL):"
141 echo
142 echo "  sh install.sh" 
143
144 build_finished=`date`
145 echo
146 echo "//build started:  $build_started"
147 echo "//build finished: $build_finished"