2.3.6: will be tagged as "sbcl-2.3.6"
[sbcl.git] / make.sh
blob30ca5ce49209c5b63a3c0c97ef465b9308aee523
1 #!/bin/sh
2 set -e
4 LANG=C
5 LC_ALL=C
6 export LANG LC_ALL
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
15 # more information.
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.
23 # If you're cross-compiling, make-config.sh should "do the right
24 # thing" when run on the target machine, with the minor caveat that
25 # any --xc-host parameter should be suitable for the host machine
26 # instead of the target.
27 sh make-config.sh "$@" --check-host-lisp || exit $?
29 . output/prefix.def
30 . output/build-config
32 build_started=`date`
33 echo "//Starting build: $build_started"
34 # Apparently option parsing succeeded. Print out the results.
35 echo "//Options: --prefix='$SBCL_PREFIX' --xc-host='$SBCL_XC_HOST'"
37 # Enforce the source policy for no bogus whitespace
38 $SBCL_XC_HOST < tools-for-build/canonicalize-whitespace.lisp || exit 1
40 # The make-host-*.sh scripts are run on the cross-compilation host,
41 # and the make-target-*.sh scripts are run on the target machine. In
42 # ordinary compilation, we just do these phases consecutively on the
43 # same machine, but if you wanted to cross-compile from one machine
44 # which supports Common Lisp to another which does not (yet:-) support
45 # Common Lisp, you could do something like this:
46 # Create copies of the source tree on both the host and the target.
47 # Read the make-config.sh script carefully and emulate it by hand
48 # on both machines (e.g. creating "target"-named symlinks to
49 # identify the target architecture).
50 # On the host system:
51 # SBCL_XC_HOST=<whatever> sh make-host-1.sh
52 # Copy src/runtime/genesis/*.h from the host system to the target
53 # system.
54 # On the target system:
55 # sh make-target-1.sh
56 # Copy src/runtime/sbcl.nm and output/stuff-groveled-from-headers.lisp
57 # from the target system to the host system.
58 # On the host system:
59 # SBCL_XC_HOST=<whatever> sh make-host-2.sh
60 # Copy output/cold-sbcl.core from the host system to the target system.
61 # On the target system:
62 # sh make-target-2.sh
63 # sh make-target-contrib.sh
64 # Or, if you can set up the files somewhere shared (with NFS, AFS, or
65 # whatever) between the host machine and the target machine, the basic
66 # procedure above should still work, but you can skip the "copy" steps.
67 # If you can use rsync on the host machine, you can call make-config.sh
68 # with:
69 # --host-location=user@host-machine:<rsync path to host sbcl directory>
70 # and the make-target-*.sh scripts will take care of transferring the
71 # necessary files.
72 maybetime() {
73 if command -v time > /dev/null ; then
74 time $@
75 else
79 maybetime sh make-host-1.sh
80 maybetime sh make-target-1.sh
81 maybetime sh make-host-2.sh
82 maybetime sh make-target-2.sh
83 maybetime sh make-target-contrib.sh
85 # Confirm that default evaluation strategy is :INTERPRET if sb-fasteval was built
86 src/runtime/sbcl --core output/sbcl.core --lose-on-corruption --noinform \
87 --no-sysinit --no-userinit --disable-debugger \
88 --eval '(when (find-package "SB-INTERPRETER") (assert (eq *evaluator-mode* :interpret)))' \
89 --quit
91 echo //checking for leftover cold-init symbols
92 ./src/runtime/sbcl --core output/sbcl.core \
93 --lose-on-corruption --noinform $SBCL_MAKE_TARGET_2_OPTIONS --no-sysinit --no-userinit --eval '
94 (restart-case
95 (let (l1 l2)
96 (sb-vm:map-allocated-objects
97 (lambda (obj type size)
98 (declare (ignore size))
99 (when (and (= type sb-vm:symbol-widetag) (not (symbol-package obj))
100 (search "!" (string obj)))
101 (push obj l1))
102 (when (and (= type sb-vm:fdefn-widetag)
103 (not (symbol-package
104 (sb-int:fun-name-block-name
105 (sb-kernel:fdefn-name obj)))))
106 (push obj l2)))
107 :all)
108 (when l1 (format t "Found ~D:~%~S~%" (length l1) l1))
109 (sb-int:awhen
110 (mapcan (quote apropos-list)
111 (quote ("DEFINE-INFO-TYPE" "LVAR-TYPE-USING"
112 "TWO-ARG-+/-"
113 "PPRINT-TAGBODY-GUTS" "WITH-DESCRIPTOR-HANDLERS"
114 "SUBTRACT-BIGNUM-LOOP" "BIGNUM-REPLACE" "WITH-BIGNUM-BUFFERS"
115 "GCD-ASSERT" "MODULARLY" "BIGNUM-NEGATE-LOOP"
116 "SHIFT-RIGHT-UNALIGNED"
117 "STRING-LESS-GREATER-EQUAL-TESTS")))
118 (format t "~&Leftover from [disabled?] tree-shaker:~%~S~%" sb-int:it))
119 (when l2
120 (format t "Found ~D fdefns named by uninterned symbols:~%~S~%" (length l2) l2)))
121 (abort-build ()
122 :report "Abort building SBCL."
123 (sb-ext:exit :code 1)))' --quit
125 # contrib/Makefile shouldn't be counted in NCONTRIBS nor should asdf and uiop.
126 # The asdf directory produces 2 fasls, so is unlike all our other contribs
127 # and would therefore mess up the accounting here if included.
128 NCONTRIBS=`ls -1 contrib/sb-*/Makefile | wc -l`
129 NPASSED=`ls obj/sbcl-home/contrib/sb-*.fasl | wc -l`
130 echo
131 echo "The build seems to have finished successfully, including $NPASSED (out of $NCONTRIBS)"
132 echo "contributed modules. If you would like to run more extensive tests on"
133 echo "the new SBCL, you can try:"
134 echo
135 echo " cd ./tests && sh ./run-tests.sh"
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"