Subject: [bug#77130] [PATCH] gnu: clasp-cl: Update to 2.7.0.

From: [email-masked]
Date: Thu, 20 Mar 2025 10:09:52 +0100

From: Ashish SHUKLA <[email-masked]>

* gnu/packages/lisp.scm (clasp-cl): Update to 2.7.0.
[inputs]: Replace clang, and llvm with clang-toolchain. Switch to LLVM 19
as per upstream release notes. [#:phases]: Add fix-sh-paths phase to patch
"/bin/sh" references. Add install-lib phase to install libclasp.so file.
<configure>: Update ld-flags, and pass more arguments. <build>: Enable
parallel building.

Most of the changes here are derived from upstream[0].

[0] https://raw.githubusercontent.com/clasp-developers/clasp/refs/tags/2.7.0/guix/clasp.scm

Change-Id: Id66086e0fe67ed2db62d1a0913b31e3946188519
---
 gnu/packages/lisp.scm | 51 +++++++++++++++++++++++++++++--------------
 1 file changed, 35 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 1af71bc9a2..b5b5128c55 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -28,7 +28,7 @@
 ;;; Copyright © 2023 Andrew Kravchuk <[email-masked]>
 ;;; Copyright © 2024 Andreas Enge <[email-masked]>
 ;;; Copyright © 2024 bigbug <[email-masked]>
-;;; Copyright © 2024 Ashish SHUKLA <[email-masked]>
+;;; Copyright © 2024, 2025 Ashish SHUKLA <[email-masked]>
 ;;; Copyright © 2024 Omar Bassam <[email-masked]>
 ;;; Copyright © 2024 Suhail Singh <[email-masked]>
 ;;; Copyright © 2024 David Pflug <[email-masked]>
@@ -382,7 +382,7 @@ (define-public ccl
 (define-public clasp-cl
   (package
     (name "clasp-cl")
-    (version "2.6.0")
+    (version "2.7.0")
     (source
      (origin
        (method url-fetch)
@@ -390,16 +390,24 @@ (define-public clasp-cl
              "https://github.com/clasp-developers/clasp/releases/download/"
              version "/clasp-" version ".tar.gz"))
        (sha256
-        (base32 "10jjhcid6qp64gx29iyy5rqqijwy8hrvx66f0xabdj8w3007ky39"))))
+        (base32 "1sf8m0w3d4kagf4chb7viqndnr152crpsy979ll61krcfxaybc4j"))))
     (build-system gnu-build-system)
     (inputs
-     (list boost clang-15 fmt `(,gcc "lib") gmp libelf libunwind llvm-15))
+     (list boost clang-toolchain-19 fmt `(,gcc "lib") gmp libelf libunwind))
     (native-inputs
      (list binutils-gold ninja pkg-config sbcl))
     (arguments
      `(#:phases
        (modify-phases %standard-phases
          (delete 'check)
+         (add-after 'unpack 'fix-sh-paths
+           (lambda _
+             (substitute* '("dependencies/quicklisp-client/asdf.lisp"
+                            "src/lisp/modules/asdf/uiop/run-program.lisp"
+                            "src/lisp/modules/asdf/uiop/launch-program.lisp"
+                            "src/lisp/regression-tests/extensions.lisp")
+               (("\"/bin/sh\"")
+                (string-append "\"" (which "sh") "\"")))))
          (add-after 'unpack 'patch-koga
            (lambda* _
              (call-with-port (open-file "src/koga/units.lisp" "a")
@@ -415,15 +423,16 @@ (define-public clasp-cl
                                     "/__fasls"))))
          (replace 'configure
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out"))
-                   (clang (assoc-ref inputs "clang"))
-                   (ld-flags
-                    (string-join
-                     (apply append
-                            (map (lambda (f)
-                                   (list "-L" f "-rpath" f))
-                                 (string-split (getenv "LIBRARY_PATH") #\:)))
-                     ",")))
+             (let* ((out (assoc-ref outputs "out"))
+                    (clang (assoc-ref inputs "clang-toolchain"))
+                    (ld-flags (string-join
+                                (apply append
+                                  (map (lambda (f)
+                                         (list "-L" f "-rpath" f))
+                                       ;; prepend self in rpaths
+                                       (cons (string-append out "/lib")
+                                             (string-split (getenv "LIBRARY_PATH") #\:))))
+                                ",")))
                (invoke "sbcl"
                        "--script"
                        "./koga"
@@ -436,13 +445,23 @@ (define-public clasp-cl
                        "--package-path=/"
                        (string-append "--bin-path=" out "/bin")
                        (string-append "--lib-path=" out "/lib/clasp")
+                       (string-append "--dylib-path=" out "/lib")
+                       (string-append "--pkgconfig-path=" out "/lib/pkgconfig")
                        (string-append "--share-path=" out "/share/clasp")))))
          (replace 'build
-           (lambda* _
-             (invoke "ninja" "-C" "build")))
+           (lambda* (#:key parallel-build? #:allow-other-keys)
+             (let ((jobs (if parallel-build?
+                                (number->string (parallel-job-count))
+                                "1")))
+               (setenv "CLASP_BUILD_JOBS" jobs)
+               (invoke "ninja" "-C" "build" "-j" jobs))))
          (replace 'install
            (lambda* _
-             (invoke "ninja" "-C" "build" "install"))))))
+             (invoke "ninja" "-C" "build" "install")))
+         (add-after 'install 'install-lib
+             (lambda* (#:key outputs #:allow-other-keys)
+               (install-file "build/boehmprecise/lib/libclasp.so"
+                  (string-append (assoc-ref outputs "out") "/lib")))))))
     (home-page "https://clasp-developers.github.io/")
     (synopsis "Common Lisp implementation based on LLVM and C++")
     (description "Clasp is a new Common Lisp implementation that seamlessly

base-commit: 18f956467a7e3e35e21a9b5616025bf33f307ad7
-- 
2.49.0