mailmap: Update entries for Nikita.
[jackhill/guix/guix.git] / gnu / packages / lisp.scm
index dc44a9d..5d6cc1c 100644 (file)
@@ -3,18 +3,19 @@
 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
-;;; Copyright © 2016, 2017 ng0 <ng0@n0.is>
+;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
 ;;; Copyright © 2016, 2017 Andy Patterson <ajpatter@uwaterloo.ca>
 ;;; Copyright © 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
-;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
+;;; Copyright © 2018, 2019 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;; Copyright © 2018, 2019 Pierre Langlois <pierre.langlois@gmx.com>
-;;; Copyright © 2019 Katherine Cox-Buday <cox.katherine.e@gmail.com>
+;;; Copyright © 2019, 2020 Katherine Cox-Buday <cox.katherine.e@gmail.com>
 ;;; Copyright © 2019 Jesse Gildersleve <jessejohngildersleve@protonmail.com>
-;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2019, 2020 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -71,6 +72,7 @@
   #:use-module (gnu packages readline)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages tex)
+  #:use-module (gnu packages tls)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages xorg)
               :collect `(:directory (,dir \"systems\"))"
              ,lisp))))
 
+(define-public cl-asdf
+  (package
+    (name "cl-asdf")
+    (version "3.3.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://common-lisp.net/project/asdf/archives/asdf-"
+                       version ".lisp"))
+       (sha256
+        (base32 "18lr6kxvzhr79c9rx3sdricz30aby866fj0m24w27zxsqlyvn3rd"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils)
+                  (guix build lisp-utils))
+       #:builder
+       (begin
+         (use-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"))))
+           (mkdir-p asdf-install)
+           (copy-file asdf (string-append asdf-install "asdf.lisp"))))))
+    (home-page "https://common-lisp.net/project/asdf/")
+    (synopsis "Another System Definition Facility")
+    (description
+     "ASDF is what Common Lisp hackers use to build and load software.  It is
+the successor of the Lisp DEFSYSTEM of yore.  ASDF stands for Another System
+Definition Facility.")
+    ;; MIT License
+    (license license:expat)))
+
 (define-public gcl
   (let ((commit "d3335e2b3deb63f930eb0328e9b05377744c9512")
         (revision "2")) ;Guix package revision
@@ -186,7 +223,7 @@ interface to the Tk widget system.")
 (define-public ecl
   (package
     (name "ecl")
-    (version "16.1.3")
+    (version "20.4.24")
     (source
      (origin
        (method url-fetch)
@@ -194,28 +231,41 @@ interface to the Tk widget system.")
              "https://common-lisp.net/project/ecl/static/files/release/"
              name "-" version ".tgz"))
        (sha256
-        (base32 "0m0j24w5d5a9dwwqyrg0d35c0nys16ijb4r0nyk87yp82v38b9bn"))
-       (modules '((guix build utils)))
-       (snippet
-        ;; Add ecl-bundle-systems to 'default-system-source-registry'.
-        `(begin
-           (substitute* "contrib/asdf/asdf.lisp"
-             ,@(asdf-substitutions name))
-           #t))))
+        (base32 "01qgdmr54wkj854f69qdm9sybrvd6gd21dpx4askdaaqybnkh237"))))
     (build-system gnu-build-system)
     ;; src/configure uses 'which' to confirm the existence of 'gzip'.
