0.8.14.13: Step SBCL, step!
[sbcl.git] / make-target-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-target-2.sh
17
18 # Do warm init stuff, e.g. building and loading CLOS, and stuff which
19 # can't be done until CLOS is running.
20 #
21 # Note that it's normal for the newborn system to think rather hard at
22 # the beginning of this process (e.g. using nearly 100Mb of virtual memory
23 # and >30 seconds of CPU time on a 450MHz CPU), and unless you built the
24 # system with the :SB-SHOW feature enabled, it does it rather silently,
25 # without trying to tell you about what it's doing. So unless it hangs
26 # for much longer than that, don't worry, it's likely to be normal.
27 echo //doing warm init
28 ./src/runtime/sbcl \
29 --core output/cold-sbcl.core \
30 --sysinit /dev/null --userinit /dev/null <<-'EOF' || exit 1
31         ;; Now that we use the compiler for macros, interpreted
32         ;; /SHOW doesn't work until later in init.
33         #+sb-show (print "/hello, world!")
34         (sb!ext:purify)
35
36         ;; Until PRINT-OBJECT and other machinery is set up,
37         ;; we want limits on printing to avoid infinite output.
38         ;; (Don't forget to undo these tweaks after the printer
39         ;; is set up. It'd be cleaner to use LET to make sure 
40         ;; that happens automatically, but LET is implemented
41         ;; in terms of the compiler, and the compiler isn't 
42         ;; initialized yet.)
43         (setq *print-length* 10)
44         (setq *print-level* 5)
45         (setq *print-circle* t)
46
47         ;; Do warm init.
48         #+sb-show (print "/about to LOAD warm.lisp")
49         (load "src/cold/warm.lisp")
50
51         ;; Unintern no-longer-needed stuff before the possible PURIFY
52         ;; in SAVE-LISP-AND-DIE.
53         #-sb-fluid (sb-impl::!unintern-init-only-stuff)
54
55         ;; Now that the whole system is built, we don't need to 
56         ;; hobble the printer any more, so we can restore printer 
57         ;; control variables to their ANSI defaults.
58         (setq *print-length* nil)
59         (setq *print-level* nil)
60         (setq *print-circle* nil)
61
62         ;; FIXME: Why is it that, at least on x86 sbcl-0.6.12.46,
63         ;; GC :FULL T isn't nearly as effective as PURIFY here?
64         ;; (GC :FULL T gets us down to about 38 Mbytes, but PURIFY
65         ;; gets us down to about 19 Mbytes.)
66         (sb-int:/show "done with warm.lisp, about to GC :FULL T")
67         (gc :full t)
68
69         ;; resetting compilation policy to neutral values in
70         ;; preparation for SAVE-LISP-AND-DIE as final SBCL core (not
71         ;; in warm.lisp because SB-C::*POLICY* has file scope)
72         (sb-int:/show "setting compilation policy to neutral values")
73         (proclaim '(optimize (compilation-speed 1)
74                              (debug 1)
75                              (inhibit-warnings 1)
76                              (safety 1)
77                              (space 1)
78                              (speed 1)))
79
80         ;; Lock internal packages
81         #+sb-package-locks
82         (dolist (p (list-all-packages))
83           (unless (member p (mapcar #'find-package '(:keyword :cl-user)))
84              (lock-package p)))
85
86         (sb-int:/show "done with warm.lisp, about to SAVE-LISP-AND-DIE")
87         ;; Even if /SHOW output was wanted during build, it's probably
88         ;; not wanted by default after build is complete. (And if it's
89         ;; wanted, it can easily be turned back on.)
90         #+sb-show (setf sb-int:*/show* nil)
91         ;; The system is complete now, all standard functions are
92         ;; defined.
93         (setq sb-c::*flame-on-necessarily-undefined-function* t)
94         (sb-ext:save-lisp-and-die "output/sbcl.core" :purify t)
95         EOF