Compile with ECL, and compile time templates with SBCL

This commit is contained in:
2026-07-04 21:39:18 +03:00
parent 4b1c0b146c
commit c00d9947b7
6 changed files with 38 additions and 10 deletions
+4 -3
View File
@@ -1,4 +1,5 @@
LISP ?= sbcl sbcl:
sbcl --script build.lisp
all: ecl:
$(LISP) --load build.lisp ecl --norc --load build.lisp
+10 -1
View File
@@ -1,14 +1,23 @@
#-ecl
(require :asdf) (require :asdf)
#+ecl
(load "~/.local/share/common-lisp/asdf-3.3.7/build/asdf.lisp")
(asdf:initialize-source-registry `(:source-registry (:tree ,(uiop:getcwd)) :ignore-inherited-configuration))
#+sb-core-compression #+sb-core-compression
(defmethod asdf:perform ((o asdf:image-op) (c asdf:system)) (defmethod asdf:perform ((o asdf:image-op) (c asdf:system))
(uiop:dump-image (asdf:output-file o c) (uiop:dump-image (asdf:output-file o c)
:executable t :executable t
:compression t)) :compression t))
(asdf:load-asd "lspack.asd") (asdf:load-asd (uiop:merge-pathnames* "lspack.asd" (uiop:getcwd)))
(asdf:load-system "lspack/exe") (asdf:load-system "lspack/exe")
#-ecl
(lspack:load-templates)
(asdf:make "lspack/exe") (asdf:make "lspack/exe")
(quit) (quit)
+3 -1
View File
@@ -2,5 +2,7 @@
- [ ] Load user config from $XDG_CONFIG_HOME/lspack/config.lisp - [ ] Load user config from $XDG_CONFIG_HOME/lspack/config.lisp
- [ ] Load licenses at compile time - [ ] Load licenses at compile time
- [X] SBCL (v0.0.5)
- [ ] ECL
- [ ] Install exe, licenses, manpage - [ ] Install exe, licenses, manpage
- [ ] Compile with ECL - [X] Compile with ECL (v0.0.5)
+1 -1
View File
@@ -2,7 +2,7 @@
:author "Emre Akan" :author "Emre Akan"
:description "Quickstart Common Lisp projects" :description "Quickstart Common Lisp projects"
:license "GPL-3.0" :license "GPL-3.0"
:version "0.0.4" :version "0.0.5"
:depends-on ("uiop") :depends-on ("uiop")
:pathname "src/" :pathname "src/"
:serial t :serial t
+18 -3
View File
@@ -135,9 +135,14 @@
`((format ,stream-sym "~&||#~%~%"))))))) `((format ,stream-sym "~&||#~%~%")))))))
(defmethod license-generate-writer ((license <license>) &optional commented) (defmethod license-generate-writer ((license <license>) &optional commented)
(uiop:if-let (template (license-read-template license)) (format *error-output* "~&Loading template ~S... " (license-find-template license))
(setf (license-writer license) (finish-output *error-output*)
(compile nil (template-generate-writer template commented))))) (let ((template (license-read-template license)))
(unless (null template)
(setf (license-writer license)
(compile nil (template-generate-writer template commented)))
(format *error-output* "ok~%")
(license-writer license))))
(defmethod license-ensure-writer ((license <license>) &optional commented) (defmethod license-ensure-writer ((license <license>) &optional commented)
(with-slots (writer) license (with-slots (writer) license
@@ -145,3 +150,13 @@
writer writer
(license-generate-writer license commented)))) (license-generate-writer license commented))))
(defun templates-keywords-list ()
(loop :for key :being :the :hash-keys :of *licenses*
:collect key))
(defun load-templates (&optional (templates (templates-keywords-list)))
(loop :for key :in templates
:do (license-ensure-writer (get-license key))
(let ((notice (get-notice key)))
(unless (null notice)
(license-ensure-writer notice)))))
+2 -1
View File
@@ -2,4 +2,5 @@
(:use :cl) (:use :cl)
(:export #:start (:export #:start
#:*default-author* #:*default-author*
#:*default-license*)) #:*default-license*
#:load-templates))