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