From 60cf2d4e46481f7dd76065969f7dd290d1df41e3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 7 Jul 2026 08:08:02 -0300 Subject: m --- etc/guix/home.scm | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'etc') diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 51746b24..d41e0e26 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -168,11 +168,12 @@ POSIX standard archiver, which also provides @command{cpio} and (license licenses:bsd-3))) (define sbcl-linkable - ;; Stock sbcl, additionally shipping the static runtime archive - ;; (libsbcl.a) and a USE_LIBSBCL line in sbcl.mk, so cffi-toolchain's - ;; static-program-op can statically link foreign libraries (e.g. - ;; capimbs's libcapim.a) into an SBCL image. Upstream ships only - ;; libsbcl.so. + ;; Stock sbcl built with the :sb-linkable-runtime feature, so it ships + ;; the relinkable runtime object (sbcl.o) and a USE_LIBSBCL=sbcl.o line + ;; in sbcl.mk. That lets cffi-toolchain's static-program-op relink the + ;; runtime with foreign static libraries (e.g. capimbs's libcapim.a), + ;; yielding an SBCL image that statically links them -- no dlopen. + ;; Proven end to end: jacana statically links libcapim.a and parses capim. (let ((pkg (specification->package "sbcl"))) (package (inherit pkg) @@ -181,20 +182,22 @@ POSIX standard archiver, which also provides @command{cpio} and (substitute-keyword-arguments (package-arguments pkg) ((#:phases phases) `(modify-phases ,phases - ;; make.sh already built the runtime objects (incl. tlsf.o); - ;; the runtime GNUmakefile ars them into libsbcl.a. - (add-after 'build 'build-libsbcl.a - (lambda _ - (invoke "make" "-C" "src/runtime" "libsbcl.a"))) - (add-after 'install-shared-library 'install-libsbcl.a + ;; cffi-toolchain's static-program-op *relinks* the runtime, + ;; which is only sound when SBCL is built with the linkable + ;; runtime feature -- without it the relinked runtime faults + ;; loading fasls. make.sh forbids a customize-target-features + ;; file alongside its --with feature-options, so add it as an + ;; option here (x86_64-specific, mirroring guix's make.sh call). + (replace 'build (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (home (string-append out "/lib/sbcl"))) - (install-file "src/runtime/libsbcl.a" home) - (let ((port (open-file - (string-append home "/sbcl.mk") "a"))) - (format port "USE_LIBSBCL=~a/libsbcl.a~%" home) - (close-port port)))))))))))) + (setenv "CC" "gcc") + (invoke "sh" "make.sh" "clisp" + (string-append "--prefix=" (assoc-ref outputs "out")) + "--dynamic-space-size=3072" + "--with-sb-core-compression" + "--with-sb-xref-for-internals" + "--without-sb-simd" + "--with-sb-linkable-runtime")))))))))) (home-environment (packages -- cgit v1.3