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