-    (native-inputs `(("which" ,which)))
-    (inputs `(("gmp" ,gmp)
-              ("libatomic-ops" ,libatomic-ops)
-              ("libgc" ,libgc)
-              ("libffi" ,libffi)))
+    (native-inputs
+     `(("cl-asdf" ,cl-asdf)
+       ("which" ,which)
+       ("texinfo" ,texinfo)))
+    (inputs
+     `(("gmp" ,gmp)
+       ("libatomic-ops" ,libatomic-ops)
+       ("libgc" ,libgc)
+       ("libffi" ,libffi)))
     (arguments
-     '(#:configure-flags '("--without-rt")
+     `(#:configure-flags '("--without-rt")
+       ;; FIXME: As of version 20.4.24, we pass 17995 tests and fail 7.
+       ;; 2-3 tests may be due to FHS assumptions.
        #:tests? #t
        #:parallel-tests? #f
        #:phases
        (modify-phases %standard-phases
          (delete 'check)
+         (add-after 'unpack 'replace-asdf
+           ;; Use system ASDF instead of bundled one.
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
+                    (guix-asdf (string-append
+                                cl-asdf
+                                "/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)))
+             #t))
          (add-after 'install 'wrap
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((ecl (assoc-ref outputs "out"))
@@ -257,9 +307,10 @@ bytecode compiler and interpreter, being able to compile Common Lisp with any
 C/C++ compiler, being able to build standalone executables and libraries, and
 supporting ASDF, Sockets, Gray streams, MOP, and other useful components.")
     ;; Note that the file "Copyright" points to some files and directories
-    ;; which aren't under the lgpl2.0+ and instead contain many different,
+    ;; which aren't under the lgpl2.1+ and instead contain many different,
     ;; non-copyleft licenses.
-    (license license:lgpl2.0+)))
+    ;; See https://common-lisp.net/project/ecl/posts/ECL-license.html.
+    (license license:lgpl2.1+)))
 
 (define-public clisp
   (package
@@ -321,21 +372,14 @@ an interpreter, a compiler, a debugger, and much more.")
 (define-public sbcl
   (package
     (name "sbcl")
-    (version "1.5.8")
+    (version "2.0.4")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-"
                            version "-source.tar.bz2"))
        (sha256
-        (base32 "0k7zjrky8r2krkd8780cph214hiihg9nh5rxn4nrhg6i6f8jymw4"))
-       (modules '((guix build utils)))
-       (snippet
-        ;; Add sbcl-bundle-systems to 'default-system-source-registry'.
-        `(begin
-           (substitute* "contrib/asdf/asdf.lisp"
-             ,@(asdf-substitutions name))
-           #t))))
+        (base32 "1lc2i4qq1kfdybmxnj2zq2hn3hfx0vvlqim4gvlgvs3bfr0lcaqj"))))
     (build-system gnu-build-system)
     (outputs '("out" "doc"))
     (native-inputs
@@ -354,21 +398,22 @@ an interpreter, a compiler, a debugger, and much more.")
      ;;
      ;; CCL is not bootstrappable so it won't do.  CLISP 2.49 seems to work.
      ;; ECL too.  ECL builds SBCL about 20% slower than CLISP.  As of
-     ;; 2019-09-05, ECL was last updated in 2016 while CLISP was last update
+     ;; 2019-09-05, ECL was last updated in 2020 while CLISP was last updated
      ;; in 2010.
      ;;
-     ;; For now we stick to CLISP for all systems.  We keep the `match' in to
+     ;; For now we stick to CLISP for all systems.  We keep the `match' here to
      ;; make it easier to change the host compiler for various architectures.
      `(,@(match (%current-system)
            ((or "x86_64-linux" "i686-linux")
             `(("clisp" ,clisp)))
            (_
             `(("clisp" ,clisp))))
-       ("which" ,which)
-       ("inetutils" ,inetutils)         ;for hostname(1)
+       ("cl-asdf" ,cl-asdf)
        ("ed" ,ed)
-       ("texlive" ,(texlive-union (list texlive-tex-texinfo)))
+       ("inetutils" ,inetutils)         ;for hostname(1)
        ("texinfo" ,texinfo)
+       ("texlive" ,(texlive-union (list texlive-tex-texinfo)))
+       ("which" ,which)
        ("zlib" ,zlib)))
     (arguments
      `(#:modules ((guix build gnu-build-system)
@@ -377,6 +422,24 @@ an interpreter, a compiler, a debugger, and much more.")
        #:phases
        (modify-phases %standard-phases
          (delete 'configure)
+         (add-after 'unpack 'replace-asdf
+           ;; SBCL developers have not committed to keeping ASDF up to date
+           ;; due to breaking changes [1]. Guix can handle this situation
+           ;; easily, and it behooves us to have more control over what version
+           ;; of ASDF we use to build software; therefore, replace the contrib
+           ;; ASDF with the version packaged into Guix.
+           ;; [1] - https://bugs.launchpad.net/sbcl/+bug/1823442
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
+                    (guix-asdf (string-append
+                                cl-asdf
+                                "/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)))
+             #t))
          (add-before 'build 'patch-unix-tool-paths
            (lambda* (#:key outputs inputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out"))
@@ -422,7 +485,8 @@ an interpreter, a compiler, a debugger, and much more.")
                  (("\\(deftest pwent\\.[12]" all)
                   (string-append "#+nil ;disabled by Guix\n" all))
                  (("\\(deftest grent\\.[12]" all)
-                  (string-append "#+nil ;disabled by Guix\n" all))))))
+                  (string-append "#+nil ;disabled by Guix\n" all))))
+             #t))
          ;; FIXME: the texlive-union insists on regenerating fonts.  It stores
          ;; them in HOME, so it needs to be writeable.
          (add-before 'build 'set-HOME
@@ -437,6 +501,7 @@ an interpreter, a compiler, a debugger, and much more.")
                                          `("clisp")))
                      (string-append "--prefix="
                                     (assoc-ref outputs "out"))
+                     "--dynamic-space-size=2Gb"
                      "--with-sb-core-compression"
                      "--with-sb-xref-for-internals")))
          (replace 'install
@@ -444,6 +509,7 @@ an interpreter, a compiler, a debugger, and much more.")
              (invoke "sh" "install.sh")))
          (add-after 'build 'build-doc
            (lambda _
+             ;; TODO: Doc is not deterministic, maybe there is a timespamp?
              (with-directory-excursion "doc/manual"
                (and  (invoke "make" "info")
                      (invoke "make" "dist")))))
@@ -474,8 +540,8 @@ an interpreter, a compiler, a debugger, and much more.")
                                  new-doc/sbcl-dir)
                (delete-file-recursively old-doc-dir)
                #t))))
-         ;; No 'check' target, though "make.sh" (build phase) runs tests.
-         #:tests? #f))
+       ;; No 'check' target, though "make.sh" (build phase) runs tests.
+       #:tests? #f))
     (native-search-paths
      (list (search-path-specification
             (variable "XDG_DATA_DIRS")
@@ -628,6 +694,53 @@ interface.")
     (license (list license:lgpl2.1
                    license:clarified-artistic)))) ;TRIVIAL-LDAP package
 
+(define-public ccl-1.12
+  ;; This is a development snapshot.  The last stable version is from November
+  ;; 2017 and does not support package-local-nicknames, which prevents CCL
+  ;; from compiling some third-party packages.
+  ;; The main drawback of 1.12 is that ARM is not supported for now.
+  (package
+    (inherit ccl)
+    (version "1.12-dev.5")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/Clozure/ccl/")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name "ccl" version))
+              (sha256
+               (base32
+                "1za5j4ll4hk1vi1i7v1bmqhaqbsgc16izn46qmry7dnbig0rdqm0"))))
+    ;; CCL consists of a "lisp kernel" and "heap image".
+    ;; See comment in `ccl' package.
+    (inputs
+     `(("ccl-bootstrap"
+        ,(origin
+           (method url-fetch)
+           (uri (string-append
+                 "https://github.com/Clozure/ccl/releases/download/v" version "/"
+                 (match (%current-system)
+                   ((or "i686-linux" "x86_64-linux") "linuxx86")
+                   ;; Prevent errors when querying this package on unsupported
+                   ;; platforms, e.g. when running "guix package --search="
+                   (_ "UNSUPPORTED"))
+                 ".tar.gz"))
+           (sha256
+            (base32
+             (match (%current-system)
+               ((or "i686-linux" "x86_64-linux")
+                "1pqiybxxv4wx5zlp1i60nim3njaczwl5321bdwq6frjsl3s95xmb")
+               (_ ""))))))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments ccl)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (replace 'unpack (assoc-ref %standard-phases 'unpack))
+           (add-after 'unpack 'unpack-image
+             (lambda* (#:key inputs #:allow-other-keys)
+               (invoke "tar" "xzvf" (assoc-ref inputs "ccl-bootstrap"))))))))
+    (supported-systems '("i686-linux" "x86_64-linux"))))
+
 (define-public lush2
   (package
     (name "lush2")
@@ -739,7 +852,7 @@ enough to play the original mainframe Zork all the way through.")
 (define-public txr
   (package
     (name "txr")
-    (version "224")
+    (version "235")
     (source
      (origin
        (method git-fetch)
@@ -747,24 +860,29 @@ enough to play the original mainframe Zork all the way through.")
              (url "http://www.kylheku.com/git/txr/")
              (commit (string-append "txr-" version))))
        (file-name (git-file-name name version))
-       (patches (search-patches "txr-shell.patch"))
        (sha256
-        (base32
-         "1036k71f6mffy9rjwzmhr5nnp1n0wzb0rqvilpzvb8jc5yxv0810"))))
+        (base32 "0kpqk2x0sz7sqxsrhasq0xnljjlnxwhh4xjx2nii0zy2jkv4vsbn"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:configure-flags '("cc=gcc")
-       #:phases (modify-phases %standard-phases
-                  (add-after 'configure 'fix-tests
-                    (lambda _
-                      (substitute* "tests/017/realpath.tl"
-                        (("/usr/bin") "/"))
-                      (substitute* "tests/017/realpath.expected"
-                        (("/usr/bin") "/"))
-                      #t))
-                  (replace 'check
-                    (lambda _
-                      (invoke "make" "tests"))))))
+     '(#:configure-flags
+       (list "cc=gcc"
+             (string-append "--prefix=" (assoc-ref %outputs "out")))
+       #:test-target "tests"
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           ;; ./configure is a hand-written script that can't handle standard
+           ;; autotools arguments like CONFIG_SHELL.
+           (lambda* (#:key configure-flags #:allow-other-keys)
+             (setenv "txr_shell" (which "bash"))
+             (apply invoke "./configure" configure-flags)
+             #t))
+         (add-after 'configure 'fix-tests
+           (lambda _
+             (substitute* (list "tests/017/realpath.tl"
+                                "tests/017/realpath.expected")
+               (("/usr/bin") "/"))
+             #t)))))
     (native-inputs
      `(("bison" ,bison)
        ("flex" ,flex)))
@@ -781,3 +899,161 @@ command line, to data scanning and extracting scripts, to full application
 development in a wide-range of areas.")
     (home-page "https://nongnu.org/txr/")
     (license license:bsd-2)))
+
+(define picolisp32
+  (package
+    (name "picolisp32")
+    (version "19.12")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://software-lab.de/picoLisp-" version ".tgz"))
+       (sha256
+        (base32 "10np0mhihr47r3201617zccrvzpkhdl1jwvz7zimk8kxpriydq2j"))
+       (modules '((guix build utils)))
+       (snippet '(begin
+                   ;; Delete the pre-compiled jar file.
+                   (delete-file "ersatz/picolisp.jar")
+                   #t))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("openssl" ,openssl)))
+    (arguments
+     `(#:system ,(match (%current-system)
+                   ((or "armhf-linux" "aarch64-linux")
+                    "armhf-linux")
+                   (_
+                    "i686-linux"))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-after 'unpack 'fix-paths
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (shebang-line (string-append
+                                   "#!" out "/bin/picolisp "
+                                   out "/lib/picolisp/lib.l")))
+               (substitute* '("bin/pil"
+                              "bin/pilIndent"
+                              "bin/pilPretty"
+                              "bin/psh"
+                              "bin/replica"
+                              "bin/vip"
+                              "bin/watchdog"
+                              "games/xchess"
+                              "misc/bigtest"
+                              "misc/calc"
+                              "misc/chat"
+                              "misc/mailing"
+                              "src/mkVers")
+                 (("#\\!bin/picolisp lib.l")
+                  shebang-line)
+                 (("#\\!\\.\\./bin/picolisp \\.\\./lib.l")
+                  shebang-line)
+                 (("#\\!/usr/bin/picolisp /usr/lib/picolisp/lib.l")
+                  shebang-line)))
+             #t))
+         (add-after 'fix-paths 'make-build-reproducible
+           (lambda _
+             (substitute* "src64/lib/asm.l"
+               (("\\(prinl \"/\\* \" \\(datSym \\(date\\)\\) \" \\*/\\)")
+                ""))
+             #t))
+         (add-after 'make-build-reproducible 'fix-permissions
+           (lambda _
+             (for-each make-file-writable
+                       '("doc/family.tgz"
+                         "doc/family64.tgz"
+                         "lib/map"
+                         "src64/tags"))
+             #t))
+         (replace 'build
+           (lambda _
+             (invoke "make" "-C" "src" "picolisp" "tools" "gate")))
+         (add-before 'check 'set-home-for-tests
+           (lambda _
+             (setenv "HOME" "/tmp")
+             #t))
+         (replace 'check
+           (lambda _
+             (invoke "./pil" "test/lib.l" "-bye" "+")))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (man (string-append out "/share/man"))
+                    (picolisp (string-append out "/lib/picolisp")))
+               (copy-recursively "man" man)
+               (copy-recursively "." picolisp)
+               (for-each (lambda (name)
+                           (let ((path (string-append picolisp "/" name)))
+                             (delete-file-recursively path)))
+                         '("CHANGES" "COPYING" "CREDITS" "cygwin"
+                           "INSTALL" "man" "pil" "README" "src" "src64"
+                           "test"))
+               (mkdir-p bin)
+               (symlink (string-append picolisp "/bin/picolisp")
+                        (string-append bin "/picolisp"))
+               (symlink (string-append picolisp "/bin/pil")
+                        (string-append bin "/pil")))
+             #t)))))
+    (synopsis "Interpreter for the PicoLisp programming language")
+    (description
+     "PicoLisp is a programming language, or really a programming system,
+including a built-in database engine and a GUI system.")
+    (home-page "https://picolisp.com/wiki/?home")
+    (license license:expat)))
+
+(define-public picolisp
+  (match (%current-system)
+    ((or "aarch64-linux" "x86_64-linux")
+     (package
+       ;; Use the 32-bit picolisp to generate the assembly files required by
+       ;; the 64-bit picolisp.
+       (inherit picolisp32)
+       (name "picolisp")
+       (native-inputs
+        `(("picolisp32" ,picolisp32)
+          ("which" ,which)))
+       (arguments
+        (substitute-keyword-arguments (package-arguments picolisp32)
+          ((#:system _ "") (%current-system))
+          ((#:phases phases)
+           `(modify-phases ,phases
+              (delete 'fix-paths)
+              (add-before 'build 'fix-paths
+                ;; This must run after the other shebang-patching phases,
+                ;; or they will override our changes.
+                (lambda* (#:key inputs outputs #:allow-other-keys)
+                  (let* ((picolisp32 (assoc-ref inputs "picolisp32"))
+                         (out (assoc-ref outputs "out"))
+                         (shebang-line (string-append
+                                        "#!" out "/bin/picolisp "
+                                        out "/lib/picolisp/lib.l")))
+                    (substitute* '("bin/pil"
+                                   "bin/pilIndent"
+                                   "bin/pilPretty"
+                                   "bin/psh"
+                                   "bin/replica"
+                                   "bin/vip"
+                                   "bin/watchdog"
+                                   "games/xchess"
+                                   "misc/bigtest"
+                                   "misc/calc"
+                                   "misc/chat"
+                                   "misc/mailing"
+                                   "src/mkVers")
+                      (("#\\!.*picolisp32.*/bin/picolisp .*lib\\.l")
+                       shebang-line))
+                    (substitute* "src64/mkAsm"
+                      (("/usr/bin/")
+                       (string-append picolisp32 "/bin/"))))
+                  #t))
+              (replace 'build
+                (lambda _
+                  (invoke "make" "-C" "src" "tools" "gate")
+                  (invoke "make" "-C" "src64" "CC=gcc" "picolisp")))))))))
+    (_
+     (package
+       (inherit picolisp32)
+       (name "picolisp")))))