Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ DESTDIR = /usr/local
LISP := sbcl

ifeq ($(LISP),sbcl)
FLAGS=--noinform --no-userinit --no-sysinit --disable-debugger
FLAGS=--no-userinit --no-sysinit --disable-debugger
else
FLAGS=--quiet --no-init
endif
Expand Down
82 changes: 60 additions & 22 deletions buildapp.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,25 @@ Other flags:"
--core-only Make a core file only, not an executable"
#+sbcl
"
--dynamic-space-size MB Pass a --dynamic-space-size option to SBCL
when building; value is megabytes"
--space-size MB Pass a --dynamic-space-size option to SBCL
when building and into the built app; value
is megabytes.
Note that the argument has a *different*
name from the SBCL command line argument.
This is necessary to keep SBCL from
swallowing the argument."
#+sbcl
"
--turn-off-ldb Pass --disable-ldb to SBCL when building (and into the
built application).
Note that the argument has a *different*
name from the SBCL command line argument.
This is necessary to keep SBCL from
swallowing the argument."
"
--help Show this usage message
--logfile FILE Log compilation and load output to FILE"
--logfile FILE Log compilation and load output to FILE
--dumpfile-copy FILE Write a copy of the dumpfile to FILE."
#+sbcl
"
--sbcl PATH-TO-SBCL Use PATH-TO-SBCL instead of the sbcl program
Expand Down Expand Up @@ -382,7 +396,6 @@ it. If an exact filename is not found, file.lisp is also tried."
(let ((*print-case* :downcase))
(write-dumpfile dumper stream))))


(defun main (argv)
"Create an executable from the command-line arguments provided in
ARGV. See *USAGE* for details."
Expand All @@ -397,23 +410,49 @@ ARGV. See *USAGE* for details."
(force-output stream)
(when (dumpfile-copy dumper)
(copy-file file (dumpfile-copy dumper)))
(let ((process (run-program #+sbcl (sbcl dumper)
#+ccl (ccl dumper)
(flatten
(list
#+sbcl
(when dynamic-space-size
(list "--dynamic-space-size"
(princ-to-string
dynamic-space-size)))
#+sbcl "--noinform"
#+ccl "--quiet"
#+sbcl "--disable-debugger"
#+sbcl "--no-userinit"
#+sbcl "--no-sysinit"
#+ccl "--no-init"
"--load" (native-namestring
(probe-file file)))))))
(format t "~&About to recursively start SBCL, dynamic-space-size is ~a~%" dynamic-space-size)
(let ((process
(let ((cmd `(run-program #+sbcl ,(sbcl dumper)
#+ccl ,(ccl dumper)
',(flatten
(list
#+sbcl
(when dynamic-space-size
(list "--dynamic-space-size"
(princ-to-string
dynamic-space-size)))
#+sbcl
(when (disable-ldb dumper)
"--disable-ldb")
#+sbcl "--noinform"
#+ccl "--quiet"
#+sbcl "--disable-debugger"
#+sbcl "--no-userinit"
#+sbcl "--no-sysinit"
#+ccl "--no-init"
"--load" (native-namestring
(probe-file file)))))))
;;(format t "~&running this command to try to build the application:~%")
;;(pprint cmd) (terpri)
(eval cmd))
;; (run-program #+sbcl (sbcl dumper)
;; #+ccl (ccl dumper)
;; (flatten
;; (list
;; #+sbcl
;; (when dynamic-space-size
;; (list "--dynamic-space-size"
;; (princ-to-string
;; dynamic-space-size)))
;; #+sbcl "--noinform"
;; #+ccl "--quiet"
;; #+sbcl "--disable-debugger"
;; #+sbcl "--no-userinit"
;; #+sbcl "--no-sysinit"
;; #+ccl "--no-init"
;; "--load" (native-namestring
;; (probe-file file)))))
))
(if (zerop #+sbcl (sb-ext:process-exit-code process)
#+ccl (ccl::external-process-%exit-code process))
(probe-file (output dumper))
Expand All @@ -438,4 +477,3 @@ ARGV. See *USAGE* for details."
'command-line-debugger))

#+sbcl (pushnew 'buildapp-init sb-ext:*init-hooks*)

12 changes: 6 additions & 6 deletions command-line.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
(setf (compress-core plan) t))
(when (popflag "--core-only" args)
(setf (core-only plan) t))
#+sbcl
(when (popflag "--turn-off-ldb" args)
(setf (slot-value plan 'disable-ldb) t))
(when (oddp (length args))
(error 'odd-number-of-arguments))
(loop
Expand Down Expand Up @@ -142,7 +145,7 @@
(:ccl
(when (ccl plan)
(setf (ccl plan) value)))
(:entry
(:entry
(when (dispatched-entries plan)
(error 'entry-and-dispatched-entry))
(when (entry plan)
Expand All @@ -158,11 +161,8 @@
:flag (format nil "~A ~A" argument value))
(setf default-dispatched-entry entry)))
(push entry (dispatched-entries plan))))
(:dynamic-space-size
#+sbcl
(:space-size ;; :dynamic-space-size
(setf (dynamic-space-size plan) (parse-integer value)))
(t
(error 'unknown-argument :flag argument)))))))




7 changes: 5 additions & 2 deletions dumper.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@
(dynamic-space-size
:initarg :dynamic-space-size
:accessor dynamic-space-size
:initform nil)
(disable-ldb
:initarg :disable-ldb
:reader disable-ldb
:initform nil)))

(defgeneric needs-asdf-p (dumper)
Expand Down Expand Up @@ -126,7 +130,7 @@
(list
`(format *error-output* "Unknown dispatch name '~A', quitting~%"
binary-name)
(macroexpand-1 (quit 1)))))))))))
(macroexpand-1 '(quit 1)))))))))))

(defgeneric entry-function-form (dumper)
(:method (dumper)
Expand Down Expand Up @@ -161,4 +165,3 @@

(defun dump-form (name)
(gethash name *dumpable-forms*))

9 changes: 8 additions & 1 deletion utils.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@
#+sbcl 'sb-ext:*posix-argv*
#+ccl '(ccl::command-line-arguments))

#+sbcl
(eval-when (:compile-toplevel :load-toplevel :execute)
(let ((version (uiop:lisp-version-string)))
(unless (uiop:version<= version "1.12.5")
(push :sb-list-backtrace *features*))))

(defmacro backtrace-as-list ()
#+sbcl '(sb-debug:backtrace-as-list)
#+(and sbcl sb-list-backtrace) '(sb-debug:list-backtrace)
#+(and sbcl (not sb-list-backtrace)) '(sb-debug:backtrace-as-list)
#+ccl '(ccl::backtrace-as-list))

(defmacro quit (&optional (errno 0))
Expand Down