gnu: sbcl: Enable sb-gmp, sb-mpfr and install shared library.

* gnu/packages/lisp.scm (sbcl)[inputs]: Add gmp, mpfr.
[arguments]: Fix shared library makefile.
Fix contrib references to gmp and mpfr.
Add phase to build shared library.
Add phase to install shared library.
This commit is contained in:
Pierre Neidhardt 2022-06-30 18:58:25 +02:00
parent a3d65bd247
commit 0eac11139a
No known key found for this signature in database
GPG key ID: 9BDCF497A4BBCC7F

View file

@ -457,7 +457,9 @@ (define-public sbcl
(texlive-updmap.cfg (list texlive-tex-texinfo)) (texlive-updmap.cfg (list texlive-tex-texinfo))
which)) which))
(inputs (inputs
(list (list zstd "lib"))) (list gmp ; for sb-gmp
mpfr ; for sb-mpfr
(list zstd "lib")))
(arguments (arguments
`(#:modules ((guix build gnu-build-system) `(#:modules ((guix build gnu-build-system)
(guix build utils) (guix build utils)
@ -539,6 +541,20 @@ (define (quoted-path input path)
(("\\(deftest grent\\.[12]" all) (("\\(deftest grent\\.[12]" all)
(string-append "#+nil ;disabled by Guix\n" all)))) (string-append "#+nil ;disabled by Guix\n" all))))
#t)) #t))
(add-before 'build 'fix-shared-library-makefile
(lambda _
(substitute* '("src/runtime/GNUmakefile")
((" cc") " $(CC)"))
#t))
(add-before 'build 'fix-contrib-library-path
(lambda* (#:key inputs #:allow-other-keys)
(let ((gmp (assoc-ref inputs "gmp"))
(mpfr (assoc-ref inputs "mpfr")))
(substitute* '("contrib/sb-gmp/gmp.lisp")
(("\"libgmp\\.so") (string-append "\"" gmp "/lib/libgmp.so")))
(substitute* '("contrib/sb-mpfr/mpfr.lisp")
(("\"libmpfr\\.so") (string-append "\"" mpfr "/lib/libmpfr.so"))))
#t))
(replace 'build (replace 'build
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(setenv "CC" "gcc") (setenv "CC" "gcc")
@ -552,6 +568,10 @@ (define (quoted-path input path)
"--dynamic-space-size=3072" "--dynamic-space-size=3072"
"--with-sb-core-compression" "--with-sb-core-compression"
"--with-sb-xref-for-internals"))) "--with-sb-xref-for-internals")))
(add-after 'build 'build-shared-library
(lambda* (#:key outputs #:allow-other-keys)
(setenv "CC" "gcc")
(invoke "sh" "make-shared-library.sh")))
(replace 'install (replace 'install
(lambda _ (lambda _
(invoke "sh" "install.sh"))) (invoke "sh" "install.sh")))
@ -584,6 +604,12 @@ (define (quoted-path input path)
(string-append "(sb-ext:set-sbcl-source-location \"" (string-append "(sb-ext:set-sbcl-source-location \""
source-dir "\")") ))) source-dir "\")") )))
#t))) #t)))
(add-after 'install 'install-shared-library
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(lib-dir (string-append out "/lib")))
(install-file "src/runtime/libsbcl.so" lib-dir)
#t)))
(add-after 'install 'install-doc (add-after 'install 'install-doc
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))