gnu: cl-asdf: Improve priorities of configuration file search.
[jackhill/guix/guix.git] / gnu / packages / lisp.scm
index 4727b48..0038cb0 100644 (file)
@@ -44,6 +44,7 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix utils)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system ant)
   #:use-module (guix build-system asdf)
   #:use-module (gnu packages xorg)
   #:use-module (ice-9 match))
 
-(define (asdf-substitutions lisp)
-  ;; Prepend XDG_DATA_DIRS/LISP-bundle-systems to ASDF's
-  ;; 'default-system-source-registry'.
-  `((("\\(,dir \"systems/\"\\)\\)")
-     (format #f
-             "(,dir \"~a-bundle-systems\")))
-
-      ,@(loop :for dir :in (xdg-data-dirs \"common-lisp/\")
-              :collect `(:directory (,dir \"systems\"))"
-             ,lisp))))
-
 (define-public cl-asdf
   (package
     (name "cl-asdf")
-    (version "3.3.3")
+    (version "3.3.4")
     (source
      (origin
        (method url-fetch)
         (string-append "https://common-lisp.net/project/asdf/archives/asdf-"
                        version ".lisp"))
        (sha256
-        (base32 "18lr6kxvzhr79c9rx3sdricz30aby866fj0m24w27zxsqlyvn3rd"))))
+        (base32 "1hpx30f6yrak15nw992k7x3pn75ahvjs04n4f134k68mhgs62km2"))))
     (build-system trivial-build-system)
+    (native-inputs
+     `(("config-patch" ,@(search-patches "cl-asdf-config-directories.patch"))
+       ("patch" ,patch)))
     (arguments
      `(#:modules ((guix build utils)
                   (guix build lisp-utils))
          (let* ((out (string-append (assoc-ref %outputs "out")))
                 (asdf-install (string-append out %source-install-prefix
                                              "/source/asdf/"))
-                (asdf (string-append (assoc-ref %build-inputs "source"))))
+                (src-asdf (string-append (assoc-ref %build-inputs "source")))
+                (dst-asdf (string-append asdf-install "asdf.lisp"))
+                (patch (string-append (assoc-ref %build-inputs "patch")
+                                      "/bin/patch"))
+                (config-patch (assoc-ref %build-inputs "config-patch")))
            (mkdir-p asdf-install)
-           (copy-file asdf (string-append asdf-install "asdf.lisp"))))))
+           (copy-file src-asdf dst-asdf)
+           (invoke patch "-p1" "-i" config-patch dst-asdf)))))
     (home-page "https://common-lisp.net/project/asdf/")
     (synopsis "Another System Definition Facility")
     (description
@@ -259,10 +257,7 @@ interface to the Tk widget system.")
                                 "/share/common-lisp/source/asdf/asdf.lisp"))
                     (out (string-append (assoc-ref outputs "out")))
                     (contrib-asdf "contrib/asdf/asdf.lisp"))
