raz / sbcl / build.lisp

25 lines · 1.2 KiB · raw · history · last change a61882bd

1;;;; build.lisp -- builds the compiler: `sbcl --script build.lisp` writes
2;;;; ./raz, an SBCL image holding the compiler, which it saves again, with
3;;;; the program added, as each executable it makes.
4
5(require :sb-introspect)
6
7(defparameter *sources* '("package" "scan" "types" "rt" "comp" "expr" "stmt" "decl" "driver"))
8
9(let ((*compile-verbose* nil) (*compile-print* nil))
10 (handler-bind ((warning (lambda (w)
11 ;; style warnings about the order of definitions are no matter
12 (when (typep w 'style-warning) (muffle-warning w)))))
13 (with-compilation-unit ()
14 (dolist (f *sources*)
15 (let ((src (format nil "src/~a.lisp" f))
16 (fasl (format nil "build/~a.fasl" f)))
17 (ensure-directories-exist fasl)
18 (multiple-value-bind (out warnings failure) (compile-file src :output-file (merge-pathnames fasl))
19 (declare (ignore warnings))
20 ;; an error or a full warning in the compiler stops the build
21 (when failure (format t "~a doesn't compile~%" src) (sb-ext:exit :code 1))
22 (load out)))))))
23
24(sb-ext:save-lisp-and-die "raz" :executable t :toplevel (intern "MAIN" :raz)
25 :save-runtime-options t)