gnu: lisp-repl-core-dumper: Update to 0.3.0.
[jackhill/guix/guix.git] / gnu / packages / lisp.scm
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 ;;;
20 ;;; This file is part of GNU Guix.
21 ;;;
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.
26 ;;;
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.
31 ;;;
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/>.
34
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.
39
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))
79
80 (define-public cl-asdf
81 (package
82 (name "cl-asdf")
83 (version "3.3.4")
84 (source
85 (origin
86 (method url-fetch)
87 (uri
88 (string-append "https://common-lisp.net/project/asdf/archives/asdf-"
89 version ".lisp"))
90 (sha256
91 (base32 "1hpx30f6yrak15nw992k7x3pn75ahvjs04n4f134k68mhgs62km2"))))
92 (build-system trivial-build-system)
93 (arguments
94 `(#:modules ((guix build utils)
95 (guix build lisp-utils))
96 #:builder
97 (begin
98 (use-modules (guix build utils)
99 (guix build lisp-utils))
100 (let* ((out (string-append (assoc-ref %outputs "out")))
101 (asdf-install (string-append out %source-install-prefix
102 "/source/asdf/"))
103 (src-asdf (string-append (assoc-ref %build-inputs "source")))
104 (dst-asdf (string-append asdf-install "asdf.lisp")))
105 (mkdir-p asdf-install)
106 (copy-file src-asdf dst-asdf)
107 ;; Patch ASDF to make it read the configuration files in all
108 ;; the direcories listed in '$XDG_CONFIG_DIRS' instead of just
109 ;; the first.
110 (substitute* dst-asdf
111 (("\\(xdg-config-pathname \\*source-registry-directory\\* direction\\)")
112 "`(:source-registry
113 ,@(loop
114 for dir in (xdg-config-dirs
115 \"common-lisp/source-registry.conf.d/\")
116 collect `(:include ,dir))
117 :inherit-configuration)")
118 (("\\(xdg-config-pathname \\*output-translations-directory\\* direction\\)")
119 "`(:output-translations
120 ,@(loop
121 for dir in (xdg-config-dirs
122 \"common-lisp/asdf-output-translations.conf.d/\")
123 collect `(:include ,dir))
124 :inherit-configuration)")))
125 #t)))
126 (home-page "https://common-lisp.net/project/asdf/")
127 (synopsis "Another System Definition Facility")
128 (description
129 "ASDF is what Common Lisp hackers use to build and load software. It is
130 the successor of the Lisp DEFSYSTEM of yore. ASDF stands for Another System
131 Definition Facility.")
132 ;; MIT License
133 (license license:expat)))
134
135 (define-public gcl
136 (let ((commit "d3335e2b3deb63f930eb0328e9b05377744c9512")
137 (revision "2")) ;Guix package revision
138 (package
139 (name "gcl")
140 (version (string-append "2.6.12-" revision "."
141 (string-take commit 7)))
142 (source
143 (origin
144 (method git-fetch)
145 (uri (git-reference
146 (url "https://git.savannah.gnu.org/r/gcl.git")
147 (commit commit)))
148 (file-name (string-append "gcl-" version "-checkout"))
149 (sha256
150 (base32 "05v86lhvsby05nzvcd3c4k0wljvgdgd0i6arzd2fx1yd67dl6fgj"))))
151 (build-system gnu-build-system)
152 (arguments
153 `(#:parallel-build? #f ; The build system seems not to be thread safe.
154 #:test-target "ansi-tests/test_results"
155 #:configure-flags '("--enable-ansi") ; required for use by the maxima package
156 #:make-flags (list
157 (string-append "GCL_CC=" (assoc-ref %build-inputs "gcc")
158 "/bin/gcc")
159 (string-append "CC=" (assoc-ref %build-inputs "gcc")
160 "/bin/gcc"))
161 #:phases
162 (modify-phases %standard-phases
163 (add-before 'configure 'pre-conf
164 (lambda* (#:key inputs #:allow-other-keys)
165 (chdir "gcl")
166 (substitute*
167 (append
168 '("pcl/impl/kcl/makefile.akcl"
169 "add-defs"
170 "unixport/makefile.dos"
171 "add-defs.bat"
172 "gcl-tk/makefile.prev"
173 "add-defs1")
174 (find-files "h" "\\.defs"))
175 (("SHELL=/bin/bash")
176 (string-append "SHELL=" (which "bash")))
177 (("SHELL=/bin/sh")
178 (string-append "SHELL=" (which "sh"))))
179 (substitute* "h/linux.defs"
180 (("#CC") "CC")
181 (("-fwritable-strings") "")
182 (("-Werror") ""))
183 (substitute* "lsp/gcl_top.lsp"
184 (("\"cc\"")
185 (string-append "\"" (assoc-ref %build-inputs "gcc")
186 "/bin/gcc\""))
187 (("\\(or \\(get-path \\*cc\\*\\) \\*cc\\*\\)") "*cc*")
188 (("\"ld\"")
189 (string-append "\"" (assoc-ref %build-inputs "binutils")
190 "/bin/ld\""))
191 (("\\(or \\(get-path \\*ld\\*\\) \\*ld\\*\\)") "*ld*")
192 (("\\(get-path \"objdump --source \"\\)")
193 (string-append "\"" (assoc-ref %build-inputs "binutils")
194 "/bin/objdump --source \"")))
195 #t))
196 (add-after 'install 'wrap
197 (lambda* (#:key inputs outputs #:allow-other-keys)
198 (let* ((gcl (assoc-ref outputs "out"))
199 (input-path (lambda (lib path)
200 (string-append
201 (assoc-ref inputs lib) path)))
202 (binaries '("binutils")))
203 ;; GCC and the GNU binutils are necessary for GCL to be
204 ;; able to compile Lisp functions and programs (this is
205 ;; a standard feature in Common Lisp). While the
206 ;; the location of GCC is specified in the make-flags,
207 ;; the GNU binutils must be available in GCL's $PATH.
208 (wrap-program (string-append gcl "/bin/gcl")
209 `("PATH" prefix ,(map (lambda (binary)
210 (input-path binary "/bin"))
211 binaries))))
212 #t))
213 ;; drop strip phase to make maxima build, see
214 ;; https://www.ma.utexas.edu/pipermail/maxima/2008/009769.html
215 (delete 'strip))))
216 (inputs
217 `(("gmp" ,gmp)
218 ("readline" ,readline)))
219 (native-inputs
220 `(("m4" ,m4)
221 ("texinfo" ,texinfo)))
222 (home-page "https://www.gnu.org/software/gcl/")
223 (synopsis "A Common Lisp implementation")
224 (description "GCL is an implementation of the Common Lisp language. It
225 features the ability to compile to native object code and to load native
226 object code modules directly into its lisp core. It also features a
227 stratified garbage collection strategy, a source-level debugger and a built-in
228 interface to the Tk widget system.")
229 (license license:lgpl2.0+))))
230
231 (define-public ecl
232 (package
233 (name "ecl")
234 (version "20.4.24")
235 (source
236 (origin
237 (method url-fetch)
238 (uri (string-append
239 "https://common-lisp.net/project/ecl/static/files/release/"
240 name "-" version ".tgz"))
241 (sha256
242 (base32 "01qgdmr54wkj854f69qdm9sybrvd6gd21dpx4askdaaqybnkh237"))))
243 (build-system gnu-build-system)
244 ;; src/configure uses 'which' to confirm the existence of 'gzip'.
245 (native-inputs
246 `(("cl-asdf" ,cl-asdf)
247 ("which" ,which)
248 ("texinfo" ,texinfo)))
249 (inputs
250 `(("gmp" ,gmp)
251 ("libatomic-ops" ,libatomic-ops)
252 ("libgc" ,libgc)
253 ("libffi" ,libffi)))
254 (arguments
255 `(#:configure-flags '("--without-rt")
256 ;; FIXME: As of version 20.4.24, we pass 17995 tests and fail 7.
257 ;; 2-3 tests may be due to FHS assumptions.
258 #:tests? #t
259 #:parallel-tests? #f
260 #:phases
261 (modify-phases %standard-phases
262 (delete 'check)
263 (add-after 'unpack 'replace-asdf
264 ;; Use system ASDF instead of bundled one.
265 (lambda* (#:key inputs outputs #:allow-other-keys)
266 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
267 (guix-asdf (string-append
268 cl-asdf
269 "/share/common-lisp/source/asdf/asdf.lisp"))
270 (out (string-append (assoc-ref outputs "out")))
271 (contrib-asdf "contrib/asdf/asdf.lisp"))
272 (copy-file guix-asdf contrib-asdf))
273 #t))
274 (add-after 'install 'wrap
275 (lambda* (#:key inputs outputs #:allow-other-keys)
276 (let* ((ecl (assoc-ref outputs "out"))
277 (input-path (lambda (lib path)
278 (string-append
279 (assoc-ref inputs lib) path)))
280 (libraries '("gmp" "libatomic-ops" "libgc" "libffi" "libc"))
281 (binaries '("gcc" "ld-wrapper" "binutils"))
282 (library-directories
283 (map (lambda (lib) (input-path lib "/lib"))
284 libraries)))
285
286 (wrap-program (string-append ecl "/bin/ecl")
287 `("PATH" prefix
288 ,(map (lambda (binary)
289 (input-path binary "/bin"))
290 binaries))
291 `("CPATH" suffix
292 ,(map (lambda (lib)
293 (input-path lib "/include"))
294 `("kernel-headers" ,@libraries)))
295 `("LIBRARY_PATH" suffix ,library-directories)
296 `("LD_LIBRARY_PATH" suffix ,library-directories)))))
297 (add-after 'wrap 'check (assoc-ref %standard-phases 'check))
298 (add-before 'check 'fix-path-to-ecl
299 (lambda _
300 (substitute* "build/tests/Makefile"
301 (("\\$\\{exec_prefix\\}/") ""))
302 #t)))))
303 (native-search-paths
304 (list (search-path-specification
305 (variable "XDG_DATA_DIRS")
306 (files '("share")))
307 (search-path-specification
308 (variable "XDG_CONFIG_DIRS")
309 (files '("etc")))))
310 (home-page "http://ecls.sourceforge.net/")
311 (synopsis "Embeddable Common Lisp")
312 (description "ECL is an implementation of the Common Lisp language as
313 defined by the ANSI X3J13 specification. Its most relevant features are: a
314 bytecode compiler and interpreter, being able to compile Common Lisp with any
315 C/C++ compiler, being able to build standalone executables and libraries, and
316 supporting ASDF, Sockets, Gray streams, MOP, and other useful components.")
317 ;; Note that the file "Copyright" points to some files and directories
318 ;; which aren't under the lgpl2.1+ and instead contain many different,
319 ;; non-copyleft licenses.
320 ;; See https://common-lisp.net/project/ecl/posts/ECL-license.html.
321 (license license:lgpl2.1+)))
322
323 (define-public clisp
324 (package
325 (name "clisp")
326 (version "2.49-92")
327 (source
328 (origin
329 (method git-fetch)
330 (uri (git-reference
331 (url "https://gitlab.com/gnu-clisp/clisp")
332 (commit "clisp-2.49.92-2018-02-18")))
333 (file-name (git-file-name name version))
334 (sha256
335 (base32 "0k2dmgl0miz3767iks4p0mvp6xw0ysyxhjpklyh11j010rmh6hqb"))))
336 (build-system gnu-build-system)
337 (inputs `(("libffcall" ,libffcall)
338 ("ncurses" ,ncurses)
339 ("readline" ,readline)
340 ("libsigsegv" ,libsigsegv)))
341 (arguments
342 `(#:configure-flags '(,@(if (string-prefix? "armhf-linux"
343 (or (%current-system)
344 (%current-target-system)))
345 '("CFLAGS=-falign-functions=4")
346 '())
347 "--with-dynamic-ffi"
348 "--with-dynamic-modules"
349 "--with-ffcall"
350 "--with-readline"
351 "--with-sigsegv"
352 "--with-module=asdf"
353 "--with-module=rawsock")
354 #:phases
355 (modify-phases %standard-phases
356 (add-after 'unpack 'patch-sh-and-pwd
357 (lambda _
358 ;; The package is very messy with its references to "/bin/sh" and
359 ;; some other absolute paths to traditional tools. These appear in
360 ;; many places where our automatic patching misses them. Therefore
361 ;; we do the following, in this early (post-unpack) phase, to solve
362 ;; the problem from its root.
363 (substitute* '("src/clisp-link.in"
364 "src/unix.d"
365 "src/makemake.in")
366 (("/bin/sh") (which "sh")))
367 (substitute* (find-files "." "configure|Makefile")
368 (("/bin/sh") "sh"))
369 (substitute* '("src/clisp-link.in")
370 (("/bin/pwd") "pwd"))
371 #t)))))
372 (home-page "https://clisp.sourceforge.io/")
373 (synopsis "A Common Lisp implementation")
374 (description
375 "GNU CLISP is an implementation of ANSI Common Lisp. Common Lisp is a
376 high-level, object-oriented functional programming language. CLISP includes
377 an interpreter, a compiler, a debugger, and much more.")
378 (license license:gpl2+)))
379
380 (define-public sbcl
381 (package
382 (name "sbcl")
383 (version "2.0.11")
384 (source
385 (origin
386 (method url-fetch)
387 (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-"
388 version "-source.tar.bz2"))
389 (sha256
390 (base32 "07cpswxh2f38b440xdn3fjk7b4r0ipj3sbwb3jd134phrr9smll7"))))
391 (build-system gnu-build-system)
392 (outputs '("out" "doc"))
393 (native-inputs
394 ;; From INSTALL:
395 ;; Supported build hosts are:
396 ;; SBCL
397 ;; CMUCL
398 ;; CCL (formerly known as OpenMCL)
399 ;; ABCL (recent versions only)
400 ;; CLISP (only some versions: 2.44.1 is OK, 2.47 is not)
401 ;; XCL
402 ;;
403 ;; From NEWS:
404 ;; * build enhancement: new host quirks mechanism, support for building under
405 ;; ABCL and ECL (as well as CCL, CMUCL, CLISP and SBCL itself)
406 ;;
407 ;; CCL is not bootstrappable so it won't do. CLISP 2.49 seems to work.
408 ;; ECL too. As of 2020-07-01, ECL was last updated in 2020 while CLISP
409 ;; was last updated in 2010, and both take about the same time to build SBCL.
410 ;;
411 ;; For now we stick to CLISP for all systems. We keep the `match' here
412 ;; to make it easier to change the host compiler for various
413 ;; architectures. Consider switching to ECL if it gets faster than CLISP
414 ;; (maybe post 2020 release).
415 `(,@(match (%current-system)
416 ((or "x86_64-linux" "i686-linux")
417 `(("clisp" ,clisp)))
418 (_
419 `(("clisp" ,clisp))))
420 ("cl-asdf" ,cl-asdf)
421 ("ed" ,ed)
422 ("inetutils" ,inetutils) ;for hostname(1)
423 ("texinfo" ,texinfo)
424 ("texlive" ,(texlive-union (list texlive-tex-texinfo)))
425 ("which" ,which)
426 ("zlib" ,zlib)))
427 (arguments
428 `(#:modules ((guix build gnu-build-system)
429 (guix build utils)
430 (srfi srfi-1))
431 #:phases
432 (modify-phases %standard-phases
433 (delete 'configure)
434 (add-after 'unpack 'replace-asdf
435 ;; SBCL developers have not committed to keeping ASDF up to date
436 ;; due to breaking changes [1]. Guix can handle this situation
437 ;; easily, and it behooves us to have more control over what version
438 ;; of ASDF we use to build software; therefore, replace the contrib
439 ;; ASDF with the version packaged into Guix.
440 ;; [1] - https://bugs.launchpad.net/sbcl/+bug/1823442
441 (lambda* (#:key inputs outputs #:allow-other-keys)
442 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
443 (guix-asdf (string-append
444 cl-asdf
445 "/share/common-lisp/source/asdf/asdf.lisp"))
446 (out (string-append (assoc-ref outputs "out")))
447 (contrib-asdf "contrib/asdf/asdf.lisp"))
448 (copy-file guix-asdf contrib-asdf))
449 #t))
450 (add-before 'build 'patch-unix-tool-paths
451 (lambda* (#:key outputs inputs #:allow-other-keys)
452 (let ((out (assoc-ref outputs "out"))
453 (bash (assoc-ref inputs "bash"))
454 (coreutils (assoc-ref inputs "coreutils"))
455 (ed (assoc-ref inputs "ed")))
456 (define (quoted-path input path)
457 (string-append "\"" input path "\""))
458 ;; Patch absolute paths in string literals. Note that this
459 ;; occurs in some .sh files too (which contain Lisp code). Use
460 ;; ISO-8859-1 because some of the files are ISO-8859-1 encoded.
461 (with-fluids ((%default-port-encoding #f))
462 ;; The removed file is utf-16-be encoded, which gives substitute*
463 ;; trouble. It does not contain references to the listed programs.
464 (substitute* (delete
465 "./tests/data/compile-file-pos-utf16be.lisp"
466 (find-files "." "\\.(lisp|sh)$"))
467 (("\"/bin/sh\"") (quoted-path bash "/bin/sh"))
468 (("\"/usr/bin/env\"") (quoted-path coreutils "/usr/bin/env"))
469 (("\"/bin/cat\"") (quoted-path coreutils "/bin/cat"))
470 (("\"/bin/ed\"") (quoted-path ed "/bin/ed"))
471 (("\"/bin/echo\"") (quoted-path coreutils "/bin/echo"))
472 (("\"/bin/uname\"") (quoted-path coreutils "/bin/uname"))))
473 ;; This one script has a non-string occurrence of /bin/sh.
474 (substitute* '("tests/foreign.test.sh")
475 ;; Leave whitespace so we don't match the shebang.
476 ((" /bin/sh ") " sh "))
477 ;; This file contains a module that can create executable files
478 ;; which depend on the presence of SBCL. It generates shell
479 ;; scripts doing "exec sbcl ..." to achieve this. We patch both
480 ;; the shebang and the reference to "sbcl", tying the generated
481 ;; executables to the exact SBCL package that generated them.
482 (substitute* '("contrib/sb-executable/sb-executable.lisp")
483 (("/bin/sh") (string-append bash "/bin/sh"))
484 (("exec sbcl") (string-append "exec " out "/bin/sbcl")))
485 ;; Disable some tests that fail in our build environment.
486 (substitute* '("contrib/sb-bsd-sockets/tests.lisp")
487 ;; This requires /etc/protocols.
488 (("\\(deftest get-protocol-by-name/error" all)
489 (string-append "#+nil ;disabled by Guix\n" all)))
490 (substitute* '("contrib/sb-posix/posix-tests.lisp")
491 ;; These assume some users/groups which we don't have.
492 (("\\(deftest pwent\\.[12]" all)
493 (string-append "#+nil ;disabled by Guix\n" all))
494 (("\\(deftest grent\\.[12]" all)
495 (string-append "#+nil ;disabled by Guix\n" all))))
496 #t))
497 ;; FIXME: the texlive-union insists on regenerating fonts. It stores
498 ;; them in HOME, so it needs to be writeable.
499 (add-before 'build 'set-HOME
500 (lambda _ (setenv "HOME" "/tmp") #t))
501 (replace 'build
502 (lambda* (#:key outputs #:allow-other-keys)
503 (setenv "CC" "gcc")
504 (invoke "sh" "make.sh" ,@(match (%current-system)
505 ((or "x86_64-linux" "i686-linux")
506 `("clisp"))
507 (_
508 `("clisp")))
509 (string-append "--prefix="
510 (assoc-ref outputs "out"))
511 "--dynamic-space-size=3072"
512 "--with-sb-core-compression"
513 "--with-sb-xref-for-internals")))
514 (replace 'install
515 (lambda _
516 (invoke "sh" "install.sh")))
517 (add-after 'build 'build-doc
518 (lambda _
519 ;; TODO: Doc is not deterministic, maybe there is a timespamp?
520 (with-directory-excursion "doc/manual"
521 (and (invoke "make" "info")
522 (invoke "make" "dist")))))
523 (add-after 'build 'build-source
524 (lambda* (#:key outputs #:allow-other-keys)
525 (let* ((out (assoc-ref outputs "out"))
526 (rc (string-append out "/lib/sbcl/sbclrc"))
527 (source-dir (string-append out "/share/sbcl")))
528 (for-each (lambda (p)
529 (copy-recursively p (string-append source-dir "/" p)))
530 '("src" "contrib"))
531 (mkdir-p (dirname rc))
532 (with-output-to-file rc
533 (lambda ()
534 (display
535 (string-append "(sb-ext:set-sbcl-source-location \""
536 source-dir "\")") )))
537 #t)))
538 (add-after 'install 'install-doc
539 (lambda* (#:key outputs #:allow-other-keys)
540 (let* ((out (assoc-ref outputs "out"))
541 (doc (assoc-ref outputs "doc"))
542 (old-doc-dir (string-append out "/share/doc"))
543 (new-doc/sbcl-dir (string-append doc "/share/doc/sbcl")))
544 (rmdir (string-append old-doc-dir "/sbcl/html"))
545 (mkdir-p new-doc/sbcl-dir)
546 (copy-recursively (string-append old-doc-dir "/sbcl")
547 new-doc/sbcl-dir)
548 (delete-file-recursively old-doc-dir)
549 #t))))
550 ;; No 'check' target, though "make.sh" (build phase) runs tests.
551 #:tests? #f))
552 (native-search-paths
553 (list (search-path-specification
554 (variable "XDG_DATA_DIRS")
555 (files '("share")))
556 (search-path-specification
557 (variable "XDG_CONFIG_DIRS")
558 (files '("etc")))))
559 (home-page "http://www.sbcl.org/")
560 (synopsis "Common Lisp implementation")
561 (description "Steel Bank Common Lisp (SBCL) is a high performance Common
562 Lisp compiler. In addition to the compiler and runtime system for ANSI Common
563 Lisp, it provides an interactive environment including a debugger, a
564 statistical profiler, a code coverage tool, and many other extensions.")
565 ;; Public domain in jurisdictions that allow it, bsd-2 otherwise. MIT
566 ;; loop macro has its own license. See COPYING file for further notes.
567 (license (list license:public-domain license:bsd-2
568 (license:x11-style "file://src/code/loop.lisp")))))
569
570 (define-public ccl
571 ;; Warning: according to upstream, CCL is not bootstrappable.
572 ;; See https://github.com/Clozure/ccl/issues/222 from 2019-09-02:
573 ;;
574 ;; "As far as I know, there is no way to build CCL without an existing
575 ;; running CCL image. It was bootstrapped back in 1986 or so as
576 ;; Macintosh Common Lisp, by Gary Byers, I believe, who is no longer on
577 ;; the planet to tell us the story. It SHOULD be possible to port the
578 ;; CCL compiler to portable Common Lisp, so that ANY lisp could build
579 ;; it, as is the case for SBCL, but I know of no attempt to do so."
580 (package
581 (name "ccl")
582 (version "1.12")
583 (source (origin
584 (method git-fetch)
585 (uri (git-reference
586 (url "https://github.com/Clozure/ccl/")
587 (commit (string-append "v" version))))
588 (file-name (git-file-name "ccl" version))
589 (sha256
590 (base32
591 "0kxr24d2fzsmpsilijpwwfl6g89y7fcrwb80kai5nx9pwgxmjbp3"))))
592 (build-system gnu-build-system)
593 ;; CCL consists of a "lisp kernel" and "heap image", both of which are
594 ;; shipped in precompiled form in source tarballs. The former is a C
595 ;; program which we can rebuild from scratch, but the latter cannot be
596 ;; generated without an already working copy of CCL, and is platform
597 ;; dependent, so we need to fetch the correct tarball for the platform.
598 (inputs
599 `(("ccl-bootstrap"
600 ,(origin
601 (method url-fetch)
602 (uri (string-append
603 "https://github.com/Clozure/ccl/releases/download/v" version "/"
604 (match (%current-system)
605 ("armhf-linux" "linuxarm")
606 ;; XXX: This source only works on x86, but provide it as a
607 ;; catch-all to prevent errors when querying this package
608 ;; on unsupported platforms.
609 (_ "linuxx86"))
610 ".tar.gz"))
611 (sha256
612 (base32
613 (match (%current-system)
614 ("armhf-linux"
615 "0x4bjx6cxsjvxyagijhlvmc7jkyxifdvz5q5zvz37028va65243c")
616 (_ "15l7cfa4a7jkfwdzsfm4q3n22jnb57imxahpql3h77xin57v1gbz"))))))))
617 (native-inputs
618 `(("m4" ,m4)))
619 (arguments
620 `(#:tests? #f ;no 'check' target
621 #:modules ((ice-9 match)
622 (srfi srfi-26)
623 (guix build utils)
624 (guix build gnu-build-system))
625 #:phases
626 (modify-phases %standard-phases
627 (add-after 'unpack 'unpack-image
628 (lambda* (#:key inputs #:allow-other-keys)
629 (invoke "tar" "xzvf" (assoc-ref inputs "ccl-bootstrap"))))
630 (delete 'configure)
631 (add-before 'build 'pre-build
632 ;; Enter the source directory for the current platform's lisp
633 ;; kernel, and run 'make clean' to remove the precompiled one.
634 (lambda* (#:key system #:allow-other-keys)
635 (substitute* "lisp-kernel/m4macros.m4"
636 (("/bin/pwd") (which "pwd")))
637 (chdir (string-append
638 "lisp-kernel/"
639 (match system
640 ("i686-linux" "linuxx8632")
641 ("x86_64-linux" "linuxx8664")
642 ("armhf-linux" "linuxarm")
643 (_ (string-append "unknown system: " system)))))
644 (substitute* '("Makefile")
645 (("/bin/rm") "rm"))
646 (setenv "CC" "gcc")
647 (invoke "make" "clean")))
648 ;; XXX Do we need to recompile the heap image as well for Guix?
649 ;; For now just use the one we already got in the tarball.
650 (replace 'install
651 (lambda* (#:key outputs inputs system #:allow-other-keys)
652 ;; The lisp kernel built by running 'make' in lisp-kernel/$system
653 ;; is put back into the original directory, so go back. The heap
654 ;; image is there as well.
655 (chdir "../..")
656 (let* ((out (assoc-ref outputs "out"))
657 (libdir (string-append out "/lib/"))
658 (bindir (string-append out "/bin/"))
659 (wrapper (string-append bindir "ccl"))
660 (bash (assoc-ref inputs "bash"))
661 (kernel
662 (match system
663 ("i686-linux" "lx86cl")
664 ("x86_64-linux" "lx86cl64")
665 ("armhf-linux" "armcl")
666 ;; Unlikely to work, but try it anyway...
667 (_ system)))
668 (heap (string-append kernel ".image")))
669 (install-file kernel libdir)
670 (install-file heap libdir)
671
672 (let ((dirs `("lib" "library" "examples" "tools" "objc-bridge"
673 ,@(match system
674 ("x86_64-linux"
675 '("x86-headers64"))
676 ("i686-linux"
677 '("x86-headers"))
678 (_ '())))))
679 (for-each copy-recursively
680 dirs
681 (map (cut string-append libdir <>) dirs)))
682
683 (mkdir-p bindir)
684 (with-output-to-file wrapper
685 (lambda ()
686 (display
687 (string-append
688 "#!" bash "/bin/sh\n"
689 "export CCL_DEFAULT_DIRECTORY=" libdir "\n"
690 "exec -a \"$0\" " libdir kernel " \"$@\"\n"))))
691 (chmod wrapper #o755))
692 #t)))))
693 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
694 (home-page "https://ccl.clozure.com/")
695 (synopsis "Common Lisp implementation")
696 (description "Clozure CL (often called CCL for short) is a Common Lisp
697 implementation featuring fast compilation speed, native threads, a precise,
698 generational, compacting garbage collector, and a convenient foreign-function
699 interface.")
700 (license license:asl2.0)))
701
702 (define-public lush2
703 (package
704 (name "lush2")
705 (version "2.0.1")
706 (source
707 (origin
708 (method url-fetch)
709 (uri (string-append "mirror://sourceforge/lush/lush2/lush-"
710 version ".tar.gz"))
711 (modules '((guix build utils)))
712 (snippet
713 '(begin
714 (substitute* "src/unix.c"
715 (("\\{ \"LUSH_DATE\", __DATE__ \\},") "")
716 (("\\{ \"LUSH_TIME\", __TIME__ \\},") ""))
717 (substitute* "src/main.c"
718 (("\" \\(built \" __DATE__ \"\\)\"") ""))
719 #t))
720 (sha256
721 (base32
722 "02pkfn3nqdkm9fm44911dbcz0v3r0l53vygj8xigl6id5g3iwi4k"))))
723 (build-system gnu-build-system)
724 (arguments
725 `(;; We have to add these LIBS so that they are found.
726 #:configure-flags (list "LIBS=-lz"
727 "X_EXTRA_LIBS=-lfontconfig"
728 "--with-x")
729 #:tests? #f)) ; No make check.
730 (native-inputs `(("intltool" ,intltool)))
731 (inputs
732 `(("alsa-lib" ,alsa-lib)
733 ("sdl" ,sdl)
734 ("sdl-image" ,sdl-image)
735 ("sdl-mixer" ,sdl-mixer)
736 ("sdl-net" ,sdl-net)
737 ("sdl-ttf" ,sdl-ttf)
738 ("lapack" ,lapack)
739 ("libxft" ,libxft)
740 ("fontconfig" ,fontconfig)
741 ("gsl" ,gsl)
742 ("openblas" ,openblas)
743 ("glu" ,glu)
744 ("mesa" ,mesa)
745 ("mesa-utils" ,mesa-utils)
746 ("binutils" ,binutils)
747 ("libiberty" ,libiberty)
748 ("readline" ,readline)
749 ("zlib" ,zlib)
750 ("gettext-minimal" ,gettext-minimal)))
751 (synopsis "Lisp Universal Shell")
752 (description
753 "Lush is an object-oriented Lisp interpreter/compiler with features
754 designed to please people who want to prototype large numerical
755 applications. Lush includes an extensive library of
756 vector/matrix/tensor manipulation, numerous numerical libraries
757 (including GSL, LAPACK, and BLAS), a set of graphic functions, a
758 simple GUI toolkit, and interfaces to various graphic and multimedia
759 libraries such as OpenGL, SDL, Video4Linux, and ALSA (video/audio
760 grabbing), and others. Lush is an ideal frontend script language for
761 programming projects written in C or other languages. Lush also has
762 libraries for Machine Learning, Neural Nets and statistical estimation.")
763 (home-page "http://lush.sourceforge.net/")
764 (license license:lgpl2.1+)))
765
766 (define-public confusion-mdl
767 (let* ((commit "12a055581fc262225272df43287dae48281900f5"))
768 (package
769 (name "confusion-mdl")
770 (version "0.2")
771 (source (origin
772 (method git-fetch)
773 (uri (git-reference
774 (url (string-append "https://gitlab.com/emacsomancer/" name))
775 (commit commit)))
776 (sha256
777 (base32
778 "1zi8kflzvwqg97ha1sa5xjisbjs5z1mvbpa772vfxiv5ksnpxp0d"))
779 (file-name (git-file-name name version))))
780 (build-system gnu-build-system)
781 (arguments
782 `(#:tests? #f ; there are no tests
783 #:phases
784 (modify-phases %standard-phases
785 (delete 'configure)
786 (replace 'build
787 (lambda* (#:key (make-flags '()) #:allow-other-keys)
788 (apply invoke "make" "CC=gcc" make-flags)))
789 (replace 'install
790 (lambda* (#:key outputs #:allow-other-keys)
791 (let* ((out (assoc-ref outputs "out"))
792 (bin (string-append out "/bin")))
793 (install-file "mdli" bin)
794 #t))))))
795 (native-inputs
796 `(("perl" ,perl)))
797 (inputs
798 `(("libgc" ,libgc)))
799 (synopsis "Interpreter for the MIT Design Language (MDL)")
800 (description "MDL (the MIT Design Language) is a descendant of Lisp. It
801 was originally developed in 1971 on the PDP-10 computer under the Incompatible
802 Timesharing System (ITS) to provide high level language support for the
803 Dynamic Modeling Group at MIT's Project MAC. Infocom built the original
804 PDP-10 Zork in MDL and their later ZIL (Zork Implementation Language) was
805 based on a subset of MDL. Confusion is a MDL interpreter that works just well
806 enough to play the original mainframe Zork all the way through.")
807 (home-page "http://www.russotto.net/git/mrussotto/confusion/src/master/src/README")
808 (license license:gpl3+))))
809
810 (define-public txr
811 (package
812 (name "txr")
813 (version "244")
814 (source
815 (origin
816 (method git-fetch)
817 (uri (git-reference
818 (url "http://www.kylheku.com/git/txr/")
819 (commit (string-append "txr-" version))))
820 (file-name (git-file-name name version))
821 (sha256
822 (base32 "1bzhb1pms6gjzphbsimhwdyq46ik1m7sgldigg5l1q7bppg9r3i0"))))
823 (build-system gnu-build-system)
824 (arguments
825 `(#:configure-flags
826 (list ,(string-append "cc=" (cc-for-target))
827 (string-append "--prefix=" (assoc-ref %outputs "out")))
828 #:test-target "tests"
829 #:phases
830 (modify-phases %standard-phases
831 (replace 'configure
832 ;; ./configure is a hand-written script that can't handle standard
833 ;; autotools arguments like CONFIG_SHELL.
834 (lambda* (#:key configure-flags #:allow-other-keys)
835 (setenv "txr_shell" (which "bash"))
836 (apply invoke "./configure" configure-flags)
837 #t))
838 (add-after 'configure 'fix-tests
839 (lambda _
840 (substitute* (list "tests/017/realpath.tl"
841 "tests/017/realpath.expected")
842 (("/usr/bin") "/"))
843 #t)))))
844 (inputs
845 `(("libffi" ,libffi)))
846 (synopsis "General-purpose, multi-paradigm programming language")
847 (description
848 "TXR is a general-purpose, multi-paradigm programming language. It
849 comprises two languages integrated into a single tool: a text scanning and
850 extraction language referred to as the TXR Pattern Language (sometimes just
851 \"TXR\"), and a general-purpose dialect of Lisp called TXR Lisp. TXR can be
852 used for everything from \"one liner\" data transformation tasks at the
853 command line, to data scanning and extracting scripts, to full application
854 development in a wide-range of areas.")
855 (home-page "https://nongnu.org/txr/")
856 (license license:bsd-2)))
857
858 (define picolisp32
859 (package
860 (name "picolisp32")
861 (version "19.12")
862 (source
863 (origin
864 (method url-fetch)
865 (uri (string-append "https://software-lab.de/picoLisp-" version ".tgz"))
866 (sha256
867 (base32 "10np0mhihr47r3201617zccrvzpkhdl1jwvz7zimk8kxpriydq2j"))
868 (modules '((guix build utils)))
869 (snippet '(begin
870 ;; Delete the pre-compiled jar file.
871 (delete-file "ersatz/picolisp.jar")
872 #t))))
873 (build-system gnu-build-system)
874 (inputs
875 `(("openssl" ,openssl)))
876 (arguments
877 `(#:system ,(match (%current-system)
878 ((or "armhf-linux" "aarch64-linux")
879 "armhf-linux")
880 (_
881 "i686-linux"))
882 #:phases
883 (modify-phases %standard-phases
884 (delete 'configure)
885 (add-after 'unpack 'fix-paths
886 (lambda* (#:key outputs #:allow-other-keys)
887 (let* ((out (assoc-ref outputs "out"))
888 (shebang-line (string-append
889 "#!" out "/bin/picolisp "
890 out "/lib/picolisp/lib.l")))
891 (substitute* '("bin/pil"
892 "bin/pilIndent"
893 "bin/pilPretty"
894 "bin/psh"
895 "bin/replica"
896 "bin/vip"
897 "bin/watchdog"
898 "games/xchess"
899 "misc/bigtest"
900 "misc/calc"
901 "misc/chat"
902 "misc/mailing"
903 "src/mkVers")
904 (("#\\!bin/picolisp lib.l")
905 shebang-line)
906 (("#\\!\\.\\./bin/picolisp \\.\\./lib.l")
907 shebang-line)
908 (("#\\!/usr/bin/picolisp /usr/lib/picolisp/lib.l")
909 shebang-line)))
910 #t))
911 (add-after 'fix-paths 'make-build-reproducible
912 (lambda _
913 (substitute* "src64/lib/asm.l"
914 (("\\(prinl \"/\\* \" \\(datSym \\(date\\)\\) \" \\*/\\)")
915 ""))
916 #t))
917 (add-after 'make-build-reproducible 'fix-permissions
918 (lambda _
919 (for-each make-file-writable
920 '("doc/family.tgz"
921 "doc/family64.tgz"
922 "lib/map"
923 "src64/tags"))
924 #t))
925 (replace 'build
926 (lambda _
927 (invoke "make" "-C" "src" "picolisp" "tools" "gate")))
928 (add-before 'check 'set-home-for-tests
929 (lambda _
930 (setenv "HOME" "/tmp")
931 #t))
932 (replace 'check
933 (lambda _
934 (invoke "./pil" "test/lib.l" "-bye" "+")))
935 (replace 'install
936 (lambda* (#:key outputs #:allow-other-keys)
937 (let* ((out (assoc-ref outputs "out"))
938 (bin (string-append out "/bin"))
939 (man (string-append out "/share/man"))
940 (picolisp (string-append out "/lib/picolisp")))
941 (copy-recursively "man" man)
942 (copy-recursively "." picolisp)
943 (for-each (lambda (name)
944 (let ((path (string-append picolisp "/" name)))
945 (delete-file-recursively path)))
946 '("CHANGES" "COPYING" "CREDITS" "cygwin"
947 "INSTALL" "man" "pil" "README" "src" "src64"
948 "test"))
949 (mkdir-p bin)
950 (symlink (string-append picolisp "/bin/picolisp")
951 (string-append bin "/picolisp"))
952 (symlink (string-append picolisp "/bin/pil")
953 (string-append bin "/pil")))
954 #t)))))
955 (synopsis "Interpreter for the PicoLisp programming language")
956 (description
957 "PicoLisp is a programming language, or really a programming system,
958 including a built-in database engine and a GUI system.")
959 (home-page "https://picolisp.com/wiki/?home")
960 (license license:expat)))
961
962 (define-public picolisp
963 (match (%current-system)
964 ((or "aarch64-linux" "x86_64-linux")
965 (package
966 ;; Use the 32-bit picolisp to generate the assembly files required by
967 ;; the 64-bit picolisp.
968 (inherit picolisp32)
969 (name "picolisp")
970 (native-inputs
971 `(("picolisp32" ,picolisp32)
972 ("which" ,which)))
973 (arguments
974 (substitute-keyword-arguments (package-arguments picolisp32)
975 ((#:system _ "") (%current-system))
976 ((#:phases phases)
977 `(modify-phases ,phases
978 (delete 'fix-paths)
979 (add-before 'build 'fix-paths
980 ;; This must run after the other shebang-patching phases,
981 ;; or they will override our changes.
982 (lambda* (#:key inputs outputs #:allow-other-keys)
983 (let* ((picolisp32 (assoc-ref inputs "picolisp32"))
984 (out (assoc-ref outputs "out"))
985 (shebang-line (string-append
986 "#!" out "/bin/picolisp "
987 out "/lib/picolisp/lib.l")))
988 (substitute* '("bin/pil"
989 "bin/pilIndent"
990 "bin/pilPretty"
991 "bin/psh"
992 "bin/replica"
993 "bin/vip"
994 "bin/watchdog"
995 "games/xchess"
996 "misc/bigtest"
997 "misc/calc"
998 "misc/chat"
999 "misc/mailing"
1000 "src/mkVers")
1001 (("#\\!.*picolisp32.*/bin/picolisp .*lib\\.l")
1002 shebang-line))
1003 (substitute* "src64/mkAsm"
1004 (("/usr/bin/")
1005 (string-append picolisp32 "/bin/"))))
1006 #t))
1007 (replace 'build
1008 (lambda _
1009 (invoke "make" "-C" "src" "tools" "gate")
1010 (invoke "make" "-C" "src64" "CC=gcc" "picolisp")))))))))
1011 (_
1012 (package
1013 (inherit picolisp32)
1014 (name "picolisp")))))
1015
1016 (define-public janet
1017 (package
1018 (name "janet")
1019 (version "1.12.2")
1020 (source
1021 (origin
1022 (method git-fetch)
1023 (uri (git-reference
1024 (url "https://github.com/janet-lang/janet")
1025 (commit (string-append "v" version))))
1026 (file-name (git-file-name name version))
1027 (sha256
1028 (base32 "0if514zdmbjvvrsa9x5yfvg2b14sz53yaka12g3yhwkq8ls3qk0c"))))
1029 (build-system gnu-build-system)
1030 (arguments
1031 `(#:make-flags (list
1032 (string-append "DESTDIR=" (assoc-ref %outputs "out"))
1033 (string-append "PREFIX=")
1034 (string-append "CC=" (assoc-ref %build-inputs "gcc")
1035 "/bin/gcc"))
1036 #:phases
1037 (modify-phases %standard-phases
1038 (delete 'configure)
1039 (replace 'check
1040 (lambda _
1041 (invoke "make" "test"))))))
1042 (home-page "https://janet-lang.org/")
1043 (synopsis "Functional, imperative and embeddable programming language")
1044 (description
1045 "Janet is a functional and imperative programming language. It can be
1046 used for rapid prototyping, dynamic systems, and other domains where dynamic
1047 languages shine. You can also add Janet scripting to an application by
1048 embedding a single C file and two headers. It can be easily ported to new
1049 platforms. The entire language (core library, interpreter, compiler,
1050 assembler, PEG) is less than 1MB.")
1051 (license license:expat)))
1052
1053 (define-public lisp-repl-core-dumper
1054 (package
1055 (name "lisp-repl-core-dumper")
1056 (version "0.3.0")
1057 (source
1058 (origin
1059 (method git-fetch)
1060 (uri (git-reference
1061 (url "https://gitlab.com/ambrevar/lisp-repl-core-dumper.git")
1062 (commit version)))
1063 (file-name (git-file-name name version))
1064 (sha256
1065 (base32 "1w7x7d7bnrdj0bd04vnjy7d7sngvcx1yjr4iw429hdd9lzlg8rbg"))))
1066 (build-system copy-build-system)
1067 (arguments
1068 '(#:install-plan
1069 '(("lisp-repl-core-dumper" "bin/"))
1070 #:phases
1071 (modify-phases %standard-phases
1072 (add-before 'install 'fix-utils-path
1073 (lambda* (#:key inputs #:allow-other-keys)
1074 (let* ((coreutils (string-append (assoc-ref inputs "coreutils") "/bin/"))
1075 (paste (string-append coreutils "paste"))
1076 (sort (string-append coreutils "sort"))
1077 (basename (string-append coreutils "basename"))
1078 (sed (string-append (assoc-ref inputs "sed") "/bin/sed")))
1079 (substitute* "lisp-repl-core-dumper"
1080 (("\\$\\(basename") (string-append "$(" basename))
1081 (("\\<paste\\>") paste)
1082 (("\\<sed\\>") sed)
1083 (("\\<sort\\>") sort))))))))
1084 (inputs
1085 `(("coreutils" ,coreutils-minimal)
1086 ("sed" ,sed)))
1087 (home-page "https://gitlab.com/ambrevar/lisp-repl-core-dumper")
1088 (synopsis "Generate REPL-optimized Lisp cores on demand")
1089 (description
1090 "This tool generates Lisp images that can embed the provided systems
1091 and make for REPLs that start blazing fast.
1092
1093 @itemize
1094 @item It’s portable and should work with any compiler.
1095 @item It works for any REPL.
1096 @item It allows you to include arbitrary libraries.
1097 @end itemize\n")
1098 (license license:gpl3+)))