gnu: cl-asdf: Improve priorities of configuration file search.
[jackhill/guix/guix.git] / gnu / packages / lisp.scm
index c2a3fa4..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 admin)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bdw-gc)
-  #:use-module (gnu packages bison)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages ed)
-  #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
@@ -91,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
@@ -333,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)
@@ -348,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
@@ -367,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
@@ -381,14 +368,14 @@ an interpreter, a compiler, a debugger, and much more.")
 (define-public sbcl
   (package
     (name "sbcl")
-    (version "2.0.8")
+    (version "2.0.11")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-"
                            version "-source.tar.bz2"))
        (sha256
-        (base32 "1xwrwvps7drrpyw3wg5h3g2qajmkwqs9gz0fdw1ns9adp7vld390"))))
+        (base32 "07cpswxh2f38b440xdn3fjk7b4r0ipj3sbwb3jd134phrr9smll7"))))
     (build-system gnu-build-system)
     (outputs '("out" "doc"))
     (native-inputs
@@ -509,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
@@ -811,7 +798,7 @@ enough to play the original mainframe Zork all the way through.")
 (define-public txr
   (package
     (name "txr")
-    (version "243")
+    (version "244")
     (source
      (origin
        (method git-fetch)
@@ -820,7 +807,7 @@ enough to play the original mainframe Zork all the way through.")
              (commit (string-append "txr-" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "08rrl7ac6jnx0zfchzbpvs3qidrbjrl9c7p8s1wms90lp10i18ak"))))
+        (base32 "1bzhb1pms6gjzphbsimhwdyq46ik1m7sgldigg5l1q7bppg9r3i0"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags
@@ -842,9 +829,6 @@ enough to play the original mainframe Zork all the way through.")
                                 "tests/017/realpath.expected")
                (("/usr/bin") "/"))
              #t)))))
-    (native-inputs
-     `(("bison" ,bison)
-       ("flex" ,flex)))
     (inputs
      `(("libffi" ,libffi)))
     (synopsis "General-purpose, multi-paradigm programming language")
@@ -1016,3 +1000,87 @@ including a built-in database engine and a GUI system.")
      (package
        (inherit picolisp32)
        (name "picolisp")))))
+
+(define-public janet
+  (package
+    (name "janet")
+    (version "1.12.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/janet-lang/janet")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0if514zdmbjvvrsa9x5yfvg2b14sz53yaka12g3yhwkq8ls3qk0c"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:make-flags (list
+                     (string-append "DESTDIR=" (assoc-ref %outputs "out"))
+                     (string-append "PREFIX=")
+                     (string-append "CC=" (assoc-ref %build-inputs "gcc")
+                                    "/bin/gcc"))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'check
+           (lambda _
+             (invoke "make" "test"))))))
+    (home-page "https://janet-lang.org/")
+    (synopsis "Functional, imperative and embeddable programming language")
+    (description
+     "Janet is a functional and imperative programming language.  It can be
+used for rapid prototyping, dynamic systems, and other domains where dynamic
+languages shine.  You can also add Janet scripting to an application by
+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+)))