1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
3 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
4 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
6 ;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
7 ;;; Copyright © 2016, 2017 Andy Patterson <ajpatter@uwaterloo.ca>
8 ;;; Copyright © 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
10 ;;; Copyright © 2017, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
12 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
13 ;;; Copyright © 2018, 2019, 2020 Pierre Neidhardt <mail@ambrevar.xyz>
14 ;;; Copyright © 2018, 2019 Pierre Langlois <pierre.langlois@gmx.com>
15 ;;; Copyright © 2019, 2020 Katherine Cox-Buday <cox.katherine.e@gmail.com>
16 ;;; Copyright © 2019 Jesse Gildersleve <jessejohngildersleve@protonmail.com>
17 ;;; Copyright © 2019, 2020 Guillaume Le Vaillant <glv@posteo.net>
18 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
20 ;;; This file is part of GNU Guix.
22 ;;; GNU Guix is free software; you can redistribute it and/or modify it
23 ;;; under the terms of the GNU General Public License as published by
24 ;;; the Free Software Foundation; either version 3 of the License, or (at
25 ;;; your option) any later version.
27 ;;; GNU Guix is distributed in the hope that it will be useful, but
28 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
29 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 ;;; GNU General Public License for more details.
32 ;;; You should have received a copy of the GNU General Public License
33 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
35 ;;; This file only contains Common Lisp compilers and tooling.
36 ;;; Common Lisp libraries go to lisp-xyz.scm.
37 ;;; Common Lisp applications should go to the most appropriate file,
38 ;;; e.g. StumpWM is in wm.scm.
40 (define-module (gnu packages lisp)
41 #:use-module (gnu packages)
42 #:use-module ((guix licenses) #:prefix license:)
43 #:use-module (guix packages)
44 #:use-module (guix download)
45 #:use-module (guix git-download)
46 #:use-module (guix utils)
47 #:use-module (guix build-system copy)
48 #:use-module (guix build-system gnu)
49 #:use-module (guix build-system ant)
50 #:use-module (guix build-system asdf)
51 #:use-module (guix build-system trivial)
52 #:use-module (gnu packages admin)
53 #:use-module (gnu packages base)
54 #:use-module (gnu packages bdw-gc)
55 #:use-module (gnu packages compression)
56 #:use-module (gnu packages ed)
57 #:use-module (gnu packages fontutils)
58 #:use-module (gnu packages gcc)
59 #:use-module (gnu packages gettext)
60 #:use-module (gnu packages gl)
61 #:use-module (gnu packages glib)
62 #:use-module (gnu packages m4)
63 #:use-module (gnu packages maths)
64 #:use-module (gnu packages multiprecision)
65 #:use-module (gnu packages ncurses)
66 #:use-module (gnu packages libffcall)
67 #:use-module (gnu packages libffi)
68 #:use-module (gnu packages libsigsegv)
69 #:use-module (gnu packages linux)
70 #:use-module (gnu packages perl)
71 #:use-module (gnu packages readline)
72 #:use-module (gnu packages sdl)
73 #:use-module (gnu packages tex)
74 #:use-module (gnu packages tls)
75 #:use-module (gnu packages texinfo)
76 #:use-module (gnu packages version-control)
77 #:use-module (gnu packages xorg)
78 #:use-module (ice-9 match))
80 (define-public cl-asdf
88 (string-append "https://common-lisp.net/project/asdf/archives/asdf-"
91 (base32 "1hpx30f6yrak15nw992k7x3pn75ahvjs04n4f134k68mhgs62km2"))))
92 (build-system trivial-build-system)
94 `(("config-patch" ,@(search-patches "cl-asdf-config-directories.patch"))
97 `(#:modules ((guix build utils)
98 (guix build lisp-utils))
101 (use-modules (guix build utils)
102 (guix build lisp-utils))
103 (let* ((out (string-append (assoc-ref %outputs "out")))
104 (asdf-install (string-append out %source-install-prefix
106 (src-asdf (string-append (assoc-ref %build-inputs "source")))
107 (dst-asdf (string-append asdf-install "asdf.lisp"))
108 (patch (string-append (assoc-ref %build-inputs "patch")
110 (config-patch (assoc-ref %build-inputs "config-patch")))
111 (mkdir-p asdf-install)
112 (copy-file src-asdf dst-asdf)
113 (invoke patch "-p1" "-i" config-patch dst-asdf)))))
114 (home-page "https://common-lisp.net/project/asdf/")
115 (synopsis "Another System Definition Facility")
117 "ASDF is what Common Lisp hackers use to build and load software. It is
118 the successor of the Lisp DEFSYSTEM of yore. ASDF stands for Another System
119 Definition Facility.")
121 (license license:expat)))
124 (let ((commit "d3335e2b3deb63f930eb0328e9b05377744c9512")
125 (revision "2")) ;Guix package revision
128 (version (string-append "2.6.12-" revision "."
129 (string-take commit 7)))
134 (url "https://git.savannah.gnu.org/r/gcl.git")
136 (file-name (string-append "gcl-" version "-checkout"))
138 (base32 "05v86lhvsby05nzvcd3c4k0wljvgdgd0i6arzd2fx1yd67dl6fgj"))))
139 (build-system gnu-build-system)
141 `(#:parallel-build? #f ; The build system seems not to be thread safe.
142 #:test-target "ansi-tests/test_results"
143 #:configure-flags '("--enable-ansi") ; required for use by the maxima package
145 (string-append "GCL_CC=" (assoc-ref %build-inputs "gcc")
147 (string-append "CC=" (assoc-ref %build-inputs "gcc")
150 (modify-phases %standard-phases
151 (add-before 'configure 'pre-conf
152 (lambda* (#:key inputs #:allow-other-keys)
156 '("pcl/impl/kcl/makefile.akcl"
158 "unixport/makefile.dos"
160 "gcl-tk/makefile.prev"
162 (find-files "h" "\\.defs"))
164 (string-append "SHELL=" (which "bash")))
166 (string-append "SHELL=" (which "sh"))))
167 (substitute* "h/linux.defs"
169 (("-fwritable-strings") "")
171 (substitute* "lsp/gcl_top.lsp"
173 (string-append "\"" (assoc-ref %build-inputs "gcc")
175 (("\\(or \\(get-path \\*cc\\*\\) \\*cc\\*\\)") "*cc*")
177 (string-append "\"" (assoc-ref %build-inputs "binutils")
179 (("\\(or \\(get-path \\*ld\\*\\) \\*ld\\*\\)") "*ld*")
180 (("\\(get-path \"objdump --source \"\\)")
181 (string-append "\"" (assoc-ref %build-inputs "binutils")
182 "/bin/objdump --source \"")))
184 (add-after 'install 'wrap
185 (lambda* (#:key inputs outputs #:allow-other-keys)
186 (let* ((gcl (assoc-ref outputs "out"))
187 (input-path (lambda (lib path)
189 (assoc-ref inputs lib) path)))
190 (binaries '("binutils")))
191 ;; GCC and the GNU binutils are necessary for GCL to be
192 ;; able to compile Lisp functions and programs (this is
193 ;; a standard feature in Common Lisp). While the
194 ;; the location of GCC is specified in the make-flags,
195 ;; the GNU binutils must be available in GCL's $PATH.
196 (wrap-program (string-append gcl "/bin/gcl")
197 `("PATH" prefix ,(map (lambda (binary)
198 (input-path binary "/bin"))
201 ;; drop strip phase to make maxima build, see
202 ;; https://www.ma.utexas.edu/pipermail/maxima/2008/009769.html
206 ("readline" ,readline)))
209 ("texinfo" ,texinfo)))
210 (home-page "https://www.gnu.org/software/gcl/")
211 (synopsis "A Common Lisp implementation")
212 (description "GCL is an implementation of the Common Lisp language. It
213 features the ability to compile to native object code and to load native
214 object code modules directly into its lisp core. It also features a
215 stratified garbage collection strategy, a source-level debugger and a built-in
216 interface to the Tk widget system.")
217 (license license:lgpl2.0+))))
227 "https://common-lisp.net/project/ecl/static/files/release/"
228 name "-" version ".tgz"))
230 (base32 "01qgdmr54wkj854f69qdm9sybrvd6gd21dpx4askdaaqybnkh237"))))
231 (build-system gnu-build-system)
232 ;; src/configure uses 'which' to confirm the existence of 'gzip'.
234 `(("cl-asdf" ,cl-asdf)
236 ("texinfo" ,texinfo)))
239 ("libatomic-ops" ,libatomic-ops)
243 `(#:configure-flags '("--without-rt")
244 ;; FIXME: As of version 20.4.24, we pass 17995 tests and fail 7.
245 ;; 2-3 tests may be due to FHS assumptions.
249 (modify-phases %standard-phases
251 (add-after 'unpack 'replace-asdf
252 ;; Use system ASDF instead of bundled one.
253 (lambda* (#:key inputs outputs #:allow-other-keys)
254 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
255 (guix-asdf (string-append
257 "/share/common-lisp/source/asdf/asdf.lisp"))
258 (out (string-append (assoc-ref outputs "out")))
259 (contrib-asdf "contrib/asdf/asdf.lisp"))
260 (copy-file guix-asdf contrib-asdf))
262 (add-after 'install 'wrap
263 (lambda* (#:key inputs outputs #:allow-other-keys)
264 (let* ((ecl (assoc-ref outputs "out"))
265 (input-path (lambda (lib path)
267 (assoc-ref inputs lib) path)))
268 (libraries '("gmp" "libatomic-ops" "libgc" "libffi" "libc"))
269 (binaries '("gcc" "ld-wrapper" "binutils"))
271 (map (lambda (lib) (input-path lib "/lib"))
274 (wrap-program (string-append ecl "/bin/ecl")
276 ,(map (lambda (binary)
277 (input-path binary "/bin"))
281 (input-path lib "/include"))
282 `("kernel-headers" ,@libraries)))
283 `("LIBRARY_PATH" suffix ,library-directories)
284 `("LD_LIBRARY_PATH" suffix ,library-directories)))))
285 (add-after 'wrap 'check (assoc-ref %standard-phases 'check))
286 (add-before 'check 'fix-path-to-ecl
288 (substitute* "build/tests/Makefile"
289 (("\\$\\{exec_prefix\\}/") ""))
292 (list (search-path-specification
293 (variable "XDG_DATA_DIRS")
295 (search-path-specification
296 (variable "XDG_CONFIG_DIRS")
298 (home-page "http://ecls.sourceforge.net/")
299 (synopsis "Embeddable Common Lisp")
300 (description "ECL is an implementation of the Common Lisp language as
301 defined by the ANSI X3J13 specification. Its most relevant features are: a
302 bytecode compiler and interpreter, being able to compile Common Lisp with any
303 C/C++ compiler, being able to build standalone executables and libraries, and
304 supporting ASDF, Sockets, Gray streams, MOP, and other useful components.")
305 ;; Note that the file "Copyright" points to some files and directories
306 ;; which aren't under the lgpl2.1+ and instead contain many different,
307 ;; non-copyleft licenses.
308 ;; See https://common-lisp.net/project/ecl/posts/ECL-license.html.
309 (license license:lgpl2.1+)))
319 (url "https://gitlab.com/gnu-clisp/clisp")
320 (commit "clisp-2.49.92-2018-02-18")))
321 (file-name (git-file-name name version))
323 (base32 "0k2dmgl0miz3767iks4p0mvp6xw0ysyxhjpklyh11j010rmh6hqb"))))
324 (build-system gnu-build-system)
325 (inputs `(("libffcall" ,libffcall)
327 ("readline" ,readline)
328 ("libsigsegv" ,libsigsegv)))
330 `(#:configure-flags '(,@(if (string-prefix? "armhf-linux"
331 (or (%current-system)
332 (%current-target-system)))
333 '("CFLAGS=-falign-functions=4")
336 "--with-dynamic-modules"
341 "--with-module=rawsock")
343 (modify-phases %standard-phases
344 (add-after 'unpack 'patch-sh-and-pwd
346 ;; The package is very messy with its references to "/bin/sh" and
347 ;; some other absolute paths to traditional tools. These appear in
348 ;; many places where our automatic patching misses them. Therefore
349 ;; we do the following, in this early (post-unpack) phase, to solve
350 ;; the problem from its root.
351 (substitute* '("src/clisp-link.in"
354 (("/bin/sh") (which "sh")))
355 (substitute* (find-files "." "configure|Makefile")
357 (substitute* '("src/clisp-link.in")
358 (("/bin/pwd") "pwd"))
360 (home-page "https://clisp.sourceforge.io/")
361 (synopsis "A Common Lisp implementation")
363 "GNU CLISP is an implementation of ANSI Common Lisp. Common Lisp is a
364 high-level, object-oriented functional programming language. CLISP includes
365 an interpreter, a compiler, a debugger, and much more.")
366 (license license:gpl2+)))
375 (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-"
376 version "-source.tar.bz2"))
378 (base32 "07cpswxh2f38b440xdn3fjk7b4r0ipj3sbwb3jd134phrr9smll7"))))
379 (build-system gnu-build-system)
380 (outputs '("out" "doc"))
383 ;; Supported build hosts are:
386 ;; CCL (formerly known as OpenMCL)
387 ;; ABCL (recent versions only)
388 ;; CLISP (only some versions: 2.44.1 is OK, 2.47 is not)
392 ;; * build enhancement: new host quirks mechanism, support for building under
393 ;; ABCL and ECL (as well as CCL, CMUCL, CLISP and SBCL itself)
395 ;; CCL is not bootstrappable so it won't do. CLISP 2.49 seems to work.
396 ;; ECL too. As of 2020-07-01, ECL was last updated in 2020 while CLISP
397 ;; was last updated in 2010, and both take about the same time to build SBCL.
399 ;; For now we stick to CLISP for all systems. We keep the `match' here
400 ;; to make it easier to change the host compiler for various
401 ;; architectures. Consider switching to ECL if it gets faster than CLISP
402 ;; (maybe post 2020 release).
403 `(,@(match (%current-system)
404 ((or "x86_64-linux" "i686-linux")
407 `(("clisp" ,clisp))))
410 ("inetutils" ,inetutils) ;for hostname(1)
412 ("texlive" ,(texlive-union (list texlive-tex-texinfo)))
416 `(#:modules ((guix build gnu-build-system)
420 (modify-phases %standard-phases
422 (add-after 'unpack 'replace-asdf
423 ;; SBCL developers have not committed to keeping ASDF up to date
424 ;; due to breaking changes [1]. Guix can handle this situation
425 ;; easily, and it behooves us to have more control over what version
426 ;; of ASDF we use to build software; therefore, replace the contrib
427 ;; ASDF with the version packaged into Guix.
428 ;; [1] - https://bugs.launchpad.net/sbcl/+bug/1823442
429 (lambda* (#:key inputs outputs #:allow-other-keys)
430 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
431 (guix-asdf (string-append
433 "/share/common-lisp/source/asdf/asdf.lisp"))
434 (out (string-append (assoc-ref outputs "out")))
435 (contrib-asdf "contrib/asdf/asdf.lisp"))
436 (copy-file guix-asdf contrib-asdf))
438 (add-before 'build 'patch-unix-tool-paths
439 (lambda* (#:key outputs inputs #:allow-other-keys)
440 (let ((out (assoc-ref outputs "out"))
441 (bash (assoc-ref inputs "bash"))
442 (coreutils (assoc-ref inputs "coreutils"))
443 (ed (assoc-ref inputs "ed")))
444 (define (quoted-path input path)
445 (string-append "\"" input path "\""))
446 ;; Patch absolute paths in string literals. Note that this
447 ;; occurs in some .sh files too (which contain Lisp code). Use
448 ;; ISO-8859-1 because some of the files are ISO-8859-1 encoded.
449 (with-fluids ((%default-port-encoding #f))
450 ;; The removed file is utf-16-be encoded, which gives substitute*
451 ;; trouble. It does not contain references to the listed programs.
453 "./tests/data/compile-file-pos-utf16be.lisp"
454 (find-files "." "\\.(lisp|sh)$"))
455 (("\"/bin/sh\"") (quoted-path bash "/bin/sh"))
456 (("\"/usr/bin/env\"") (quoted-path coreutils "/usr/bin/env"))
457 (("\"/bin/cat\"") (quoted-path coreutils "/bin/cat"))
458 (("\"/bin/ed\"") (quoted-path ed "/bin/ed"))
459 (("\"/bin/echo\"") (quoted-path coreutils "/bin/echo"))
460 (("\"/bin/uname\"") (quoted-path coreutils "/bin/uname"))))
461 ;; This one script has a non-string occurrence of /bin/sh.
462 (substitute* '("tests/foreign.test.sh")
463 ;; Leave whitespace so we don't match the shebang.
464 ((" /bin/sh ") " sh "))
465 ;; This file contains a module that can create executable files
466 ;; which depend on the presence of SBCL. It generates shell
467 ;; scripts doing "exec sbcl ..." to achieve this. We patch both
468 ;; the shebang and the reference to "sbcl", tying the generated
469 ;; executables to the exact SBCL package that generated them.
470 (substitute* '("contrib/sb-executable/sb-executable.lisp")
471 (("/bin/sh") (string-append bash "/bin/sh"))
472 (("exec sbcl") (string-append "exec " out "/bin/sbcl")))
473 ;; Disable some tests that fail in our build environment.
474 (substitute* '("contrib/sb-bsd-sockets/tests.lisp")
475 ;; This requires /etc/protocols.
476 (("\\(deftest get-protocol-by-name/error" all)
477 (string-append "#+nil ;disabled by Guix\n" all)))
478 (substitute* '("contrib/sb-posix/posix-tests.lisp")
479 ;; These assume some users/groups which we don't have.
480 (("\\(deftest pwent\\.[12]" all)
481 (string-append "#+nil ;disabled by Guix\n" all))
482 (("\\(deftest grent\\.[12]" all)
483 (string-append "#+nil ;disabled by Guix\n" all))))
485 ;; FIXME: the texlive-union insists on regenerating fonts. It stores
486 ;; them in HOME, so it needs to be writeable.
487 (add-before 'build 'set-HOME
488 (lambda _ (setenv "HOME" "/tmp") #t))
490 (lambda* (#:key outputs #:allow-other-keys)
492 (invoke "sh" "make.sh" ,@(match (%current-system)
493 ((or "x86_64-linux" "i686-linux")
497 (string-append "--prefix="
498 (assoc-ref outputs "out"))
499 "--dynamic-space-size=3072"
500 "--with-sb-core-compression"
501 "--with-sb-xref-for-internals")))
504 (invoke "sh" "install.sh")))
505 (add-after 'build 'build-doc
507 ;; TODO: Doc is not deterministic, maybe there is a timespamp?
508 (with-directory-excursion "doc/manual"
509 (and (invoke "make" "info")
510 (invoke "make" "dist")))))
511 (add-after 'build 'build-source
512 (lambda* (#:key outputs #:allow-other-keys)
513 (let* ((out (assoc-ref outputs "out"))
514 (rc (string-append out "/lib/sbcl/sbclrc"))
515 (source-dir (string-append out "/share/sbcl")))
516 (for-each (lambda (p)
517 (copy-recursively p (string-append source-dir "/" p)))
519 (mkdir-p (dirname rc))
520 (with-output-to-file rc
523 (string-append "(sb-ext:set-sbcl-source-location \""
524 source-dir "\")") )))
526 (add-after 'install 'install-doc
527 (lambda* (#:key outputs #:allow-other-keys)
528 (let* ((out (assoc-ref outputs "out"))
529 (doc (assoc-ref outputs "doc"))
530 (old-doc-dir (string-append out "/share/doc"))
531 (new-doc/sbcl-dir (string-append doc "/share/doc/sbcl")))
532 (rmdir (string-append old-doc-dir "/sbcl/html"))
533 (mkdir-p new-doc/sbcl-dir)
534 (copy-recursively (string-append old-doc-dir "/sbcl")
536 (delete-file-recursively old-doc-dir)
538 ;; No 'check' target, though "make.sh" (build phase) runs tests.
541 (list (search-path-specification
542 (variable "XDG_DATA_DIRS")
544 (search-path-specification
545 (variable "XDG_CONFIG_DIRS")
547 (home-page "http://www.sbcl.org/")
548 (synopsis "Common Lisp implementation")
549 (description "Steel Bank Common Lisp (SBCL) is a high performance Common
550 Lisp compiler. In addition to the compiler and runtime system for ANSI Common
551 Lisp, it provides an interactive environment including a debugger, a
552 statistical profiler, a code coverage tool, and many other extensions.")
553 ;; Public domain in jurisdictions that allow it, bsd-2 otherwise. MIT
554 ;; loop macro has its own license. See COPYING file for further notes.
555 (license (list license:public-domain license:bsd-2
556 (license:x11-style "file://src/code/loop.lisp")))))
559 ;; Warning: according to upstream, CCL is not bootstrappable.
560 ;; See https://github.com/Clozure/ccl/issues/222 from 2019-09-02:
562 ;; "As far as I know, there is no way to build CCL without an existing
563 ;; running CCL image. It was bootstrapped back in 1986 or so as
564 ;; Macintosh Common Lisp, by Gary Byers, I believe, who is no longer on
565 ;; the planet to tell us the story. It SHOULD be possible to port the
566 ;; CCL compiler to portable Common Lisp, so that ANY lisp could build
567 ;; it, as is the case for SBCL, but I know of no attempt to do so."
574 (url "https://github.com/Clozure/ccl/")
575 (commit (string-append "v" version))))
576 (file-name (git-file-name "ccl" version))
579 "0kxr24d2fzsmpsilijpwwfl6g89y7fcrwb80kai5nx9pwgxmjbp3"))))
580 (build-system gnu-build-system)
581 ;; CCL consists of a "lisp kernel" and "heap image", both of which are
582 ;; shipped in precompiled form in source tarballs. The former is a C
583 ;; program which we can rebuild from scratch, but the latter cannot be
584 ;; generated without an already working copy of CCL, and is platform
585 ;; dependent, so we need to fetch the correct tarball for the platform.
591 "https://github.com/Clozure/ccl/releases/download/v" version "/"
592 (match (%current-system)
593 ("armhf-linux" "linuxarm")
594 ;; XXX: This source only works on x86, but provide it as a
595 ;; catch-all to prevent errors when querying this package
596 ;; on unsupported platforms.
601 (match (%current-system)
603 "0x4bjx6cxsjvxyagijhlvmc7jkyxifdvz5q5zvz37028va65243c")
604 (_ "15l7cfa4a7jkfwdzsfm4q3n22jnb57imxahpql3h77xin57v1gbz"))))))))
608 `(#:tests? #f ;no 'check' target
609 #:modules ((ice-9 match)
612 (guix build gnu-build-system))
614 (modify-phases %standard-phases
615 (add-after 'unpack 'unpack-image
616 (lambda* (#:key inputs #:allow-other-keys)
617 (invoke "tar" "xzvf" (assoc-ref inputs "ccl-bootstrap"))))
619 (add-before 'build 'pre-build
620 ;; Enter the source directory for the current platform's lisp
621 ;; kernel, and run 'make clean' to remove the precompiled one.
622 (lambda* (#:key system #:allow-other-keys)
623 (substitute* "lisp-kernel/m4macros.m4"
624 (("/bin/pwd") (which "pwd")))
625 (chdir (string-append
628 ("i686-linux" "linuxx8632")
629 ("x86_64-linux" "linuxx8664")
630 ("armhf-linux" "linuxarm")
631 (_ (string-append "unknown system: " system)))))
632 (substitute* '("Makefile")
635 (invoke "make" "clean")))
636 ;; XXX Do we need to recompile the heap image as well for Guix?
637 ;; For now just use the one we already got in the tarball.
639 (lambda* (#:key outputs inputs system #:allow-other-keys)
640 ;; The lisp kernel built by running 'make' in lisp-kernel/$system
641 ;; is put back into the original directory, so go back. The heap
642 ;; image is there as well.
644 (let* ((out (assoc-ref outputs "out"))
645 (libdir (string-append out "/lib/"))
646 (bindir (string-append out "/bin/"))
647 (wrapper (string-append bindir "ccl"))
648 (bash (assoc-ref inputs "bash"))
651 ("i686-linux" "lx86cl")
652 ("x86_64-linux" "lx86cl64")
653 ("armhf-linux" "armcl")
654 ;; Unlikely to work, but try it anyway...
656 (heap (string-append kernel ".image")))
657 (install-file kernel libdir)
658 (install-file heap libdir)
660 (let ((dirs `("lib" "library" "examples" "tools" "objc-bridge"
667 (for-each copy-recursively
669 (map (cut string-append libdir <>) dirs)))
672 (with-output-to-file wrapper
676 "#!" bash "/bin/sh\n"
677 "export CCL_DEFAULT_DIRECTORY=" libdir "\n"
678 "exec -a \"$0\" " libdir kernel " \"$@\"\n"))))
679 (chmod wrapper #o755))
681 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
682 (home-page "https://ccl.clozure.com/")
683 (synopsis "Common Lisp implementation")
684 (description "Clozure CL (often called CCL for short) is a Common Lisp
685 implementation featuring fast compilation speed, native threads, a precise,
686 generational, compacting garbage collector, and a convenient foreign-function
688 (license license:asl2.0)))
697 (uri (string-append "mirror://sourceforge/lush/lush2/lush-"
699 (modules '((guix build utils)))
702 (substitute* "src/unix.c"
703 (("\\{ \"LUSH_DATE\", __DATE__ \\},") "")
704 (("\\{ \"LUSH_TIME\", __TIME__ \\},") ""))
705 (substitute* "src/main.c"
706 (("\" \\(built \" __DATE__ \"\\)\"") ""))
710 "02pkfn3nqdkm9fm44911dbcz0v3r0l53vygj8xigl6id5g3iwi4k"))))
711 (build-system gnu-build-system)
713 `(;; We have to add these LIBS so that they are found.
714 #:configure-flags (list "LIBS=-lz"
715 "X_EXTRA_LIBS=-lfontconfig"
717 #:tests? #f)) ; No make check.
718 (native-inputs `(("intltool" ,intltool)))
720 `(("alsa-lib" ,alsa-lib)
722 ("sdl-image" ,sdl-image)
723 ("sdl-mixer" ,sdl-mixer)
728 ("fontconfig" ,fontconfig)
730 ("openblas" ,openblas)
733 ("mesa-utils" ,mesa-utils)
734 ("binutils" ,binutils)
735 ("libiberty" ,libiberty)
736 ("readline" ,readline)
738 ("gettext-minimal" ,gettext-minimal)))
739 (synopsis "Lisp Universal Shell")
741 "Lush is an object-oriented Lisp interpreter/compiler with features
742 designed to please people who want to prototype large numerical
743 applications. Lush includes an extensive library of
744 vector/matrix/tensor manipulation, numerous numerical libraries
745 (including GSL, LAPACK, and BLAS), a set of graphic functions, a
746 simple GUI toolkit, and interfaces to various graphic and multimedia
747 libraries such as OpenGL, SDL, Video4Linux, and ALSA (video/audio
748 grabbing), and others. Lush is an ideal frontend script language for
749 programming projects written in C or other languages. Lush also has
750 libraries for Machine Learning, Neural Nets and statistical estimation.")
751 (home-page "http://lush.sourceforge.net/")
752 (license license:lgpl2.1+)))
754 (define-public confusion-mdl
755 (let* ((commit "12a055581fc262225272df43287dae48281900f5"))
757 (name "confusion-mdl")
762 (url (string-append "https://gitlab.com/emacsomancer/" name))
766 "1zi8kflzvwqg97ha1sa5xjisbjs5z1mvbpa772vfxiv5ksnpxp0d"))
767 (file-name (git-file-name name version))))
768 (build-system gnu-build-system)
770 `(#:tests? #f ; there are no tests
772 (modify-phases %standard-phases
775 (lambda* (#:key (make-flags '()) #:allow-other-keys)
776 (apply invoke "make" "CC=gcc" make-flags)))
778 (lambda* (#:key outputs #:allow-other-keys)
779 (let* ((out (assoc-ref outputs "out"))
780 (bin (string-append out "/bin")))
781 (install-file "mdli" bin)
787 (synopsis "Interpreter for the MIT Design Language (MDL)")
788 (description "MDL (the MIT Design Language) is a descendant of Lisp. It
789 was originally developed in 1971 on the PDP-10 computer under the Incompatible
790 Timesharing System (ITS) to provide high level language support for the
791 Dynamic Modeling Group at MIT's Project MAC. Infocom built the original
792 PDP-10 Zork in MDL and their later ZIL (Zork Implementation Language) was
793 based on a subset of MDL. Confusion is a MDL interpreter that works just well
794 enough to play the original mainframe Zork all the way through.")
795 (home-page "http://www.russotto.net/git/mrussotto/confusion/src/master/src/README")
796 (license license:gpl3+))))
806 (url "http://www.kylheku.com/git/txr/")
807 (commit (string-append "txr-" version))))
808 (file-name (git-file-name name version))
810 (base32 "1bzhb1pms6gjzphbsimhwdyq46ik1m7sgldigg5l1q7bppg9r3i0"))))
811 (build-system gnu-build-system)
814 (list ,(string-append "cc=" (cc-for-target))
815 (string-append "--prefix=" (assoc-ref %outputs "out")))
816 #:test-target "tests"
818 (modify-phases %standard-phases
820 ;; ./configure is a hand-written script that can't handle standard
821 ;; autotools arguments like CONFIG_SHELL.
822 (lambda* (#:key configure-flags #:allow-other-keys)
823 (setenv "txr_shell" (which "bash"))
824 (apply invoke "./configure" configure-flags)
826 (add-after 'configure 'fix-tests
828 (substitute* (list "tests/017/realpath.tl"
829 "tests/017/realpath.expected")
833 `(("libffi" ,libffi)))
834 (synopsis "General-purpose, multi-paradigm programming language")
836 "TXR is a general-purpose, multi-paradigm programming language. It
837 comprises two languages integrated into a single tool: a text scanning and
838 extraction language referred to as the TXR Pattern Language (sometimes just
839 \"TXR\"), and a general-purpose dialect of Lisp called TXR Lisp. TXR can be
840 used for everything from \"one liner\" data transformation tasks at the
841 command line, to data scanning and extracting scripts, to full application
842 development in a wide-range of areas.")
843 (home-page "https://nongnu.org/txr/")
844 (license license:bsd-2)))
853 (uri (string-append "https://software-lab.de/picoLisp-" version ".tgz"))
855 (base32 "10np0mhihr47r3201617zccrvzpkhdl1jwvz7zimk8kxpriydq2j"))
856 (modules '((guix build utils)))
858 ;; Delete the pre-compiled jar file.
859 (delete-file "ersatz/picolisp.jar")
861 (build-system gnu-build-system)
863 `(("openssl" ,openssl)))
865 `(#:system ,(match (%current-system)
866 ((or "armhf-linux" "aarch64-linux")
871 (modify-phases %standard-phases
873 (add-after 'unpack 'fix-paths
874 (lambda* (#:key outputs #:allow-other-keys)
875 (let* ((out (assoc-ref outputs "out"))
876 (shebang-line (string-append
877 "#!" out "/bin/picolisp "
878 out "/lib/picolisp/lib.l")))
879 (substitute* '("bin/pil"
892 (("#\\!bin/picolisp lib.l")
894 (("#\\!\\.\\./bin/picolisp \\.\\./lib.l")
896 (("#\\!/usr/bin/picolisp /usr/lib/picolisp/lib.l")
899 (add-after 'fix-paths 'make-build-reproducible
901 (substitute* "src64/lib/asm.l"
902 (("\\(prinl \"/\\* \" \\(datSym \\(date\\)\\) \" \\*/\\)")
905 (add-after 'make-build-reproducible 'fix-permissions
907 (for-each make-file-writable
915 (invoke "make" "-C" "src" "picolisp" "tools" "gate")))
916 (add-before 'check 'set-home-for-tests
918 (setenv "HOME" "/tmp")
922 (invoke "./pil" "test/lib.l" "-bye" "+")))
924 (lambda* (#:key outputs #:allow-other-keys)
925 (let* ((out (assoc-ref outputs "out"))
926 (bin (string-append out "/bin"))
927 (man (string-append out "/share/man"))
928 (picolisp (string-append out "/lib/picolisp")))
929 (copy-recursively "man" man)
930 (copy-recursively "." picolisp)
931 (for-each (lambda (name)
932 (let ((path (string-append picolisp "/" name)))
933 (delete-file-recursively path)))
934 '("CHANGES" "COPYING" "CREDITS" "cygwin"
935 "INSTALL" "man" "pil" "README" "src" "src64"
938 (symlink (string-append picolisp "/bin/picolisp")
939 (string-append bin "/picolisp"))
940 (symlink (string-append picolisp "/bin/pil")
941 (string-append bin "/pil")))
943 (synopsis "Interpreter for the PicoLisp programming language")
945 "PicoLisp is a programming language, or really a programming system,
946 including a built-in database engine and a GUI system.")
947 (home-page "https://picolisp.com/wiki/?home")
948 (license license:expat)))
950 (define-public picolisp
951 (match (%current-system)
952 ((or "aarch64-linux" "x86_64-linux")
954 ;; Use the 32-bit picolisp to generate the assembly files required by
955 ;; the 64-bit picolisp.
959 `(("picolisp32" ,picolisp32)
962 (substitute-keyword-arguments (package-arguments picolisp32)
963 ((#:system _ "") (%current-system))
965 `(modify-phases ,phases
967 (add-before 'build 'fix-paths
968 ;; This must run after the other shebang-patching phases,
969 ;; or they will override our changes.
970 (lambda* (#:key inputs outputs #:allow-other-keys)
971 (let* ((picolisp32 (assoc-ref inputs "picolisp32"))
972 (out (assoc-ref outputs "out"))
973 (shebang-line (string-append
974 "#!" out "/bin/picolisp "
975 out "/lib/picolisp/lib.l")))
976 (substitute* '("bin/pil"
989 (("#\\!.*picolisp32.*/bin/picolisp .*lib\\.l")
991 (substitute* "src64/mkAsm"
993 (string-append picolisp32 "/bin/"))))
997 (invoke "make" "-C" "src" "tools" "gate")
998 (invoke "make" "-C" "src64" "CC=gcc" "picolisp")))))))))
1001 (inherit picolisp32)
1002 (name "picolisp")))))
1004 (define-public janet
1012 (url "https://github.com/janet-lang/janet")
1013 (commit (string-append "v" version))))
1014 (file-name (git-file-name name version))
1016 (base32 "0if514zdmbjvvrsa9x5yfvg2b14sz53yaka12g3yhwkq8ls3qk0c"))))
1017 (build-system gnu-build-system)
1019 `(#:make-flags (list
1020 (string-append "DESTDIR=" (assoc-ref %outputs "out"))
1021 (string-append "PREFIX=")
1022 (string-append "CC=" (assoc-ref %build-inputs "gcc")
1025 (modify-phases %standard-phases
1029 (invoke "make" "test"))))))
1030 (home-page "https://janet-lang.org/")
1031 (synopsis "Functional, imperative and embeddable programming language")
1033 "Janet is a functional and imperative programming language. It can be
1034 used for rapid prototyping, dynamic systems, and other domains where dynamic
1035 languages shine. You can also add Janet scripting to an application by
1036 embedding a single C file and two headers. It can be easily ported to new
1037 platforms. The entire language (core library, interpreter, compiler,
1038 assembler, PEG) is less than 1MB.")
1039 (license license:expat)))
1041 (define-public lisp-repl-core-dumper
1043 (name "lisp-repl-core-dumper")
1049 (url "https://gitlab.com/ambrevar/lisp-repl-core-dumper.git")
1051 (file-name (git-file-name name version))
1053 (base32 "1w7x7d7bnrdj0bd04vnjy7d7sngvcx1yjr4iw429hdd9lzlg8rbg"))))
1054 (build-system copy-build-system)
1057 '(("lisp-repl-core-dumper" "bin/"))
1059 (modify-phases %standard-phases
1060 (add-before 'install 'fix-utils-path
1061 (lambda* (#:key inputs #:allow-other-keys)
1062 (let* ((coreutils (string-append (assoc-ref inputs "coreutils") "/bin/"))
1063 (paste (string-append coreutils "paste"))
1064 (sort (string-append coreutils "sort"))
1065 (basename (string-append coreutils "basename"))
1066 (sed (string-append (assoc-ref inputs "sed") "/bin/sed")))
1067 (substitute* "lisp-repl-core-dumper"
1068 (("\\$\\(basename") (string-append "$(" basename))
1069 (("\\<paste\\>") paste)
1071 (("\\<sort\\>") sort))))))))
1073 `(("coreutils" ,coreutils-minimal)
1075 (home-page "https://gitlab.com/ambrevar/lisp-repl-core-dumper")
1076 (synopsis "Generate REPL-optimized Lisp cores on demand")
1078 "This tool generates Lisp images that can embed the provided systems
1079 and make for REPLs that start blazing fast.
1082 @item It’s portable and should work with any compiler.
1083 @item It works for any REPL.
1084 @item It allows you to include arbitrary libraries.
1086 (license license:gpl3+)))