gnu: cl-asdf: Improve priorities of configuration file search.
[jackhill/guix/guix.git] / gnu / packages / lisp.scm
index 681aaac..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)
@@ -89,6 +90,9 @@
        (sha256
         (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))
                 (asdf-install (string-append out %source-install-prefix
                                              "/source/asdf/"))
                 (src-asdf (string-append (assoc-ref %build-inputs "source")))
-                (dst-asdf (string-append asdf-install "asdf.lisp")))
+                (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 src-asdf dst-asdf)
-           ;; Patch ASDF to make it read the configuration files in all
-           ;; the direcories listed in '$XDG_CONFIG_DIRS' instead of just
-           ;; the first.
-           (substitute* dst-asdf
-             (("\\(xdg-config-pathname \\*source-registry-directory\\* direction\\)")
-              "`(:source-registry
-                 ,@(loop
-                      for dir in (xdg-config-dirs
-                                  \"common-lisp/source-registry.conf.d/\")
-                      collect `(:include ,dir))
-                 :inherit-configuration)")
-             (("\\(xdg-config-pathname \\*output-translations-directory\\* direction\\)")
-              "`(:output-translations
-                 ,@(loop
-                      for dir in (xdg-config-dirs
-                                  \"common-lisp/asdf-output-translations.conf.d/\")
-                      collect `(:include ,dir))
-                 :inherit-configuration)")))
-         #t)))
+           (invoke patch "-p1" "-i" config-patch dst-asdf)))))
     (home-page "https://common-lisp.net/project/asdf/")
     (synopsis "Another System Definition Facility")
     (description
@@ -1048,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+)))