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>
19 ;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
21 ;;; This file is part of GNU Guix.
23 ;;; GNU Guix is free software; you can redistribute it and/or modify it
24 ;;; under the terms of the GNU General Public License as published by
25 ;;; the Free Software Foundation; either version 3 of the License, or (at
26 ;;; your option) any later version.
28 ;;; GNU Guix is distributed in the hope that it will be useful, but
29 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
30 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 ;;; GNU General Public License for more details.
33 ;;; You should have received a copy of the GNU General Public License
34 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
36 ;;; This file only contains Common Lisp compilers and tooling.
37 ;;; Common Lisp libraries go to lisp-xyz.scm.
38 ;;; Common Lisp applications should go to the most appropriate file,
39 ;;; e.g. StumpWM is in wm.scm.
41 (define-module (gnu packages lisp)
42 #:use-module (gnu packages)
43 #:use-module ((guix licenses) #:prefix license:)
44 #:use-module (guix packages)
45 #:use-module (guix download)
46 #:use-module (guix git-download)
47 #:use-module (guix utils)
48 #:use-module (guix build-system copy)
49 #:use-module (guix build-system gnu)
50 #:use-module (guix build-system ant)
51 #:use-module (guix build-system asdf)
52 #:use-module (guix build-system trivial)
53 #:use-module (gnu packages admin)
54 #:use-module (gnu packages base)
55 #:use-module (gnu packages bdw-gc)
56 #:use-module (gnu packages compression)
57 #:use-module (gnu packages ed)
58 #:use-module (gnu packages fontutils)
59 #:use-module (gnu packages gcc)
60 #:use-module (gnu packages gettext)
61 #:use-module (gnu packages gl)
62 #:use-module (gnu packages glib)
63 #:use-module (gnu packages m4)
64 #:use-module (gnu packages maths)
65 #:use-module (gnu packages multiprecision)
66 #:use-module (gnu packages ncurses)
67 #:use-module (gnu packages libffcall)
68 #:use-module (gnu packages libffi)
69 #:use-module (gnu packages libsigsegv)
70 #:use-module (gnu packages linux)
71 #:use-module (gnu packages perl)
72 #:use-module (gnu packages readline)
73 #:use-module (gnu packages sdl)
74 #:use-module (gnu packages tex)
75 #:use-module (gnu packages tls)
76 #:use-module (gnu packages texinfo)
77 #:use-module (gnu packages version-control)
78 #:use-module (gnu packages xorg)
79 #:use-module (ice-9 match))
81 (define-public cl-asdf
89 (string-append "https://common-lisp.net/project/asdf/archives/asdf-"
92 (base32 "1hpx30f6yrak15nw992k7x3pn75ahvjs04n4f134k68mhgs62km2"))))
93 (build-system trivial-build-system)
95 `(("config-patch" ,@(search-patches "cl-asdf-config-directories.patch"))
98 `(#:modules ((guix build utils)
99 (guix build lisp-utils))
102 (use-modules (guix build utils)
103 (guix build lisp-utils))
104 (let* ((out (string-append (assoc-ref %outputs "out")))
105 (asdf-install (string-append out %source-install-prefix
107 (src-asdf (string-append (assoc-ref %build-inputs "source")))
108 (dst-asdf (string-append asdf-install "asdf.lisp"))
109 (patch (string-append (assoc-ref %build-inputs "patch")
111 (config-patch (assoc-ref %build-inputs "config-patch")))
112 (mkdir-p asdf-install)
113 (copy-file src-asdf dst-asdf)
114 (invoke patch "-p1" "-i" config-patch dst-asdf)))))
115 (home-page "https://common-lisp.net/project/asdf/")
116 (synopsis "Another System Definition Facility")
118 "ASDF is what Common Lisp hackers use to build and load software. It is
119 the successor of the Lisp DEFSYSTEM of yore. ASDF stands for Another System
120 Definition Facility.")
122 (license license:expat)))
125 (let ((commit "d3335e2b3deb63f930eb0328e9b05377744c9512")
126 (revision "2")) ;Guix package revision
129 (version (string-append "2.6.12-" revision "."
130 (string-take commit 7)))
135 (url "https://git.savannah.gnu.org/r/gcl.git")
137 (file-name (string-append "gcl-" version "-checkout"))
139 (base32 "05v86lhvsby05nzvcd3c4k0wljvgdgd0i6arzd2fx1yd67dl6fgj"))))
140 (build-system gnu-build-system)
142 `(#:parallel-build? #f ; The build system seems not to be thread safe.
143 #:test-target "ansi-tests/test_results"
144 #:configure-flags '("--enable-ansi") ; required for use by the maxima package
146 (string-append "GCL_CC=" (assoc-ref %build-inputs "gcc")
148 (string-append "CC=" (assoc-ref %build-inputs "gcc")
151 (modify-phases %standard-phases
152 (add-before 'configure 'pre-conf
153 (lambda* (#:key inputs #:allow-other-keys)
157 '("pcl/impl/kcl/makefile.akcl"
159 "unixport/makefile.dos"
161 "gcl-tk/makefile.prev"
163 (find-files "h" "\\.defs"))
165 (string-append "SHELL=" (which "bash")))
167 (string-append "SHELL=" (which "sh"))))
168 (substitute* "h/linux.defs"
170 (("-fwritable-strings") "")
172 (substitute* "lsp/gcl_top.lsp"
174 (string-append "\"" (assoc-ref %build-inputs "gcc")
176 (("\\(or \\(get-path \\*cc\\*\\) \\*cc\\*\\)") "*cc*")
178 (string-append "\"" (assoc-ref %build-inputs "binutils")
180 (("\\(or \\(get-path \\*ld\\*\\) \\*ld\\*\\)") "*ld*")
181 (("\\(get-path \"objdump --source \"\\)")
182 (string-append "\"" (assoc-ref %build-inputs "binutils")
183 "/bin/objdump --source \"")))
185 (add-after 'install 'wrap
186 (lambda* (#:key inputs outputs #:allow-other-keys)
187 (let* ((gcl (assoc-ref outputs "out"))
188 (input-path (lambda (lib path)
190 (assoc-ref inputs lib) path)))
191 (binaries '("binutils")))
192 ;; GCC and the GNU binutils are necessary for GCL to be
193 ;; able to compile Lisp functions and programs (this is
194 ;; a standard feature in Common Lisp). While the
195 ;; the location of GCC is specified in the make-flags,
196 ;; the GNU binutils must be available in GCL's $PATH.
197 (wrap-program (string-append gcl "/bin/gcl")
198 `("PATH" prefix ,(map (lambda (binary)
199 (input-path binary "/bin"))
202 ;; drop strip phase to make maxima build, see
203 ;; https://www.ma.utexas.edu/pipermail/maxima/2008/009769.html
207 ("readline" ,readline)))
210 ("texinfo" ,texinfo)))
211 (home-page "https://www.gnu.org/software/gcl/")
212 (synopsis "A Common Lisp implementation")
213 (description "GCL is an implementation of the Common Lisp language. It
214 features the ability to compile to native object code and to load native
215 object code modules directly into its lisp core. It also features a
216 stratified garbage collection strategy, a source-level debugger and a built-in
217 interface to the Tk widget system.")
218 (license license:lgpl2.0+))))
228 "https://common-lisp.net/project/ecl/static/files/release/"
229 name "-" version ".tgz"))
231 (base32 "01qgdmr54wkj854f69qdm9sybrvd6gd21dpx4askdaaqybnkh237"))))
232 (build-system gnu-build-system)
233 ;; src/configure uses 'which' to confirm the existence of 'gzip'.
235 `(("cl-asdf" ,cl-asdf)
237 ("texinfo" ,texinfo)))
240 ("libatomic-ops" ,libatomic-ops)
244 `(#:configure-flags '("--without-rt")
245 ;; FIXME: As of version 20.4.24, we pass 17995 tests and fail 7.
246 ;; 2-3 tests may be due to FHS assumptions.
250 (modify-phases %standard-phases
252 (add-after 'unpack 'replace-asdf
253 ;; Use system ASDF instead of bundled one.
254 (lambda* (#:key inputs #:allow-other-keys)
255 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
256 (guix-asdf (string-append
258 "/share/common-lisp/source/asdf/asdf.lisp"))
259 (contrib-asdf "contrib/asdf/asdf.lisp"))
260 (copy-file guix-asdf contrib-asdf))
262 (add-after 'install 'remove-build-stamp
263 (lambda* (#:key outputs #:allow-other-keys)
264 (delete-file (string-append (assoc-ref outputs "out")
265 "/lib/ecl-" ,version "/build-stamp"))
267 (add-after 'remove-build-stamp 'wrap
268 (lambda* (#:key inputs outputs #:allow-other-keys)
269 (let* ((ecl (assoc-ref outputs "out"))
270 (input-path (lambda (lib path)
272 (assoc-ref inputs lib) path)))
273 (libraries '("gmp" "libatomic-ops" "libgc" "libffi" "libc"))
274 (binaries '("gcc" "ld-wrapper" "binutils"))
276 (map (lambda (lib) (input-path lib "/lib"))
279 (wrap-program (string-append ecl "/bin/ecl")
281 ,(map (lambda (binary)
282 (input-path binary "/bin"))
286 (input-path lib "/include"))
287 `("kernel-headers" ,@libraries)))
288 `("LIBRARY_PATH" suffix ,library-directories)
289 `("LD_LIBRARY_PATH" suffix ,library-directories))
291 (add-after 'wrap 'check (assoc-ref %standard-phases 'check))
292 (add-before 'check 'fix-path-to-ecl
294 (substitute* "build/tests/Makefile"
295 (("\\$\\{exec_prefix\\}/") ""))
298 (list (search-path-specification
299 (variable "XDG_DATA_DIRS")
301 (search-path-specification
302 (variable "XDG_CONFIG_DIRS")
304 (home-page "http://ecls.sourceforge.net/")
305 (synopsis "Embeddable Common Lisp")
306 (description "ECL is an implementation of the Common Lisp language as
307 defined by the ANSI X3J13 specification. Its most relevant features are: a
308 bytecode compiler and interpreter, being able to compile Common Lisp with any
309 C/C++ compiler, being able to build standalone executables and libraries, and
310 supporting ASDF, Sockets, Gray streams, MOP, and other useful components.")
311 ;; Note that the file "Copyright" points to some files and directories
312 ;; which aren't under the lgpl2.1+ and instead contain many different,
313 ;; non-copyleft licenses.
314 ;; See https://common-lisp.net/project/ecl/posts/ECL-license.html.
315 (license license:lgpl2.1+)))
325 (url "https://gitlab.com/gnu-clisp/clisp")
326 (commit "clisp-2.49.92-2018-02-18")))
327 (file-name (git-file-name name version))
329 (base32 "0k2dmgl0miz3767iks4p0mvp6xw0ysyxhjpklyh11j010rmh6hqb"))))
330 (build-system gnu-build-system)
332 `(("cl-asdf" ,cl-asdf)))
333 (inputs `(("libffcall" ,libffcall)
335 ("readline" ,readline)
336 ("libsigsegv" ,libsigsegv)))
338 `(#:configure-flags '(,@(if (string-prefix? "armhf-linux"
339 (or (%current-system)
340 (%current-target-system)))
341 '("CFLAGS=-falign-functions=4")
344 "--with-dynamic-modules"
349 "--with-module=rawsock")
351 (modify-phases %standard-phases
352 (add-after 'unpack 'patch-sh-and-pwd
354 ;; The package is very messy with its references to "/bin/sh" and
355 ;; some other absolute paths to traditional tools. These appear in
356 ;; many places where our automatic patching misses them. Therefore
357 ;; we do the following, in this early (post-unpack) phase, to solve
358 ;; the problem from its root.
359 (substitute* '("src/clisp-link.in"
362 (("/bin/sh") (which "sh")))
363 (substitute* (find-files "." "configure|Makefile")
365 (substitute* '("src/clisp-link.in")
366 (("/bin/pwd") "pwd"))
368 (add-after 'unpack 'replace-asdf
369 ;; Use system ASDF instead of bundled one.
370 (lambda* (#:key inputs #:allow-other-keys)
371 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
372 (guix-asdf (string-append
374 "/share/common-lisp/source/asdf/asdf.lisp"))
375 (contrib-asdf "modules/asdf/asdf.lisp"))
376 (delete-file contrib-asdf)
377 (copy-file guix-asdf contrib-asdf)))))))
379 (list (search-path-specification
380 (variable "XDG_DATA_DIRS")
382 (search-path-specification
383 (variable "XDG_CONFIG_DIRS")
385 (home-page "https://clisp.sourceforge.io/")
386 (synopsis "A Common Lisp implementation")
388 "GNU CLISP is an implementation of ANSI Common Lisp. Common Lisp is a
389 high-level, object-oriented functional programming language. CLISP includes
390 an interpreter, a compiler, a debugger, and much more.")
391 (license license:gpl2+)))
400 (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-"
401 version "-source.tar.bz2"))
403 (base32 "07cpswxh2f38b440xdn3fjk7b4r0ipj3sbwb3jd134phrr9smll7"))))
404 (build-system gnu-build-system)
405 (outputs '("out" "doc"))
408 ;; Supported build hosts are:
411 ;; CCL (formerly known as OpenMCL)
412 ;; ABCL (recent versions only)
413 ;; CLISP (only some versions: 2.44.1 is OK, 2.47 is not)
417 ;; * build enhancement: new host quirks mechanism, support for building under
418 ;; ABCL and ECL (as well as CCL, CMUCL, CLISP and SBCL itself)
420 ;; CCL is not bootstrappable so it won't do. CLISP 2.49 seems to work.
421 ;; ECL too. As of 2020-07-01, ECL was last updated in 2020 while CLISP
422 ;; was last updated in 2010, and both take about the same time to build SBCL.
424 ;; For now we stick to CLISP for all systems. We keep the `match' here
425 ;; to make it easier to change the host compiler for various
426 ;; architectures. Consider switching to ECL if it gets faster than CLISP
427 ;; (maybe post 2020 release).
428 `(,@(match (%current-system)
429 ((or "x86_64-linux" "i686-linux")
432 `(("clisp" ,clisp))))
435 ("inetutils" ,inetutils) ;for hostname(1)
437 ("texlive" ,(texlive-union (list texlive-tex-texinfo)))
441 `(#:modules ((guix build gnu-build-system)
445 (modify-phases %standard-phases
447 (add-after 'unpack 'replace-asdf
448 ;; SBCL developers have not committed to keeping ASDF up to date
449 ;; due to breaking changes [1]. Guix can handle this situation
450 ;; easily, and it behooves us to have more control over what version
451 ;; of ASDF we use to build software; therefore, replace the contrib
452 ;; ASDF with the version packaged into Guix.
453 ;; [1] - https://bugs.launchpad.net/sbcl/+bug/1823442
454 (lambda* (#:key inputs #:allow-other-keys)
455 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
456 (guix-asdf (string-append
458 "/share/common-lisp/source/asdf/asdf.lisp"))
459 (contrib-asdf "contrib/asdf/asdf.lisp"))
460 (copy-file guix-asdf contrib-asdf))
462 (add-before 'build 'patch-unix-tool-paths
463 (lambda* (#:key outputs inputs #:allow-other-keys)
464 (let ((out (assoc-ref outputs "out"))
465 (bash (assoc-ref inputs "bash"))
466 (coreutils (assoc-ref inputs "coreutils"))
467 (ed (assoc-ref inputs "ed")))
468 (define (quoted-path input path)
469 (string-append "\"" input path "\""))
470 ;; Patch absolute paths in string literals. Note that this
471 ;; occurs in some .sh files too (which contain Lisp code). Use
472 ;; ISO-8859-1 because some of the files are ISO-8859-1 encoded.
473 (with-fluids ((%default-port-encoding #f))
474 ;; The removed file is utf-16-be encoded, which gives substitute*
475 ;; trouble. It does not contain references to the listed programs.
477 "./tests/data/compile-file-pos-utf16be.lisp"
478 (find-files "." "\\.(lisp|sh)$"))
479 (("\"/bin/sh\"") (quoted-path bash "/bin/sh"))
480 (("\"/usr/bin/env\"") (quoted-path coreutils "/usr/bin/env"))
481 (("\"/bin/cat\"") (quoted-path coreutils "/bin/cat"))
482 (("\"/bin/ed\"") (quoted-path ed "/bin/ed"))
483 (("\"/bin/echo\"") (quoted-path coreutils "/bin/echo"))
484 (("\"/bin/uname\"") (quoted-path coreutils "/bin/uname"))))
485 ;; This one script has a non-string occurrence of /bin/sh.
486 (substitute* '("tests/foreign.test.sh")
487 ;; Leave whitespace so we don't match the shebang.
488 ((" /bin/sh ") " sh "))
489 ;; This file contains a module that can create executable files
490 ;; which depend on the presence of SBCL. It generates shell
491 ;; scripts doing "exec sbcl ..." to achieve this. We patch both
492 ;; the shebang and the reference to "sbcl", tying the generated
493 ;; executables to the exact SBCL package that generated them.
494 (substitute* '("contrib/sb-executable/sb-executable.lisp")
495 (("/bin/sh") (string-append bash "/bin/sh"))
496 (("exec sbcl") (string-append "exec " out "/bin/sbcl")))
497 ;; Disable some tests that fail in our build environment.
498 (substitute* '("contrib/sb-bsd-sockets/tests.lisp")
499 ;; This requires /etc/protocols.
500 (("\\(deftest get-protocol-by-name/error" all)
501 (string-append "#+nil ;disabled by Guix\n" all)))
502 (substitute* '("contrib/sb-posix/posix-tests.lisp")
503 ;; These assume some users/groups which we don't have.
504 (("\\(deftest pwent\\.[12]" all)
505 (string-append "#+nil ;disabled by Guix\n" all))
506 (("\\(deftest grent\\.[12]" all)
507 (string-append "#+nil ;disabled by Guix\n" all))))
509 ;; FIXME: the texlive-union insists on regenerating fonts. It stores
510 ;; them in HOME, so it needs to be writeable.
511 (add-before 'build 'set-HOME
512 (lambda _ (setenv "HOME" "/tmp") #t))
514 (lambda* (#:key outputs #:allow-other-keys)
516 (invoke "sh" "make.sh" ,@(match (%current-system)
517 ((or "x86_64-linux" "i686-linux")
521 (string-append "--prefix="
522 (assoc-ref outputs "out"))
523 "--dynamic-space-size=3072"
524 "--with-sb-core-compression"
525 "--with-sb-xref-for-internals")))
528 (invoke "sh" "install.sh")))
529 (add-after 'build 'build-doc
531 ;; TODO: Doc is not deterministic, maybe there is a timespamp?
532 (with-directory-excursion "doc/manual"
533 (and (invoke "make" "info")
534 (invoke "make" "dist")))))
535 (add-after 'build 'build-source
536 (lambda* (#:key outputs #:allow-other-keys)
537 (let* ((out (assoc-ref outputs "out"))
538 (rc (string-append out "/lib/sbcl/sbclrc"))
539 (source-dir (string-append out "/share/sbcl")))
540 (for-each (lambda (p)
541 (copy-recursively p (string-append source-dir "/" p)))
543 (mkdir-p (dirname rc))
544 (with-output-to-file rc
547 (string-append "(sb-ext:set-sbcl-source-location \""
548 source-dir "\")") )))
550 (add-after 'install 'install-doc
551 (lambda* (#:key outputs #:allow-other-keys)
552 (let* ((out (assoc-ref outputs "out"))
553 (doc (assoc-ref outputs "doc"))
554 (old-doc-dir (string-append out "/share/doc"))
555 (new-doc/sbcl-dir (string-append doc "/share/doc/sbcl")))
556 (rmdir (string-append old-doc-dir "/sbcl/html"))
557 (mkdir-p new-doc/sbcl-dir)
558 (copy-recursively (string-append old-doc-dir "/sbcl")
560 (delete-file-recursively old-doc-dir)
562 ;; No 'check' target, though "make.sh" (build phase) runs tests.
565 (list (search-path-specification
566 (variable "XDG_DATA_DIRS")
568 (search-path-specification
569 (variable "XDG_CONFIG_DIRS")
571 (home-page "http://www.sbcl.org/")
572 (synopsis "Common Lisp implementation")
573 (description "Steel Bank Common Lisp (SBCL) is a high performance Common
574 Lisp compiler. In addition to the compiler and runtime system for ANSI Common
575 Lisp, it provides an interactive environment including a debugger, a
576 statistical profiler, a code coverage tool, and many other extensions.")
577 ;; Public domain in jurisdictions that allow it, bsd-2 otherwise. MIT
578 ;; loop macro has its own license. See COPYING file for further notes.
579 (license (list license:public-domain license:bsd-2
580 (license:x11-style "file://src/code/loop.lisp")))))
583 ;; Warning: according to upstream, CCL is not bootstrappable.
584 ;; See https://github.com/Clozure/ccl/issues/222 from 2019-09-02:
586 ;; "As far as I know, there is no way to build CCL without an existing
587 ;; running CCL image. It was bootstrapped back in 1986 or so as
588 ;; Macintosh Common Lisp, by Gary Byers, I believe, who is no longer on
589 ;; the planet to tell us the story. It SHOULD be possible to port the
590 ;; CCL compiler to portable Common Lisp, so that ANY lisp could build
591 ;; it, as is the case for SBCL, but I know of no attempt to do so."
598 (url "https://github.com/Clozure/ccl/")
599 (commit (string-append "v" version))))
600 (file-name (git-file-name "ccl" version))
603 "0kxr24d2fzsmpsilijpwwfl6g89y7fcrwb80kai5nx9pwgxmjbp3"))))
604 (build-system gnu-build-system)
605 ;; CCL consists of a "lisp kernel" and "heap image", both of which are
606 ;; shipped in precompiled form in source tarballs. The former is a C
607 ;; program which we can rebuild from scratch, but the latter cannot be
608 ;; generated without an already working copy of CCL, and is platform
609 ;; dependent, so we need to fetch the correct tarball for the platform.
615 "https://github.com/Clozure/ccl/releases/download/v" version "/"
616 (match (%current-system)
617 ("armhf-linux" "linuxarm")
618 ;; XXX: This source only works on x86, but provide it as a
619 ;; catch-all to prevent errors when querying this package
620 ;; on unsupported platforms.
625 (match (%current-system)
627 "0x4bjx6cxsjvxyagijhlvmc7jkyxifdvz5q5zvz37028va65243c")
628 (_ "15l7cfa4a7jkfwdzsfm4q3n22jnb57imxahpql3h77xin57v1gbz"))))))))
630 `(("cl-asdf" ,cl-asdf)
633 `(#:tests? #f ;no 'check' target
634 #:modules ((ice-9 match)
637 (guix build gnu-build-system))
639 (modify-phases %standard-phases
640 (add-after 'unpack 'unpack-image
641 (lambda* (#:key inputs #:allow-other-keys)
642 (invoke "tar" "xzvf" (assoc-ref inputs "ccl-bootstrap"))))
643 (add-after 'unpack 'replace-asdf
644 ;; Use system ASDF instead of bundled one.
645 (lambda* (#:key inputs #:allow-other-keys)
646 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
647 (guix-asdf (string-append
649 "/share/common-lisp/source/asdf/asdf.lisp"))
650 (contrib-asdf "tools/asdf.lisp"))
651 (delete-file contrib-asdf)
652 (copy-file guix-asdf contrib-asdf))))
654 (add-before 'build 'pre-build
655 ;; Enter the source directory for the current platform's lisp
656 ;; kernel, and run 'make clean' to remove the precompiled one.
657 (lambda* (#:key system #:allow-other-keys)
658 (substitute* "lisp-kernel/m4macros.m4"
659 (("/bin/pwd") (which "pwd")))
660 (chdir (string-append
663 ("i686-linux" "linuxx8632")
664 ("x86_64-linux" "linuxx8664")
665 ("armhf-linux" "linuxarm")
666 (_ (string-append "unknown system: " system)))))
667 (substitute* '("Makefile")
670 (invoke "make" "clean")))
671 ;; XXX Do we need to recompile the heap image as well for Guix?
672 ;; For now just use the one we already got in the tarball.
674 (lambda* (#:key outputs inputs system #:allow-other-keys)
675 ;; The lisp kernel built by running 'make' in lisp-kernel/$system
676 ;; is put back into the original directory, so go back. The heap
677 ;; image is there as well.
679 (let* ((out (assoc-ref outputs "out"))
680 (libdir (string-append out "/lib/"))
681 (bindir (string-append out "/bin/"))
682 (wrapper (string-append bindir "ccl"))
683 (bash (assoc-ref inputs "bash"))
686 ("i686-linux" "lx86cl")
687 ("x86_64-linux" "lx86cl64")
688 ("armhf-linux" "armcl")
689 ;; Unlikely to work, but try it anyway...
691 (heap (string-append kernel ".image")))
692 (install-file kernel libdir)
693 (install-file heap libdir)
695 (let ((dirs `("lib" "library" "examples" "tools" "objc-bridge"
702 (for-each copy-recursively
704 (map (cut string-append libdir <>) dirs)))
707 (with-output-to-file wrapper
711 "#!" bash "/bin/sh\n"
712 "export CCL_DEFAULT_DIRECTORY=" libdir "\n"
713 "exec -a \"$0\" " libdir kernel " \"$@\"\n"))))
714 (chmod wrapper #o755))
717 (list (search-path-specification
718 (variable "XDG_DATA_DIRS")
720 (search-path-specification
721 (variable "XDG_CONFIG_DIRS")
723 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
724 (home-page "https://ccl.clozure.com/")
725 (synopsis "Common Lisp implementation")
726 (description "Clozure CL (often called CCL for short) is a Common Lisp
727 implementation featuring fast compilation speed, native threads, a precise,
728 generational, compacting garbage collector, and a convenient foreign-function
730 (license license:asl2.0)))
739 (uri (string-append "mirror://sourceforge/lush/lush2/lush-"
741 (modules '((guix build utils)))
744 (substitute* "src/unix.c"
745 (("\\{ \"LUSH_DATE\", __DATE__ \\},") "")
746 (("\\{ \"LUSH_TIME\", __TIME__ \\},") ""))
747 (substitute* "src/main.c"
748 (("\" \\(built \" __DATE__ \"\\)\"") ""))
752 "02pkfn3nqdkm9fm44911dbcz0v3r0l53vygj8xigl6id5g3iwi4k"))))
753 (build-system gnu-build-system)
755 `(;; We have to add these LIBS so that they are found.
756 #:configure-flags (list "LIBS=-lz"
757 "X_EXTRA_LIBS=-lfontconfig"
759 #:tests? #f)) ; No make check.
760 (native-inputs `(("intltool" ,intltool)))
762 `(("alsa-lib" ,alsa-lib)
764 ("sdl-image" ,sdl-image)
765 ("sdl-mixer" ,sdl-mixer)
770 ("fontconfig" ,fontconfig)
772 ("openblas" ,openblas)
775 ("mesa-utils" ,mesa-utils)
776 ("binutils" ,binutils)
777 ("libiberty" ,libiberty)
778 ("readline" ,readline)
780 ("gettext-minimal" ,gettext-minimal)))
781 (synopsis "Lisp Universal Shell")
783 "Lush is an object-oriented Lisp interpreter/compiler with features
784 designed to please people who want to prototype large numerical
785 applications. Lush includes an extensive library of
786 vector/matrix/tensor manipulation, numerous numerical libraries
787 (including GSL, LAPACK, and BLAS), a set of graphic functions, a
788 simple GUI toolkit, and interfaces to various graphic and multimedia
789 libraries such as OpenGL, SDL, Video4Linux, and ALSA (video/audio
790 grabbing), and others. Lush is an ideal frontend script language for
791 programming projects written in C or other languages. Lush also has
792 libraries for Machine Learning, Neural Nets and statistical estimation.")
793 (home-page "http://lush.sourceforge.net/")
794 (license license:lgpl2.1+)))
796 (define-public confusion-mdl
797 (let* ((commit "12a055581fc262225272df43287dae48281900f5"))
799 (name "confusion-mdl")
804 (url (string-append "https://gitlab.com/emacsomancer/" name))
808 "1zi8kflzvwqg97ha1sa5xjisbjs5z1mvbpa772vfxiv5ksnpxp0d"))
809 (file-name (git-file-name name version))))
810 (build-system gnu-build-system)
812 `(#:tests? #f ; there are no tests
814 (modify-phases %standard-phases
817 (lambda* (#:key (make-flags '()) #:allow-other-keys)
818 (apply invoke "make" "CC=gcc" make-flags)))
820 (lambda* (#:key outputs #:allow-other-keys)
821 (let* ((out (assoc-ref outputs "out"))
822 (bin (string-append out "/bin")))
823 (install-file "mdli" bin)
829 (synopsis "Interpreter for the MIT Design Language (MDL)")
830 (description "MDL (the MIT Design Language) is a descendant of Lisp. It
831 was originally developed in 1971 on the PDP-10 computer under the Incompatible
832 Timesharing System (ITS) to provide high level language support for the
833 Dynamic Modeling Group at MIT's Project MAC. Infocom built the original
834 PDP-10 Zork in MDL and their later ZIL (Zork Implementation Language) was
835 based on a subset of MDL. Confusion is a MDL interpreter that works just well
836 enough to play the original mainframe Zork all the way through.")
837 (home-page "http://www.russotto.net/git/mrussotto/confusion/src/master/src/README")
838 (license license:gpl3+))))
848 (url "http://www.kylheku.com/git/txr/")
849 (commit (string-append "txr-" version))))
850 (file-name (git-file-name name version))
852 (base32 "1pnajvqhzjlw0rwwhhk4hyps5pbg9njh10iqhnmvl1xnah6ff94z"))))
853 (build-system gnu-build-system)
856 (list ,(string-append "cc=" (cc-for-target))
857 (string-append "--prefix=" (assoc-ref %outputs "out")))
858 #:test-target "tests"
860 (modify-phases %standard-phases
862 ;; ./configure is a hand-written script that can't handle standard
863 ;; autotools arguments like CONFIG_SHELL.
864 (lambda* (#:key configure-flags #:allow-other-keys)
865 (setenv "txr_shell" (which "bash"))
866 (apply invoke "./configure" configure-flags)
868 (add-after 'configure 'fix-tests
870 (substitute* (list "tests/017/realpath.tl"
871 "tests/017/realpath.expected")
875 `(("libffi" ,libffi)))
876 (synopsis "General-purpose, multi-paradigm programming language")
878 "TXR is a general-purpose, multi-paradigm programming language. It
879 comprises two languages integrated into a single tool: a text scanning and
880 extraction language referred to as the TXR Pattern Language (sometimes just
881 \"TXR\"), and a general-purpose dialect of Lisp called TXR Lisp. TXR can be
882 used for everything from \"one liner\" data transformation tasks at the
883 command line, to data scanning and extracting scripts, to full application
884 development in a wide-range of areas.")
885 (home-page "https://nongnu.org/txr/")
886 (license license:bsd-2)))
895 (uri (string-append "https://software-lab.de/picoLisp-" version ".tgz"))
897 (base32 "10np0mhihr47r3201617zccrvzpkhdl1jwvz7zimk8kxpriydq2j"))
898 (modules '((guix build utils)))
900 ;; Delete the pre-compiled jar file.
901 (delete-file "ersatz/picolisp.jar")
903 (build-system gnu-build-system)
905 `(("openssl" ,openssl)))
907 `(#:system ,(match (%current-system)
908 ((or "armhf-linux" "aarch64-linux")
913 (modify-phases %standard-phases
915 (add-after 'unpack 'fix-paths
916 (lambda* (#:key outputs #:allow-other-keys)
917 (let* ((out (assoc-ref outputs "out"))
918 (shebang-line (string-append
919 "#!" out "/bin/picolisp "
920 out "/lib/picolisp/lib.l")))
921 (substitute* '("bin/pil"
934 (("#\\!bin/picolisp lib.l")
936 (("#\\!\\.\\./bin/picolisp \\.\\./lib.l")
938 (("#\\!/usr/bin/picolisp /usr/lib/picolisp/lib.l")
941 (add-after 'fix-paths 'make-build-reproducible
943 (substitute* "src64/lib/asm.l"
944 (("\\(prinl \"/\\* \" \\(datSym \\(date\\)\\) \" \\*/\\)")
947 (add-after 'make-build-reproducible 'fix-permissions
949 (for-each make-file-writable
957 (invoke "make" "-C" "src" "picolisp" "tools" "gate")))
958 (add-before 'check 'set-home-for-tests
960 (setenv "HOME" "/tmp")
964 (invoke "./pil" "test/lib.l" "-bye" "+")))
966 (lambda* (#:key outputs #:allow-other-keys)
967 (let* ((out (assoc-ref outputs "out"))
968 (bin (string-append out "/bin"))
969 (man (string-append out "/share/man"))
970 (picolisp (string-append out "/lib/picolisp")))
971 (copy-recursively "man" man)
972 (copy-recursively "." picolisp)
973 (for-each (lambda (name)
974 (let ((path (string-append picolisp "/" name)))
975 (delete-file-recursively path)))
976 '("CHANGES" "COPYING" "CREDITS" "cygwin"
977 "INSTALL" "man" "pil" "README" "src" "src64"
980 (symlink (string-append picolisp "/bin/picolisp")
981 (string-append bin "/picolisp"))
982 (symlink (string-append picolisp "/bin/pil")
983 (string-append bin "/pil")))
985 (synopsis "Interpreter for the PicoLisp programming language")
987 "PicoLisp is a programming language, or really a programming system,
988 including a built-in database engine and a GUI system.")
989 (home-page "https://picolisp.com/wiki/?home")
990 (license license:expat)))
992 (define-public picolisp
993 (match (%current-system)
994 ((or "aarch64-linux" "x86_64-linux")
996 ;; Use the 32-bit picolisp to generate the assembly files required by
997 ;; the 64-bit picolisp.
1001 `(("picolisp32" ,picolisp32)
1004 (substitute-keyword-arguments (package-arguments picolisp32)
1005 ((#:system _ "") (%current-system))
1007 `(modify-phases ,phases
1009 (add-before 'build 'fix-paths
1010 ;; This must run after the other shebang-patching phases,
1011 ;; or they will override our changes.
1012 (lambda* (#:key inputs outputs #:allow-other-keys)
1013 (let* ((picolisp32 (assoc-ref inputs "picolisp32"))
1014 (out (assoc-ref outputs "out"))
1015 (shebang-line (string-append
1016 "#!" out "/bin/picolisp "
1017 out "/lib/picolisp/lib.l")))
1018 (substitute* '("bin/pil"
1031 (("#\\!.*picolisp32.*/bin/picolisp .*lib\\.l")
1033 (substitute* "src64/mkAsm"
1035 (string-append picolisp32 "/bin/"))))
1039 (invoke "make" "-C" "src" "tools" "gate")
1040 (invoke "make" "-C" "src64" "CC=gcc" "picolisp")))))))))
1043 (inherit picolisp32)
1044 (name "picolisp")))))
1046 (define-public janet
1054 (url "https://github.com/janet-lang/janet")
1055 (commit (string-append "v" version))))
1056 (file-name (git-file-name name version))
1058 (base32 "0if514zdmbjvvrsa9x5yfvg2b14sz53yaka12g3yhwkq8ls3qk0c"))))
1059 (build-system gnu-build-system)
1061 `(#:make-flags (list
1062 (string-append "DESTDIR=" (assoc-ref %outputs "out"))
1063 (string-append "PREFIX=")
1064 (string-append "CC=" (assoc-ref %build-inputs "gcc")
1067 (modify-phases %standard-phases
1071 (invoke "make" "test"))))))
1072 (home-page "https://janet-lang.org/")
1073 (synopsis "Functional, imperative and embeddable programming language")
1075 "Janet is a functional and imperative programming language. It can be
1076 used for rapid prototyping, dynamic systems, and other domains where dynamic
1077 languages shine. You can also add Janet scripting to an application by
1078 embedding a single C file and two headers. It can be easily ported to new
1079 platforms. The entire language (core library, interpreter, compiler,
1080 assembler, PEG) is less than 1MB.")
1081 (license license:expat)))
1083 (define-public lisp-repl-core-dumper
1085 (name "lisp-repl-core-dumper")
1091 (url "https://gitlab.com/ambrevar/lisp-repl-core-dumper.git")
1093 (file-name (git-file-name name version))
1095 (base32 "1w7x7d7bnrdj0bd04vnjy7d7sngvcx1yjr4iw429hdd9lzlg8rbg"))))
1096 (build-system copy-build-system)
1099 '(("lisp-repl-core-dumper" "bin/"))
1101 (modify-phases %standard-phases
1102 (add-before 'install 'fix-utils-path
1103 (lambda* (#:key inputs #:allow-other-keys)
1104 (let* ((coreutils (string-append (assoc-ref inputs "coreutils") "/bin/"))
1105 (paste (string-append coreutils "paste"))
1106 (sort (string-append coreutils "sort"))
1107 (basename (string-append coreutils "basename"))
1108 (sed (string-append (assoc-ref inputs "sed") "/bin/sed")))
1109 (substitute* "lisp-repl-core-dumper"
1110 (("\\$\\(basename") (string-append "$(" basename))
1111 (("\\<paste\\>") paste)
1113 (("\\<sort\\>") sort))))))))
1115 `(("coreutils" ,coreutils-minimal)
1117 (home-page "https://gitlab.com/ambrevar/lisp-repl-core-dumper")
1118 (synopsis "Generate REPL-optimized Lisp cores on demand")
1120 "This tool generates Lisp images that can embed the provided systems
1121 and make for REPLs that start blazing fast.
1124 @item It’s portable and should work with any compiler.
1125 @item It works for any REPL.
1126 @item It allows you to include arbitrary libraries.
1128 (license license:gpl3+)))