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, 2020 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
10 ;;; Copyright © 2017, 2019–2021 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, 2021 Guillaume Le Vaillant <glv@posteo.net>
18 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
19 ;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
20 ;;; Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
21 ;;; Copyright © 2021 Paul A. Patience <paul@apatience.com>
23 ;;; This file is part of GNU Guix.
25 ;;; GNU Guix is free software; you can redistribute it and/or modify it
26 ;;; under the terms of the GNU General Public License as published by
27 ;;; the Free Software Foundation; either version 3 of the License, or (at
28 ;;; your option) any later version.
30 ;;; GNU Guix is distributed in the hope that it will be useful, but
31 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
32 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 ;;; GNU General Public License for more details.
35 ;;; You should have received a copy of the GNU General Public License
36 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
38 ;;; This file only contains Common Lisp compilers and tooling.
39 ;;; Common Lisp libraries go to lisp-xyz.scm.
40 ;;; Common Lisp applications should go to the most appropriate file,
41 ;;; e.g. StumpWM is in wm.scm.
43 (define-module (gnu packages lisp)
44 #:use-module (gnu packages)
45 #:use-module ((guix licenses) #:prefix license:)
46 #:use-module (guix packages)
47 #:use-module (guix download)
48 #:use-module (guix git-download)
49 #:use-module (guix gexp)
50 #:use-module (guix utils)
51 #:use-module (guix build-system copy)
52 #:use-module (guix build-system gnu)
53 #:use-module (guix build-system ant)
54 #:use-module (guix build-system asdf)
55 #:use-module (guix build-system trivial)
56 #:use-module (gnu packages admin)
57 #:use-module (gnu packages base)
58 #:use-module (gnu packages bash)
59 #:use-module (gnu packages bdw-gc)
60 #:use-module (gnu packages compression)
61 #:use-module (gnu packages ed)
62 #:use-module (gnu packages fontutils)
63 #:use-module (gnu packages gcc)
64 #:use-module (gnu packages gettext)
65 #:use-module (gnu packages ghostscript)
66 #:use-module (gnu packages gl)
67 #:use-module (gnu packages glib)
68 #:use-module (gnu packages groff)
69 #:use-module (gnu packages libffcall)
70 #:use-module (gnu packages libffi)
71 #:use-module (gnu packages libsigsegv)
72 #:use-module (gnu packages linux)
73 #:use-module (gnu packages m4)
74 #:use-module (gnu packages maths)
75 #:use-module (gnu packages multiprecision)
76 #:use-module (gnu packages ncurses)
77 #:use-module (gnu packages onc-rpc)
78 #:use-module (gnu packages perl)
79 #:use-module (gnu packages readline)
80 #:use-module (gnu packages sdl)
81 #:use-module (gnu packages tex)
82 #:use-module (gnu packages texinfo)
83 #:use-module (gnu packages tls)
84 #:use-module (gnu packages version-control)
85 #:use-module (gnu packages xorg)
86 #:use-module (ice-9 match))
88 (define-public cl-asdf
96 (string-append "https://common-lisp.net/project/asdf/archives/asdf-"
99 (base32 "1mydyrii3f0aig1q5admj6hyf59vjn4a5x1q8hqgh483987ilz6h"))))
100 (build-system trivial-build-system)
102 `(("config-patch" ,@(search-patches "cl-asdf-config-directories.patch"))
105 `(#:modules ((guix build utils)
106 (guix build lisp-utils))
109 (use-modules (guix build utils)
110 (guix build lisp-utils))
111 (let* ((out (string-append (assoc-ref %outputs "out")))
112 (asdf-install (string-append out %source-install-prefix
114 (src-asdf (string-append (assoc-ref %build-inputs "source")))
115 (dst-asdf (string-append asdf-install "asdf.lisp"))
116 (patch (string-append (assoc-ref %build-inputs "patch")
118 (config-patch (assoc-ref %build-inputs "config-patch")))
119 (mkdir-p asdf-install)
120 (copy-file src-asdf dst-asdf)
121 (invoke patch "-p1" "-i" config-patch dst-asdf)))))
122 (home-page "https://common-lisp.net/project/asdf/")
123 (synopsis "Another System Definition Facility")
125 "ASDF is what Common Lisp hackers use to build and load software. It is
126 the successor of the Lisp DEFSYSTEM of yore. ASDF stands for Another System
127 Definition Facility.")
129 (license license:expat)))
132 (let ((commit "ff7ef981765cc0efdb4b1db27c292f5c11a72753")
133 (revision "3")) ;Guix package revision
136 (version (git-version "2.6.12" revision commit))
141 (url "https://git.savannah.gnu.org/r/gcl.git")
143 (file-name (git-file-name name version))
145 (base32 "0z64fxxcaial2i1s1hms8r095dm1ff3wd8ivwdx894a3yln9c0an"))))
146 (build-system gnu-build-system)
148 `(#:parallel-build? #f ; The build system seems not to be thread safe.
149 #:test-target "ansi-tests/test_results"
150 #:configure-flags ,#~(list
151 "--enable-ansi" ; required by the maxima package
152 (string-append "CFLAGS=-I"
153 #$(this-package-input "libtirpc")
155 (string-append "LDFLAGS=-L"
156 #$(this-package-input "libtirpc")
159 #:make-flags ,#~(list
160 (string-append "GCL_CC=" #$gcc "/bin/gcc")
161 (string-append "CC="#$gcc "/bin/gcc"))
163 (modify-phases %standard-phases
164 (add-after 'unpack 'realpath-workaround
165 ;; Calls to the realpath function can set errno even if the return
166 ;; value of the function indicates that there is no error, which
167 ;; make massert consider that there was an error.
169 (substitute* "gcl/o/main.c"
170 (("massert\\(realpath\\(s,o\\)\\);" all)
171 "massert((realpath(s, o) != NULL) && ((errno = 0) == 0));"))))
172 (add-after 'unpack 'fix-makefile
173 ;; The "final" target doesn't exist.
175 (substitute* "gcl/makefile"
176 (("\\$\\(MAKE\\) -C \\$\\(PORTDIR\\) final")
177 "$(MAKE) -C $(PORTDIR)"))))
178 (add-before 'configure 'pre-conf
179 (lambda* (#:key inputs #:allow-other-keys)
183 '("pcl/impl/kcl/makefile.akcl"
185 "unixport/makefile.dos"
187 "gcl-tk/makefile.prev"
189 (find-files "h" "\\.defs"))
191 (string-append "SHELL=" (which "bash")))
193 (string-append "SHELL=" (which "sh"))))
194 (substitute* "h/linux.defs"
196 (("-fwritable-strings") "")
198 (substitute* "lsp/gcl_top.lsp"
200 (string-append "\"" (assoc-ref %build-inputs "gcc")
202 (("\\(or \\(get-path \\*cc\\*\\) \\*cc\\*\\)") "*cc*")
204 (string-append "\"" (assoc-ref %build-inputs "binutils")
206 (("\\(or \\(get-path \\*ld\\*\\) \\*ld\\*\\)") "*ld*")
207 (("\\(get-path \"objdump --source \"\\)")
208 (string-append "\"" (assoc-ref %build-inputs "binutils")
209 "/bin/objdump --source \"")))
211 (add-after 'install 'wrap
212 (lambda* (#:key inputs outputs #:allow-other-keys)
213 (let* ((gcl (assoc-ref outputs "out"))
214 (input-path (lambda (lib path)
216 (assoc-ref inputs lib) path)))
217 (binaries '("binutils")))
218 ;; GCC and the GNU binutils are necessary for GCL to be
219 ;; able to compile Lisp functions and programs (this is
220 ;; a standard feature in Common Lisp). While the
221 ;; the location of GCC is specified in the make-flags,
222 ;; the GNU binutils must be available in GCL's $PATH.
223 (wrap-program (string-append gcl "/bin/gcl")
224 `("PATH" prefix ,(map (lambda (binary)
225 (input-path binary "/bin"))
228 ;; drop strip phase to make maxima build, see
229 ;; https://www.ma.utexas.edu/pipermail/maxima/2008/009769.html
232 `(("bash-minimal" ,bash-minimal)
234 ("libtirpc" ,libtirpc)
235 ("readline" ,readline)))
238 ("texinfo" ,texinfo)))
239 (home-page "https://www.gnu.org/software/gcl/")
240 (synopsis "A Common Lisp implementation")
241 (description "GCL is an implementation of the Common Lisp language. It
242 features the ability to compile to native object code and to load native
243 object code modules directly into its lisp core. It also features a
244 stratified garbage collection strategy, a source-level debugger and a built-in
245 interface to the Tk widget system.")
246 (license license:lgpl2.0+))))
256 "https://common-lisp.net/project/ecl/static/files/release/"
257 name "-" version ".tgz"))
259 (base32 "000906nnq25177bgsfndiw3iqqgrjc9spk10hzk653sbz3f7anmi"))))
260 (build-system gnu-build-system)
261 ;; src/configure uses 'which' to confirm the existence of 'gzip'.
263 `(("cl-asdf" ,cl-asdf)
265 ("texinfo" ,texinfo)))
266 ;; When ECL is embedded in a program that wants to use Common Lisp as an
267 ;; extension language, libgmp, libatomic-ops, libgc and libffi must be
268 ;; present when compiling the program because they are required by ECL's
270 ;; Therefore we put these libraries in 'propagated-inputs' instead
274 ("libatomic-ops" ,libatomic-ops)
278 `(#:configure-flags '("--without-rt")
279 ;; FIXME: As of version 20.4.24, we pass 17995 tests and fail 7.
280 ;; 2-3 tests may be due to FHS assumptions.
284 (modify-phases %standard-phases
286 (add-after 'unpack 'replace-asdf
287 ;; Use system ASDF instead of bundled one.
288 (lambda* (#:key inputs #:allow-other-keys)
289 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
290 (guix-asdf (string-append
292 "/share/common-lisp/source/asdf/asdf.lisp"))
293 (contrib-asdf "contrib/asdf/asdf.lisp"))
294 (copy-file guix-asdf contrib-asdf))
296 (add-after 'install 'remove-build-stamp
297 (lambda* (#:key outputs #:allow-other-keys)
298 (delete-file (string-append (assoc-ref outputs "out")
299 "/lib/ecl-" ,version "/build-stamp"))
301 (add-after 'remove-build-stamp 'wrap
302 (lambda* (#:key inputs outputs #:allow-other-keys)
303 (let* ((ecl (assoc-ref outputs "out"))
304 (input-path (lambda (lib path)
306 (assoc-ref inputs lib) path)))
307 (libraries '("gmp" "libatomic-ops" "libgc" "libffi" "libc"))
308 (binaries '("gcc" "ld-wrapper" "binutils"))
310 (map (lambda (lib) (input-path lib "/lib"))
313 (wrap-program (string-append ecl "/bin/ecl")
315 ,(map (lambda (binary)
316 (input-path binary "/bin"))
320 (input-path lib "/include"))
321 `("kernel-headers" ,@libraries)))
322 `("LIBRARY_PATH" suffix ,library-directories)
323 `("LD_LIBRARY_PATH" suffix ,library-directories))
325 (add-after 'wrap 'check (assoc-ref %standard-phases 'check))
326 (add-before 'check 'fix-path-to-ecl
328 (substitute* "build/tests/Makefile"
329 (("\\$\\{exec_prefix\\}/") ""))
332 (list (search-path-specification
333 (variable "XDG_DATA_DIRS")
335 (search-path-specification
336 (variable "XDG_CONFIG_DIRS")
338 (home-page "http://ecls.sourceforge.net/")
339 (synopsis "Embeddable Common Lisp")
340 (description "ECL is an implementation of the Common Lisp language as
341 defined by the ANSI X3J13 specification. Its most relevant features are: a
342 bytecode compiler and interpreter, being able to compile Common Lisp with any
343 C/C++ compiler, being able to build standalone executables and libraries, and
344 supporting ASDF, Sockets, Gray streams, MOP, and other useful components.")
345 ;; Note that the file "Copyright" points to some files and directories
346 ;; which aren't under the lgpl2.1+ and instead contain many different,
347 ;; non-copyleft licenses.
348 ;; See https://common-lisp.net/project/ecl/posts/ECL-license.html.
349 (license license:lgpl2.1+)))
359 (url "https://gitlab.com/gnu-clisp/clisp")
360 (commit "clisp-2.49.92-2018-02-18")))
361 (file-name (git-file-name name version))
363 (base32 "0k2dmgl0miz3767iks4p0mvp6xw0ysyxhjpklyh11j010rmh6hqb"))))
364 (build-system gnu-build-system)
366 `(("cl-asdf" ,cl-asdf)))
367 (inputs `(("libffcall" ,libffcall)
369 ("readline" ,readline)
370 ("libsigsegv" ,libsigsegv)))
372 `(#:configure-flags '(,@(if (string-prefix? "armhf-linux"
373 (or (%current-system)
374 (%current-target-system)))
375 '("CFLAGS=-falign-functions=4")
378 "--with-dynamic-modules"
383 "--with-module=rawsock")
385 (modify-phases %standard-phases
386 (add-after 'unpack 'patch-sh-and-pwd
388 ;; The package is very messy with its references to "/bin/sh" and
389 ;; some other absolute paths to traditional tools. These appear in
390 ;; many places where our automatic patching misses them. Therefore
391 ;; we do the following, in this early (post-unpack) phase, to solve
392 ;; the problem from its root.
393 (substitute* '("src/clisp-link.in"
396 (("/bin/sh") (which "sh")))
397 (substitute* (find-files "." "configure|Makefile")
399 (substitute* '("src/clisp-link.in")
400 (("/bin/pwd") "pwd"))
402 (add-after 'unpack 'replace-asdf
403 ;; Use system ASDF instead of bundled one.
404 (lambda* (#:key inputs #:allow-other-keys)
405 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
406 (guix-asdf (string-append
408 "/share/common-lisp/source/asdf/asdf.lisp"))
409 (contrib-asdf "modules/asdf/asdf.lisp"))
410 (delete-file contrib-asdf)
411 (copy-file guix-asdf contrib-asdf)))))))
413 (list (search-path-specification
414 (variable "XDG_DATA_DIRS")
416 (search-path-specification
417 (variable "XDG_CONFIG_DIRS")
419 (home-page "https://clisp.sourceforge.io/")
420 (synopsis "A Common Lisp implementation")
422 "GNU CLISP is an implementation of ANSI Common Lisp. Common Lisp is a
423 high-level, object-oriented functional programming language. CLISP includes
424 an interpreter, a compiler, a debugger, and much more.")
425 (license license:gpl2+)))
434 (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-"
435 version "-source.tar.bz2"))
437 (base32 "1vydq6mmssla2vn0plpsrm50n3b42a464zxw72j6qihas9fhq8cb"))))
438 (build-system gnu-build-system)
439 (outputs '("out" "doc"))
442 ;; Supported build hosts are:
445 ;; CCL (formerly known as OpenMCL)
446 ;; ABCL (recent versions only)
447 ;; CLISP (only some versions: 2.44.1 is OK, 2.47 is not)
451 ;; * build enhancement: new host quirks mechanism, support for building under
452 ;; ABCL and ECL (as well as CCL, CMUCL, CLISP and SBCL itself)
454 ;; CCL is not bootstrappable so it won't do. CLISP 2.49 seems to work.
455 ;; ECL too. As of 2020-07-01, ECL was last updated in 2020 while CLISP
456 ;; was last updated in 2010, and both take about the same time to build SBCL.
458 ;; For now we stick to CLISP for all systems. We keep the `match' here
459 ;; to make it easier to change the host compiler for various
460 ;; architectures. Consider switching to ECL if it gets faster than CLISP
461 ;; (maybe post 2020 release).
462 `(,@(match (%current-system)
463 ((or "x86_64-linux" "i686-linux")
466 `(("clisp" ,clisp))))
469 ("inetutils" ,inetutils) ;for hostname(1)
471 ("texlive" ,(texlive-updmap.cfg (list texlive-tex-texinfo)))
475 `(#:modules ((guix build gnu-build-system)
479 (modify-phases %standard-phases
481 (add-after 'unpack 'replace-asdf
482 ;; SBCL developers have not committed to keeping ASDF up to date
483 ;; due to breaking changes [1]. Guix can handle this situation
484 ;; easily, and it behooves us to have more control over what version
485 ;; of ASDF we use to build software; therefore, replace the contrib
486 ;; ASDF with the version packaged into Guix.
487 ;; [1] - https://bugs.launchpad.net/sbcl/+bug/1823442
488 (lambda* (#:key inputs #:allow-other-keys)
489 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
490 (guix-asdf (string-append
492 "/share/common-lisp/source/asdf/asdf.lisp"))
493 (contrib-asdf "contrib/asdf/asdf.lisp"))
494 (copy-file guix-asdf contrib-asdf))
496 (add-before 'build 'patch-unix-tool-paths
497 (lambda* (#:key outputs inputs #:allow-other-keys)
498 (let ((out (assoc-ref outputs "out"))
499 (bash (assoc-ref inputs "bash"))
500 (coreutils (assoc-ref inputs "coreutils"))
501 (ed (assoc-ref inputs "ed")))
502 (define (quoted-path input path)
503 (string-append "\"" input path "\""))
504 ;; Patch absolute paths in string literals. Note that this
505 ;; occurs in some .sh files too (which contain Lisp code). Use
506 ;; ISO-8859-1 because some of the files are ISO-8859-1 encoded.
507 (with-fluids ((%default-port-encoding #f))
508 ;; The removed file is utf-16-be encoded, which gives substitute*
509 ;; trouble. It does not contain references to the listed programs.
511 "./tests/data/compile-file-pos-utf16be.lisp"
512 (find-files "." "\\.(lisp|sh)$"))
513 (("\"/bin/sh\"") (quoted-path bash "/bin/sh"))
514 (("\"/usr/bin/env\"") (quoted-path coreutils "/usr/bin/env"))
515 (("\"/bin/cat\"") (quoted-path coreutils "/bin/cat"))
516 (("\"/bin/ed\"") (quoted-path ed "/bin/ed"))
517 (("\"/bin/echo\"") (quoted-path coreutils "/bin/echo"))
518 (("\"/bin/uname\"") (quoted-path coreutils "/bin/uname"))))
519 ;; This one script has a non-string occurrence of /bin/sh.
520 (substitute* '("tests/foreign.test.sh")
521 ;; Leave whitespace so we don't match the shebang.
522 ((" /bin/sh ") " sh "))
523 ;; This file contains a module that can create executable files
524 ;; which depend on the presence of SBCL. It generates shell
525 ;; scripts doing "exec sbcl ..." to achieve this. We patch both
526 ;; the shebang and the reference to "sbcl", tying the generated
527 ;; executables to the exact SBCL package that generated them.
528 (substitute* '("contrib/sb-executable/sb-executable.lisp")
529 (("/bin/sh") (string-append bash "/bin/sh"))
530 (("exec sbcl") (string-append "exec " out "/bin/sbcl")))
531 ;; Disable some tests that fail in our build environment.
532 (substitute* '("contrib/sb-bsd-sockets/tests.lisp")
533 ;; This requires /etc/protocols.
534 (("\\(deftest get-protocol-by-name/error" all)
535 (string-append "#+nil ;disabled by Guix\n" all)))
536 (substitute* '("contrib/sb-posix/posix-tests.lisp")
537 ;; These assume some users/groups which we don't have.
538 (("\\(deftest pwent\\.[12]" all)
539 (string-append "#+nil ;disabled by Guix\n" all))
540 (("\\(deftest grent\\.[12]" all)
541 (string-append "#+nil ;disabled by Guix\n" all))))
544 (lambda* (#:key outputs #:allow-other-keys)
546 (invoke "sh" "make.sh" ,@(match (%current-system)
547 ((or "x86_64-linux" "i686-linux")
551 (string-append "--prefix="
552 (assoc-ref outputs "out"))
553 "--dynamic-space-size=3072"
554 "--with-sb-core-compression"
555 "--with-sb-xref-for-internals")))
558 (invoke "sh" "install.sh")))
559 (add-after 'build 'build-doc
561 ;; TODO: Doc is not deterministic, maybe there is a timespamp?
562 (with-directory-excursion "doc/manual"
563 (and (invoke "make" "info")
564 (invoke "make" "dist")))))
565 (add-after 'build 'build-source
566 (lambda* (#:key outputs #:allow-other-keys)
567 (let* ((out (assoc-ref outputs "out"))
568 (rc (string-append out "/lib/sbcl/sbclrc"))
569 (source-dir (string-append out "/share/sbcl")))
570 (for-each (lambda (p)
571 (copy-recursively p (string-append source-dir "/" p)))
573 (mkdir-p (dirname rc))
574 (with-output-to-file rc
577 (string-append "(sb-ext:set-sbcl-source-location \""
578 source-dir "\")") )))
580 (add-after 'install 'install-doc
581 (lambda* (#:key outputs #:allow-other-keys)
582 (let* ((out (assoc-ref outputs "out"))
583 (doc (assoc-ref outputs "doc"))
584 (old-doc-dir (string-append out "/share/doc"))
585 (new-doc/sbcl-dir (string-append doc "/share/doc/sbcl")))
586 (rmdir (string-append old-doc-dir "/sbcl/html"))
587 (mkdir-p new-doc/sbcl-dir)
588 (copy-recursively (string-append old-doc-dir "/sbcl")
590 (delete-file-recursively old-doc-dir)
592 ;; No 'check' target, though "make.sh" (build phase) runs tests.
595 (list (search-path-specification
596 (variable "XDG_DATA_DIRS")
598 (search-path-specification
599 (variable "XDG_CONFIG_DIRS")
601 (home-page "http://www.sbcl.org/")
602 (synopsis "Common Lisp implementation")
603 (description "Steel Bank Common Lisp (SBCL) is a high performance Common
604 Lisp compiler. In addition to the compiler and runtime system for ANSI Common
605 Lisp, it provides an interactive environment including a debugger, a
606 statistical profiler, a code coverage tool, and many other extensions.")
607 ;; Public domain in jurisdictions that allow it, bsd-2 otherwise. MIT
608 ;; loop macro has its own license. See COPYING file for further notes.
609 (license (list license:public-domain license:bsd-2
610 (license:x11-style "file://src/code/loop.lisp")))))
613 ;; Warning: according to upstream, CCL is not bootstrappable.
614 ;; See https://github.com/Clozure/ccl/issues/222 from 2019-09-02:
616 ;; "As far as I know, there is no way to build CCL without an existing
617 ;; running CCL image. It was bootstrapped back in 1986 or so as
618 ;; Macintosh Common Lisp, by Gary Byers, I believe, who is no longer on
619 ;; the planet to tell us the story. It SHOULD be possible to port the
620 ;; CCL compiler to portable Common Lisp, so that ANY lisp could build
621 ;; it, as is the case for SBCL, but I know of no attempt to do so."
624 ;; XXX When updating this package, check whether we can simply append
625 ;; VERSION to the ccl-bootstrap URL again, instead of per architecture.
630 (url "https://github.com/Clozure/ccl/")
631 (commit (string-append "v" version))))
632 (file-name (git-file-name "ccl" version))
635 "1zz291lvsrr7pps8wfl2kdxsnzjngqi4v3mil14pga4r5zanmsi7"))))
636 (build-system gnu-build-system)
637 ;; CCL consists of a "lisp kernel" and "heap image", both of which are
638 ;; shipped in precompiled form in source tarballs. The former is a C
639 ;; program which we can rebuild from scratch, but the latter cannot be
640 ;; generated without an already working copy of CCL, and is platform
641 ;; dependent, so we need to fetch the correct tarball for the platform.
647 "https://github.com/Clozure/ccl/releases/download/v"
648 (match (%current-system)
649 ("armhf-linux" "1.12/linuxarm")
650 ;; XXX: This source only works on x86, but provide it as a
651 ;; catch-all to prevent errors when querying this package
652 ;; on unsupported platforms.
653 (_ "1.12.1/linuxx86"))
657 (match (%current-system)
659 "0x4bjx6cxsjvxyagijhlvmc7jkyxifdvz5q5zvz37028va65243c")
660 (_ "0ll017ajcfsyx8f7zsy4394y8xxvz40iz0gcsmznp0n3mf0xi67c"))))))))
662 `(("cl-asdf" ,cl-asdf)
665 `(#:tests? #f ;no 'check' target
666 #:modules ((ice-9 match)
669 (guix build gnu-build-system))
671 (modify-phases %standard-phases
672 (add-after 'unpack 'unpack-image
673 (lambda* (#:key inputs #:allow-other-keys)
674 (invoke "tar" "xzvf" (assoc-ref inputs "ccl-bootstrap"))))
675 (add-after 'unpack 'replace-asdf
676 ;; Use system ASDF instead of bundled one.
677 (lambda* (#:key inputs #:allow-other-keys)
678 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
679 (guix-asdf (string-append
681 "/share/common-lisp/source/asdf/asdf.lisp"))
682 (contrib-asdf "tools/asdf.lisp"))
683 (delete-file contrib-asdf)
684 (copy-file guix-asdf contrib-asdf))))
686 (add-before 'build 'pre-build
687 ;; Enter the source directory for the current platform's lisp
688 ;; kernel, and run 'make clean' to remove the precompiled one.
689 (lambda* (#:key system #:allow-other-keys)
690 (substitute* "lisp-kernel/m4macros.m4"
691 (("/bin/pwd") (which "pwd")))
692 (chdir (string-append
695 ("i686-linux" "linuxx8632")
696 ("x86_64-linux" "linuxx8664")
697 ("armhf-linux" "linuxarm")
698 (_ (string-append "unknown system: " system)))))
699 (substitute* '("Makefile")
702 (invoke "make" "clean")))
703 ;; XXX Do we need to recompile the heap image as well for Guix?
704 ;; For now just use the one we already got in the tarball.
706 (lambda* (#:key outputs inputs system #:allow-other-keys)
707 ;; The lisp kernel built by running 'make' in lisp-kernel/$system
708 ;; is put back into the original directory, so go back. The heap
709 ;; image is there as well.
711 (let* ((out (assoc-ref outputs "out"))
712 (libdir (string-append out "/lib/"))
713 (bindir (string-append out "/bin/"))
714 (wrapper (string-append bindir "ccl"))
715 (bash (assoc-ref inputs "bash"))
718 ("i686-linux" "lx86cl")
719 ("x86_64-linux" "lx86cl64")
720 ("armhf-linux" "armcl")
721 ;; Unlikely to work, but try it anyway...
723 (heap (string-append kernel ".image")))
724 (install-file kernel libdir)
725 (install-file heap libdir)
727 (let ((dirs `("lib" "library" "examples" "tools" "objc-bridge"
734 (for-each copy-recursively
736 (map (cut string-append libdir <>) dirs)))
739 (with-output-to-file wrapper
743 "#!" bash "/bin/sh\n"
744 "export CCL_DEFAULT_DIRECTORY=" libdir "\n"
745 "exec -a \"$0\" " libdir kernel " \"$@\"\n"))))
746 (chmod wrapper #o755))
749 (list (search-path-specification
750 (variable "XDG_DATA_DIRS")
752 (search-path-specification
753 (variable "XDG_CONFIG_DIRS")
755 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
756 (home-page "https://ccl.clozure.com/")
757 (synopsis "Common Lisp implementation")
758 (description "Clozure CL (often called CCL for short) is a Common Lisp
759 implementation featuring fast compilation speed, native threads, a precise,
760 generational, compacting garbage collector, and a convenient foreign-function
762 (license license:asl2.0)))
771 (uri (string-append "mirror://sourceforge/lush/lush2/lush-"
773 (modules '((guix build utils)))
776 (substitute* "src/unix.c"
777 (("\\{ \"LUSH_DATE\", __DATE__ \\},") "")
778 (("\\{ \"LUSH_TIME\", __TIME__ \\},") ""))
779 (substitute* "src/main.c"
780 (("\" \\(built \" __DATE__ \"\\)\"") ""))
784 "02pkfn3nqdkm9fm44911dbcz0v3r0l53vygj8xigl6id5g3iwi4k"))))
785 (build-system gnu-build-system)
787 `(;; We have to add these LIBS so that they are found.
788 #:configure-flags (list "LIBS=-lz"
789 "X_EXTRA_LIBS=-lfontconfig"
791 #:tests? #f)) ; No make check.
792 (native-inputs `(("intltool" ,intltool)))
794 `(("alsa-lib" ,alsa-lib)
796 ("sdl-image" ,sdl-image)
797 ("sdl-mixer" ,sdl-mixer)
802 ("fontconfig" ,fontconfig)
804 ("openblas" ,openblas)
807 ("mesa-utils" ,mesa-utils)
808 ("binutils" ,binutils)
809 ("libiberty" ,libiberty)
810 ("readline" ,readline)
812 ("gettext-minimal" ,gettext-minimal)))
813 (synopsis "Lisp Universal Shell")
815 "Lush is an object-oriented Lisp interpreter/compiler with features
816 designed to please people who want to prototype large numerical
817 applications. Lush includes an extensive library of
818 vector/matrix/tensor manipulation, numerous numerical libraries
819 (including GSL, LAPACK, and BLAS), a set of graphic functions, a
820 simple GUI toolkit, and interfaces to various graphic and multimedia
821 libraries such as OpenGL, SDL, Video4Linux, and ALSA (video/audio
822 grabbing), and others. Lush is an ideal frontend script language for
823 programming projects written in C or other languages. Lush also has
824 libraries for Machine Learning, Neural Nets and statistical estimation.")
825 (home-page "http://lush.sourceforge.net/")
826 (license license:lgpl2.1+)))
828 (define-public confusion-mdl
829 (let* ((commit "12a055581fc262225272df43287dae48281900f5"))
831 (name "confusion-mdl")
836 (url (string-append "https://gitlab.com/emacsomancer/" name))
840 "1zi8kflzvwqg97ha1sa5xjisbjs5z1mvbpa772vfxiv5ksnpxp0d"))
841 (file-name (git-file-name name version))))
842 (build-system gnu-build-system)
844 `(#:tests? #f ; there are no tests
846 (modify-phases %standard-phases
849 (lambda* (#:key (make-flags '()) #:allow-other-keys)
850 (apply invoke "make" "CC=gcc" make-flags)))
852 (lambda* (#:key outputs #:allow-other-keys)
853 (let* ((out (assoc-ref outputs "out"))
854 (bin (string-append out "/bin")))
855 (install-file "mdli" bin)
861 (synopsis "Interpreter for the MIT Design Language (MDL)")
862 (description "MDL (the MIT Design Language) is a descendant of Lisp. It
863 was originally developed in 1971 on the PDP-10 computer under the Incompatible
864 Timesharing System (ITS) to provide high level language support for the
865 Dynamic Modeling Group at MIT's Project MAC. Infocom built the original
866 PDP-10 Zork in MDL and their later ZIL (Zork Implementation Language) was
867 based on a subset of MDL. Confusion is a MDL interpreter that works just well
868 enough to play the original mainframe Zork all the way through.")
869 (home-page "http://www.russotto.net/git/mrussotto/confusion/src/master/src/README")
870 (license license:gpl3+))))
873 (let ((commit "dfbf19b9a96474b8c1bacac85e43605e5691ceb2")
874 ;; Number of additional commits since the last tag (see the output of
875 ;; "git describe --tags").
879 (version (git-version "1.6g" revision commit))
884 (url "http://www.kylheku.com/git/man/")
886 (file-name (git-file-name name version))
888 (base32 "1zy0g8fj9nsfwzvg88hyaiy94r8j14xhs8vy2ln2niqdm6x2lvy2"))))
889 (build-system gnu-build-system)
891 `(#:tests? #f ; There are no tests.
893 (modify-phases %standard-phases
894 (add-after 'unpack 'fix-man2html-makefile
896 (substitute* "man2html/Makefile.in"
897 ;; It inadvertently ignores @bindir@.
898 (("^(bindir = \\$\\(DESTDIR\\)\\$\\(PREFIX\\)).*" _ prefix)
899 (string-append prefix "@bindir@\n")))
901 (add-after 'unpack 'delete-generated-files
903 (for-each delete-file
906 (map (lambda (d) (string-append d "/Makefile"))
907 '("." "man" "man2html" "src"))
908 (map (lambda (f) (string-append "src/" f))
909 '("makewhatis.in" "man.conf"
910 "paths.h" "version.h"))))
913 (lambda* (#:key outputs #:allow-other-keys)
914 (setenv "CC" ,(cc-for-target))
915 ;; Humor the manually written configure script.
916 (invoke "./configure" "+lang" "en" "+fhs"
917 (string-append "-prefix=" (assoc-ref outputs "out")))
919 (home-page "http://www.kylheku.com/cgit/man/")
920 (synopsis "Modifications to the man utilities, specifically man2html")
922 "This is a fork of the man utilities intended specifically for building
923 the HTML documentation of TXR.")
924 (license license:gpl2))))
934 (url "http://www.kylheku.com/git/txr/")
935 (commit (string-append "txr-" version))))
936 (file-name (git-file-name name version))
938 (base32 "0q97qddbgk9356gx4xp8iip4pwj3ln03dvjfgrny76f3wmmiwsw6"))))
939 (build-system gnu-build-system)
941 ;; Required to build the documentation.
942 `(("ghostscript" ,ghostscript)
944 ("man2html" ,man-for-txr)))
946 `(("bash" ,bash-minimal)
950 (list ,(string-append "cc=" (cc-for-target))
951 (string-append "--prefix=" (assoc-ref %outputs "out")))
952 #:test-target "tests"
954 (modify-phases %standard-phases
955 (add-after 'unpack 'fix-license-installation
956 (lambda* (#:key outputs #:allow-other-keys)
957 (substitute* "Makefile"
958 (("INSTALL(,.*LICENSE,.*)\\$\\(datadir\\)" _ match)
959 (string-append "INSTALL" match
960 (assoc-ref outputs "out")
961 "/share/doc/" ,name "-" ,version)))
963 (delete 'install-license-files)
964 (add-after 'unpack 'inhibit-doc-syms-generation
966 (substitute* "genman.txr"
967 ;; Exit from genman.txr before it tries to write to
968 ;; stdlib/doc-syms.tl, which is anyway kept up to date with
969 ;; each release (and is already compiled to stdlib/doc-syms.tlo
970 ;; when genman.txr is run).
971 (("^@\\(output \"stdlib/doc-syms\\.tl\"\\).*" line)
972 (string-append "@(do (exit))\n" line)))
974 (add-after 'unpack 'fix-paths
975 (lambda* (#:key inputs #:allow-other-keys)
976 (substitute* "stream.c"
978 (string-append (assoc-ref inputs "bash") "/bin/bash")))))
979 (add-after 'unpack 'fix-tests
981 (substitute* (list "tests/017/realpath.tl"
982 "tests/017/realpath.expected")
983 (("/usr/bin") "/"))))
985 ;; ./configure is a hand-written script that can't handle standard
986 ;; autotools arguments like CONFIG_SHELL.
987 (lambda* (#:key configure-flags #:allow-other-keys)
988 (setenv "txr_shell" (which "bash"))
989 (apply invoke "./configure" configure-flags)
991 (add-after 'build 'build-doc
993 (setenv "GS_GENERATE_UUIDS" "0")
994 (invoke "make" "txr-manpage.html" "txr-manpage.pdf")
996 (add-after 'install 'install-doc
997 (lambda* (#:key outputs #:allow-other-keys)
998 (let ((doc (string-append (assoc-ref outputs "out")
999 "/share/doc/" ,name "-" ,version)))
1000 (for-each (lambda (f) (install-file f doc))
1001 '("txr-manpage.html" "txr-manpage.pdf")))
1003 (synopsis "General-purpose, multi-paradigm programming language")
1005 "TXR is a general-purpose, multi-paradigm programming language. It
1006 comprises two languages integrated into a single tool: a text scanning and
1007 extraction language referred to as the TXR Pattern Language (sometimes just
1008 \"TXR\"), and a general-purpose dialect of Lisp called TXR Lisp. TXR can be
1009 used for everything from \"one liner\" data transformation tasks at the
1010 command line, to data scanning and extracting scripts, to full application
1011 development in a wide-range of areas.")
1012 (home-page "https://nongnu.org/txr/")
1013 (license license:bsd-2)))
1022 (uri (string-append "https://software-lab.de/picoLisp-" version ".tgz"))
1024 (base32 "10np0mhihr47r3201617zccrvzpkhdl1jwvz7zimk8kxpriydq2j"))
1025 (modules '((guix build utils)))
1027 ;; Delete the pre-compiled jar file.
1028 (delete-file "ersatz/picolisp.jar")
1030 (build-system gnu-build-system)
1032 `(("openssl" ,openssl)))
1034 `(#:system ,(match (%current-system)
1035 ((or "armhf-linux" "aarch64-linux")
1040 (modify-phases %standard-phases
1042 (add-after 'unpack 'fix-paths
1043 (lambda* (#:key outputs #:allow-other-keys)
1044 (let* ((out (assoc-ref outputs "out"))
1045 (shebang-line (string-append
1046 "#!" out "/bin/picolisp "
1047 out "/lib/picolisp/lib.l")))
1048 (substitute* '("bin/pil"
1061 (("#\\!bin/picolisp lib.l")
1063 (("#\\!\\.\\./bin/picolisp \\.\\./lib.l")
1065 (("#\\!/usr/bin/picolisp /usr/lib/picolisp/lib.l")
1068 (add-after 'fix-paths 'make-build-reproducible
1070 (substitute* "src64/lib/asm.l"
1071 (("\\(prinl \"/\\* \" \\(datSym \\(date\\)\\) \" \\*/\\)")
1074 (add-after 'make-build-reproducible 'fix-permissions
1076 (for-each make-file-writable
1084 (invoke "make" "-C" "src" "picolisp" "tools" "gate")))
1085 (add-before 'check 'set-home-for-tests
1087 (setenv "HOME" "/tmp")
1091 (invoke "./pil" "test/lib.l" "-bye" "+")))
1093 (lambda* (#:key outputs #:allow-other-keys)
1094 (let* ((out (assoc-ref outputs "out"))
1095 (bin (string-append out "/bin"))
1096 (man (string-append out "/share/man"))
1097 (picolisp (string-append out "/lib/picolisp")))
1098 (copy-recursively "man" man)
1099 (copy-recursively "." picolisp)
1100 (for-each (lambda (name)
1101 (let ((path (string-append picolisp "/" name)))
1102 (delete-file-recursively path)))
1103 '("CHANGES" "COPYING" "CREDITS" "cygwin"
1104 "INSTALL" "man" "pil" "README" "src" "src64"
1107 (symlink (string-append picolisp "/bin/picolisp")
1108 (string-append bin "/picolisp"))
1109 (symlink (string-append picolisp "/bin/pil")
1110 (string-append bin "/pil")))
1112 (synopsis "Interpreter for the PicoLisp programming language")
1114 "PicoLisp is a programming language, or really a programming system,
1115 including a built-in database engine and a GUI system.")
1116 (home-page "https://picolisp.com/wiki/?home")
1117 (license license:expat)))
1119 (define-public picolisp
1120 (match (%current-system)
1121 ((or "aarch64-linux" "x86_64-linux")
1123 ;; Use the 32-bit picolisp to generate the assembly files required by
1124 ;; the 64-bit picolisp.
1125 (inherit picolisp32)
1128 `(("picolisp32" ,picolisp32)
1131 (substitute-keyword-arguments (package-arguments picolisp32)
1132 ((#:system _ "") (%current-system))
1134 `(modify-phases ,phases
1136 (add-before 'build 'fix-paths
1137 ;; This must run after the other shebang-patching phases,
1138 ;; or they will override our changes.
1139 (lambda* (#:key inputs outputs #:allow-other-keys)
1140 (let* ((picolisp32 (assoc-ref inputs "picolisp32"))
1141 (out (assoc-ref outputs "out"))
1142 (shebang-line (string-append
1143 "#!" out "/bin/picolisp "
1144 out "/lib/picolisp/lib.l")))
1145 (substitute* '("bin/pil"
1158 (("#\\!.*picolisp32.*/bin/picolisp .*lib\\.l")
1160 (substitute* "src64/mkAsm"
1162 (string-append picolisp32 "/bin/"))))
1166 (invoke "make" "-C" "src" "tools" "gate")
1167 (invoke "make" "-C" "src64" "CC=gcc" "picolisp")))))))))
1170 (inherit picolisp32)
1171 (name "picolisp")))))
1173 (define-public janet
1181 (url "https://github.com/janet-lang/janet")
1182 (commit (string-append "v" version))))
1183 (file-name (git-file-name name version))
1185 (base32 "0if514zdmbjvvrsa9x5yfvg2b14sz53yaka12g3yhwkq8ls3qk0c"))))
1186 (build-system gnu-build-system)
1188 `(#:make-flags (list
1189 (string-append "DESTDIR=" (assoc-ref %outputs "out"))
1190 (string-append "PREFIX=")
1191 (string-append "CC=" (assoc-ref %build-inputs "gcc")
1194 (modify-phases %standard-phases
1198 (invoke "make" "test"))))))
1199 (home-page "https://janet-lang.org/")
1200 (synopsis "Functional, imperative and embeddable programming language")
1202 "Janet is a functional and imperative programming language. It can be
1203 used for rapid prototyping, dynamic systems, and other domains where dynamic
1204 languages shine. You can also add Janet scripting to an application by
1205 embedding a single C file and two headers. It can be easily ported to new
1206 platforms. The entire language (core library, interpreter, compiler,
1207 assembler, PEG) is less than 1MB.")
1208 (license license:expat)))
1210 (define-public lisp-repl-core-dumper
1212 (name "lisp-repl-core-dumper")
1218 (url "https://gitlab.com/ambrevar/lisp-repl-core-dumper.git")
1220 (file-name (git-file-name name version))
1222 (base32 "0yfsyxj462yi3bx587yssp4gwb54jdm6fjk9q93gjrfv8a65ilp7"))))
1223 (build-system copy-build-system)
1226 '(("lisp-repl-core-dumper" "bin/"))
1228 (modify-phases %standard-phases
1229 (add-before 'install 'fix-utils-path
1230 (lambda* (#:key inputs #:allow-other-keys)
1231 (let* ((cat (search-input-file inputs "/bin/cat"))
1232 (paste (search-input-file inputs "/bin/paste"))
1233 (sort (search-input-file inputs "/bin/sort"))
1234 (basename (search-input-file inputs "/bin/basename"))
1235 (sed (search-input-file inputs "/bin/sed")))
1236 (substitute* "lisp-repl-core-dumper"
1237 (("\\$\\(basename") (string-append "$(" basename))
1239 (("\\<paste\\>") paste)
1241 (("\\<sort\\>") sort))))))))
1243 `(("coreutils" ,coreutils-minimal)
1245 (home-page "https://gitlab.com/ambrevar/lisp-repl-core-dumper")
1246 (synopsis "Generate REPL-optimized Lisp cores on demand")
1248 "This tool generates Lisp images that can embed the provided systems
1249 and make for REPLs that start blazing fast.
1252 @item It’s portable and should work with any compiler.
1253 @item It works for any REPL.
1254 @item It allows you to include arbitrary libraries.
1256 (license license:gpl3+)))
1258 (define-public buildapp
1266 (url "https://github.com/xach/buildapp")
1267 (commit (string-append "release-" version))))
1268 (file-name (git-file-name name version))
1270 (base32 "020ipjfqa3l8skd97cj5kq837wgpj28ygfxnkv64cnjrlbnzh161"))))
1271 (build-system gnu-build-system)
1277 (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))
1278 #:strip-binaries? #f
1280 (modify-phases %standard-phases
1282 (add-after 'unpack 'set-home
1284 (setenv "HOME" "/tmp")
1286 (add-before 'install 'create-target-directory
1287 (lambda* (#:key outputs #:allow-other-keys)
1288 (let* ((bin (string-append (assoc-ref outputs "out") "/bin")))
1291 (home-page "https://www.xach.com/lisp/buildapp/")
1292 (synopsis "Makes easy to build application executables with SBCL")
1294 "Buildapp is an application for SBCL or CCL that configures and saves an
1295 executable Common Lisp image. It is similar to cl-launch and hu.dwim.build. ")
1296 (license license:bsd-2)))