-               (copy-file guix-asdf contrib-asdf)
-               ;; Add ecl-bundle-systems to 'default-system-source-registry'.
-               (substitute* contrib-asdf
-                 ,@(asdf-substitutions name)))
+               (copy-file guix-asdf contrib-asdf))
              #t))
          (add-after 'install 'wrap
            (lambda* (#:key inputs outputs #:allow-other-keys)
@@ -296,7 +291,10 @@ interface to the Tk widget system.")
     (native-search-paths
      (list (search-path-specification
             (variable "XDG_DATA_DIRS")
-            (files '("share")))))
+            (files '("share")))
+           (search-path-specification
+            (variable "XDG_CONFIG_DIRS")
+            (files '("etc")))))
     (home-page "http://ecls.sourceforge.net/")
     (synopsis "Embeddable Common Lisp")
     (description "ECL is an implementation of the Common Lisp language as
@@ -322,8 +320,7 @@ supporting ASDF, Sockets, Gray streams, MOP, and other useful components.")
              (commit "clisp-2.49.92-2018-02-18")))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0k2dmgl0miz3767iks4p0mvp6xw0ysyxhjpklyh11j010rmh6hqb"))
-       (patches (search-patches "clisp-remove-failing-test.patch"))))
+        (base32 "0k2dmgl0miz3767iks4p0mvp6xw0ysyxhjpklyh11j010rmh6hqb"))))
     (build-system gnu-build-system)
     (inputs `(("libffcall" ,libffcall)
               ("ncurses" ,ncurses)
@@ -337,8 +334,11 @@ supporting ASDF, Sockets, Gray streams, MOP, and other useful components.")
                                  '())
                             "--with-dynamic-ffi"
                             "--with-dynamic-modules"
+                            "--with-ffcall"
+                            "--with-readline"
+                            "--with-sigsegv"
+                            "--with-module=asdf"
                             "--with-module=rawsock")
-       #:build #f
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'patch-sh-and-pwd
@@ -356,9 +356,7 @@ supporting ASDF, Sockets, Gray streams, MOP, and other useful components.")
                (("/bin/sh") "sh"))
              (substitute* '("src/clisp-link.in")
                (("/bin/pwd") "pwd"))
-             #t)))
-       ;; Makefiles seem to have race conditions.
-       #:parallel-build? #f))
+             #t)))))
     (home-page "https://clisp.sourceforge.io/")
     (synopsis "A Common Lisp implementation")
     (description
@@ -370,14 +368,14 @@ an interpreter, a compiler, a debugger, and much more.")
 (define-public sbcl
   (package
     (name "sbcl")
-    (version "2.0.10")
+    (version "2.0.11")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-"
                            version "-source.tar.bz2"))
        (sha256
-        (base32 "0mq5ga977hzsq4wgv31l8d6rpa186q8xc4x2awwcskf5nq842xai"))))
+        (base32 "07cpswxh2f38b440xdn3fjk7b4r0ipj3sbwb3jd134phrr9smll7"))))
     (build-system gnu-build-system)
     (outputs '("out" "doc"))
     (native-inputs
@@ -435,9 +433,7 @@ an interpreter, a compiler, a debugger, and much more.")
                                 "/share/common-lisp/source/asdf/asdf.lisp"))
                     (out (string-append (assoc-ref outputs "out")))
                     (contrib-asdf "contrib/asdf/asdf.lisp"))
-               (copy-file guix-asdf contrib-asdf)
-               (substitute* contrib-asdf
-                 ,@(asdf-substitutions name)))
+               (copy-file guix-asdf contrib-asdf))
              #t))
          (add-before 'build 'patch-unix-tool-paths
            (lambda* (#:key outputs inputs #:allow-other-keys)
@@ -500,7 +496,7 @@ an interpreter, a compiler, a debugger, and much more.")
                                          `("clisp")))
                      (string-append "--prefix="
                                     (assoc-ref outputs "out"))
-                     "--dynamic-space-size=2Gb"
+                     "--dynamic-space-size=3072"
                      "--with-sb-core-compression"
                      "--with-sb-xref-for-internals")))
          (replace 'install
@@ -544,7 +540,10 @@ an interpreter, a compiler, a debugger, and much more.")
     (native-search-paths
      (list (search-path-specification
             (variable "XDG_DATA_DIRS")
-            (files '("share")))))
+            (files '("share")))
+           (search-path-specification
+            (variable "XDG_CONFIG_DIRS")
+            (files '("etc")))))
     (home-page "http://www.sbcl.org/")
     (synopsis "Common Lisp implementation")
     (description "Steel Bank Common Lisp (SBCL) is a high performance Common
@@ -1038,3 +1037,50 @@ embedding a single C file and two headers.  It can be easily ported to new
 platforms.  The entire language (core library, interpreter, compiler,
 assembler, PEG) is less than 1MB.")
     (license license:expat)))
+
+(define-public lisp-repl-core-dumper
+  (package
+    (name "lisp-repl-core-dumper")
+    (version "0.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.com/ambrevar/lisp-repl-core-dumper.git")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1w7x7d7bnrdj0bd04vnjy7d7sngvcx1yjr4iw429hdd9lzlg8rbg"))))
+    (build-system copy-build-system)
+    (arguments
+     '(#:install-plan
+       '(("lisp-repl-core-dumper" "bin/"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'install 'fix-utils-path
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let* ((coreutils (string-append (assoc-ref inputs "coreutils") "/bin/"))
+                    (paste (string-append coreutils "paste"))
+                    (sort (string-append coreutils "sort"))
+                    (basename (string-append coreutils "basename"))
+                    (sed (string-append (assoc-ref inputs "sed") "/bin/sed")))
+               (substitute* "lisp-repl-core-dumper"
+                 (("\\$\\(basename") (string-append "$(" basename))
+                 (("\\<paste\\>") paste)
+                 (("\\<sed\\>") sed)
+                 (("\\<sort\\>") sort))))))))
+    (inputs
+     `(("coreutils" ,coreutils-minimal)
+       ("sed" ,sed)))
+    (home-page "https://gitlab.com/ambrevar/lisp-repl-core-dumper")
+    (synopsis "Generate REPL-optimized Lisp cores on demand")
+    (description
+     "This tool generates Lisp images that can embed the provided systems
+and make for REPLs that start blazing fast.
+
+@itemize
+@item It’s portable and should work with any compiler.
+@item It works for any REPL.
+@item It allows you to include arbitrary libraries.
+@end itemize\n")
+    (license license:gpl3+)))