0.9.4.72:
[sbcl.git] / make-genesis-2.sh
1 #!/bin/sh
2 set -e
3
4 # This is a script to be run as part of make.sh. The only time you'd
5 # want to run it by itself is if you're trying to cross-compile the
6 # system or if you're doing some kind of troubleshooting.
7
8 # This software is part of the SBCL system. See the README file for
9 # more information.
10 #
11 # This software is derived from the CMU CL system, which was
12 # written at Carnegie Mellon University and released into the
13 # public domain. The software is in the public domain and is
14 # provided with absolutely no warranty. See the COPYING and CREDITS
15 # files for more information.
16
17 echo //entering make-genesis-2.sh
18
19 # In a fresh host Lisp invocation, load the cross-compiler (in order
20 # to get various definitions that GENESIS needs, not in order to
21 # cross-compile GENESIS, then load and run GENESIS. (We use a fresh
22 # host Lisp invocation here for basically the same reasons we did
23 # before when loading and running the cross-compiler.)
24 #
25 # (Why do we need this second invocation of GENESIS? In order to
26 # create a .core file, as opposed to just a .h file, GENESIS needs
27 # symbol table data on the C runtime. And we can get that symbol
28 # data only after the C runtime has been built. Therefore, even
29 # though we ran GENESIS earlier, we couldn't get it to make a .core
30 # file at that time; but we needed to run it earlier in order to 
31 # get to where we can write a .core file.)
32 echo //loading and running GENESIS to create cold-sbcl.core
33 $SBCL_XC_HOST <<-'EOF'
34         (setf *print-level* 5 *print-length* 5)
35         (load "src/cold/shared.lisp")
36         (in-package "SB-COLD")
37         (setf *host-obj-prefix* "obj/from-host/"
38               *target-obj-prefix* "obj/from-xc/")
39         (load "src/cold/set-up-cold-packages.lisp")
40         (load "src/cold/defun-load-or-cload-xcompiler.lisp")
41         (load-or-cload-xcompiler #'host-load-stem)
42         (defparameter *target-object-file-names*
43           (with-open-file (s "output/object-filenames-for-genesis.lisp-expr"
44                              :direction :input)
45             (read s)))
46         (host-load-stem "src/compiler/generic/genesis")
47         (sb!vm:genesis :object-file-names *target-object-file-names*
48                        :c-header-dir-name "output/genesis-2"
49                        :symbol-table-file-name "src/runtime/sbcl.nm"
50                        :core-file-name "output/cold-sbcl.core"
51                        ;; The map file is not needed by the system, but can
52                        ;; be very handy when debugging cold init problems.
53                        :map-file-name "output/cold-sbcl.map")
54         #+cmu (ext:quit)
55         #+clisp (ext:quit)
56         #+abcl (ext:quit)
57         EOF
58
59 echo //testing for consistency of first and second GENESIS passes
60 if diff -r src/runtime/genesis output/genesis-2; then
61     echo //header files match between first and second GENESIS -- good
62 else
63     echo error: header files do not match between first and second GENESIS
64     exit 1
65 fi