Skip to content

Instantly share code, notes, and snippets.

@glider-gun
Last active December 30, 2022 03:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save glider-gun/5605360fa13a7057544c to your computer and use it in GitHub Desktop.
Save glider-gun/5605360fa13a7057544c to your computer and use it in GitHub Desktop.
dump sbcl core with quicklisp (and some packages) preloaded (this is created before I use roswell)
#!/bin/sh
OUTPUT="sbql"
PRELOADS="alexandria cl-ppcre local-time cffi cl-interpol"
PREUSES="split-sequence anaphora iterate"
# sbcl --script <<EOF
sbcl --no-sysinit --no-userinit --noprint <<EOF
;; load quicklisp (from .sbclrc content added when quicklisp installation)
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
(ql:quickload :cffi :silent t)
#+darwin(pushnew #P"/opt/local/lib/" cffi:*foreign-library-directories* :test #'equal)
#+darwin(pushnew #P"/opt/local/Library/Frameworks/" cffi:*darwin-framework-directories* :test #'equal)
;; load systems in PRELOADS
(let ((systems '($PRELOADS $PREUSES))
(uses '($PREUSES)))
(dolist (s systems) (unintern s)) ; unintern symbols to avoid collision
(when systems
(ql:quickload systems :silent t))
(dolist (u uses)
(use-package u)))
;; make SBCL_HOME environment variable is set at start up.
;; it isn't set for :EXECUTABLE T embedded core, but I need it to be set
;; for requiring contrib module: (require 'sb-cltl2) or so.
(push (lambda ()
(cl-interpol:enable-interpol-syntax)
(sb-posix:putenv (concatenate 'string "SBCL_HOME=" #.(sb-posix:getenv "SBCL_HOME"))))
sb-ext:*init-hooks*)
;; make executable as specified name
(sb-ext:save-lisp-and-die "$OUTPUT" :purify t :executable t :compression t)
EOF
#| Local Variables: |#
#| mode:lisp |#
#| End: |#6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment