/ build-asteroid.lisp
build-asteroid.lisp
 1  ;; -*-lisp-*-
 2  
 3  (unless *load-pathname*
 4    (error "Please LOAD this file."))
 5  
 6  (defpackage #:asteroid-bootstrap
 7    (:nicknames #:ab)
 8    (:use #:cl)
 9    (:export #:*root* #:path))
10  
11  (in-package #:asteroid-bootstrap)
12  
13  (defvar *root* (make-pathname :name NIL :type NIL :defaults *load-pathname*))
14  
15  (defun path (pathname)
16    (merge-pathnames pathname *root*))
17  
18  ;; we require quicklisp to load our transitive dependencies.
19  (load "~/quicklisp/setup.lisp")
20  
21  
22  ;; Build script for creating asteroid executable using save-lisp-and-die
23  ;; ASDF will automatically find the project via source-registry.conf
24  
25  ;; Load RADIANCE first, then handle environment
26  (ql:quickload :radiance)
27  
28  ;; (defmethod radiance:environment-directory (environment (kind (eql :configuration)))
29  ;;   (ab:path (make-pathname :directory `(:relative "config" ,environment))))
30  
31  ;; (defmethod radiance:environment-directory (environment (kind (eql :cache)))
32  ;;   (ab:path (make-pathname :directory `(:relative "cache" ,environment))))
33  
34  ;; (defmethod radiance:environment-directory (environment (kind (eql :data)))
35  ;;   (ab:path (make-pathname :directory `(:relative "data" ,environment))))
36  
37  ;; (defmethod radiance:environment-directory (environment (kind (eql :template)))
38  ;;   (ab:path (make-pathname :directory `(:relative "override" ,environment "template"))))
39  
40  ;; (defmethod radiance:environment-directory (environment (kind (eql :static)))
41  ;;   (ab:path (make-pathname :directory `(:relative "override" ,environment "static"))))
42  
43  ;; Ensure RADIANCE environment is set before loading
44  (unless (radiance:environment)
45    (setf (radiance:environment) "asteroid"))
46  
47  ;; Load the system with RADIANCE environment handling
48  (handler-bind ((radiance-core:environment-not-set 
49                   (lambda (c)
50                     (declare (ignore c))
51                     (invoke-restart 'continue))))
52    (ql:quickload :asteroid))
53  
54  (log:info "~2&~15A - ~A~%~15A - ~A~%~15A - ~A~%~15A - ~A~%~15A - ~A~2%"
55            ":configuration"
56            (radiance:environment-directory (radiance-core:environment) :configuration)
57            ":cache"
58            (radiance:environment-directory (radiance-core:environment) :cache)
59            ":data"
60            (radiance:environment-directory (radiance-core:environment) :data)
61            ":template"
62            (radiance:environment-directory (radiance-core:environment) :template)
63            ":static"
64            (radiance:environment-directory (radiance-core:environment) :static))
65  
66  ;; Define the main function for the executable
67  (defun main ()
68    (asteroid:-main))
69  
70  ;; Save the executable
71  (sb-ext:save-lisp-and-die "asteroid" 
72                            :toplevel #'main
73                            :executable t
74                            :compression 12)
75