gnu: r-zoo: Update to 1.8-7.
[jackhill/guix/guix.git] / gnu / packages / lisp.scm
CommitLineData
f842bbed
JD
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 John Darrington <jmd@gnu.org>
00ab9458 3;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
e396976b 4;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
05f5ce0c 5;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
47956fa0 6;;; Copyright © 2016, 2017 ng0 <ng0@n0.is>
14afc7b8 7;;; Copyright © 2016, 2017 Andy Patterson <ajpatter@uwaterloo.ca>
e24ef369 8;;; Copyright © 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
040a7440 9;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
46c1c553 10;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
56c240ba 11;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
28e32b14 12;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
02b63821 13;;; Copyright © 2018, 2019 Pierre Neidhardt <mail@ambrevar.xyz>
c894b803 14;;; Copyright © 2018, 2019 Pierre Langlois <pierre.langlois@gmx.com>
5914489d 15;;; Copyright © 2019 Katherine Cox-Buday <cox.katherine.e@gmail.com>
29331827 16;;; Copyright © 2019 Jesse Gildersleve <jessejohngildersleve@protonmail.com>
e4c9ba4d 17;;; Copyright © 2019, 2020 Guillaume Le Vaillant <glv@posteo.net>
f842bbed
JD
18;;;
19;;; This file is part of GNU Guix.
20;;;
21;;; GNU Guix is free software; you can redistribute it and/or modify it
22;;; under the terms of the GNU General Public License as published by
23;;; the Free Software Foundation; either version 3 of the License, or (at
24;;; your option) any later version.
25;;;
26;;; GNU Guix is distributed in the hope that it will be useful, but
27;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29;;; GNU General Public License for more details.
30;;;
31;;; You should have received a copy of the GNU General Public License
32;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33
88f06fd0
PN
34;;; This file only contains Common Lisp compilers and tooling.
35;;; Common Lisp libraries go to lisp-xyz.scm.
36;;; Common Lisp applications should go to the most appropriate file,
37;;; e.g. StumpWM is in wm.scm.
38
f842bbed
JD
39(define-module (gnu packages lisp)
40 #:use-module (gnu packages)
b5b73a82 41 #:use-module ((guix licenses) #:prefix license:)
f842bbed 42 #:use-module (guix packages)
f842bbed 43 #:use-module (guix download)
423eef36 44 #:use-module (guix git-download)
f842bbed 45 #:use-module (guix utils)
00ab9458 46 #:use-module (guix build-system gnu)
28e32b14 47 #:use-module (guix build-system ant)
a72debb7 48 #:use-module (guix build-system asdf)
e3e171ee 49 #:use-module (guix build-system trivial)
5ff15b86 50 #:use-module (gnu packages admin)
ce0614dd 51 #:use-module (gnu packages base)
5ff15b86 52 #:use-module (gnu packages bdw-gc)
a0c3a2e3 53 #:use-module (gnu packages bison)
05c63898 54 #:use-module (gnu packages compression)
5ff15b86 55 #:use-module (gnu packages ed)
a0c3a2e3 56 #:use-module (gnu packages flex)
05c63898 57 #:use-module (gnu packages fontutils)
5ff15b86
EF
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)
05c63898 63 #:use-module (gnu packages maths)
00ab9458 64 #:use-module (gnu packages multiprecision)
f473b8f1 65 #:use-module (gnu packages ncurses)
560f51d0 66 #:use-module (gnu packages libffcall)
5ff15b86 67 #:use-module (gnu packages libffi)
b702b52d 68 #:use-module (gnu packages libsigsegv)
05c63898 69 #:use-module (gnu packages linux)
5ff15b86 70 #:use-module (gnu packages perl)
5ff15b86
EF
71 #:use-module (gnu packages readline)
72 #:use-module (gnu packages sdl)
73 #:use-module (gnu packages tex)
e4c9ba4d 74 #:use-module (gnu packages tls)
5ff15b86 75 #:use-module (gnu packages texinfo)
531a9aac 76 #:use-module (gnu packages version-control)
05c63898 77 #:use-module (gnu packages xorg)
88f06fd0 78 #:use-module (ice-9 match))
f842bbed 79
8d0489ae
AP
80(define (asdf-substitutions lisp)
81 ;; Prepend XDG_DATA_DIRS/LISP-bundle-systems to ASDF's
82 ;; 'default-system-source-registry'.
83 `((("\\(,dir \"systems/\"\\)\\)")
84 (format #f
85 "(,dir \"~a-bundle-systems\")))
86
87 ,@(loop :for dir :in (xdg-data-dirs \"common-lisp/\")
88 :collect `(:directory (,dir \"systems\"))"
89 ,lisp))))
90
f842bbed 91(define-public gcl
5a8b00f2
KK
92 (let ((commit "d3335e2b3deb63f930eb0328e9b05377744c9512")
93 (revision "2")) ;Guix package revision
dd0134fc
KK
94 (package
95 (name "gcl")
96 (version (string-append "2.6.12-" revision "."
97 (string-take commit 7)))
98 (source
99 (origin
100 (method git-fetch)
101 (uri (git-reference
102 (url "https://git.savannah.gnu.org/r/gcl.git")
103 (commit commit)))
104 (file-name (string-append "gcl-" version "-checkout"))
105 (sha256
5a8b00f2 106 (base32 "05v86lhvsby05nzvcd3c4k0wljvgdgd0i6arzd2fx1yd67dl6fgj"))))
dd0134fc
KK
107 (build-system gnu-build-system)
108 (arguments
109 `(#:parallel-build? #f ; The build system seems not to be thread safe.
b888396d 110 #:test-target "ansi-tests/test_results"
dd0134fc
KK
111 #:configure-flags '("--enable-ansi") ; required for use by the maxima package
112 #:make-flags (list
113 (string-append "GCL_CC=" (assoc-ref %build-inputs "gcc")
114 "/bin/gcc")
115 (string-append "CC=" (assoc-ref %build-inputs "gcc")
116 "/bin/gcc"))
117 #:phases
118 (modify-phases %standard-phases
119 (add-before 'configure 'pre-conf
120 (lambda* (#:key inputs #:allow-other-keys)
121 (chdir "gcl")
122 (substitute*
123 (append
124 '("pcl/impl/kcl/makefile.akcl"
125 "add-defs"
126 "unixport/makefile.dos"
127 "add-defs.bat"
128 "gcl-tk/makefile.prev"
129 "add-defs1")
130 (find-files "h" "\\.defs"))
131 (("SHELL=/bin/bash")
132 (string-append "SHELL=" (which "bash")))
133 (("SHELL=/bin/sh")
134 (string-append "SHELL=" (which "sh"))))
135 (substitute* "h/linux.defs"
136 (("#CC") "CC")
137 (("-fwritable-strings") "")
138 (("-Werror") ""))
139 (substitute* "lsp/gcl_top.lsp"
140 (("\"cc\"")
141 (string-append "\"" (assoc-ref %build-inputs "gcc")
142 "/bin/gcc\""))
143 (("\\(or \\(get-path \\*cc\\*\\) \\*cc\\*\\)") "*cc*")
144 (("\"ld\"")
145 (string-append "\"" (assoc-ref %build-inputs "binutils")
146 "/bin/ld\""))
147 (("\\(or \\(get-path \\*ld\\*\\) \\*ld\\*\\)") "*ld*")
148 (("\\(get-path \"objdump --source \"\\)")
149 (string-append "\"" (assoc-ref %build-inputs "binutils")
150 "/bin/objdump --source \"")))
151 #t))
152 (add-after 'install 'wrap
153 (lambda* (#:key inputs outputs #:allow-other-keys)
154 (let* ((gcl (assoc-ref outputs "out"))
155 (input-path (lambda (lib path)
156 (string-append
157 (assoc-ref inputs lib) path)))
158 (binaries '("binutils")))
159 ;; GCC and the GNU binutils are necessary for GCL to be
160 ;; able to compile Lisp functions and programs (this is
161 ;; a standard feature in Common Lisp). While the
162 ;; the location of GCC is specified in the make-flags,
163 ;; the GNU binutils must be available in GCL's $PATH.
164 (wrap-program (string-append gcl "/bin/gcl")
165 `("PATH" prefix ,(map (lambda (binary)
166 (input-path binary "/bin"))
167 binaries))))
168 #t))
169 ;; drop strip phase to make maxima build, see
170 ;; https://www.ma.utexas.edu/pipermail/maxima/2008/009769.html
171 (delete 'strip))))
172 (inputs
173 `(("gmp" ,gmp)
174 ("readline" ,readline)))
175 (native-inputs
978154ae 176 `(("m4" ,m4)
27ebd5c4 177 ("texinfo" ,texinfo)))
dd0134fc
KK
178 (home-page "https://www.gnu.org/software/gcl/")
179 (synopsis "A Common Lisp implementation")
180 (description "GCL is an implementation of the Common Lisp language. It
f842bbed
JD
181features the ability to compile to native object code and to load native
182object code modules directly into its lisp core. It also features a
183stratified garbage collection strategy, a source-level debugger and a built-in
184interface to the Tk widget system.")
dd0134fc 185 (license license:lgpl2.0+))))
f842bbed 186
00ab9458
TUBK
187(define-public ecl
188 (package
189 (name "ecl")
108f69c4 190 (version "16.1.3")
00ab9458
TUBK
191 (source
192 (origin
193 (method url-fetch)
e0524511
AP
194 (uri (string-append
195 "https://common-lisp.net/project/ecl/static/files/release/"
196 name "-" version ".tgz"))
00ab9458 197 (sha256
108f69c4 198 (base32 "0m0j24w5d5a9dwwqyrg0d35c0nys16ijb4r0nyk87yp82v38b9bn"))
fb7dc6d6
AP
199 (modules '((guix build utils)))
200 (snippet
201 ;; Add ecl-bundle-systems to 'default-system-source-registry'.
6cbee49d
MW
202 `(begin
203 (substitute* "contrib/asdf/asdf.lisp"
204 ,@(asdf-substitutions name))
205 #t))))
00ab9458 206 (build-system gnu-build-system)
cb03a9b6 207 ;; src/configure uses 'which' to confirm the existence of 'gzip'.
00ab9458
TUBK
208 (native-inputs `(("which" ,which)))
209 (inputs `(("gmp" ,gmp)
210 ("libatomic-ops" ,libatomic-ops)
211 ("libgc" ,libgc)
212 ("libffi" ,libffi)))
213 (arguments
fd0f8860
GLV
214 '(#:configure-flags '("--without-rt")
215 #:tests? #t
60474cd1
AP
216 #:parallel-tests? #f
217 #:phases
218 (modify-phases %standard-phases
219 (delete 'check)
54a43ff4
AP
220 (add-after 'install 'wrap
221 (lambda* (#:key inputs outputs #:allow-other-keys)
222 (let* ((ecl (assoc-ref outputs "out"))
223 (input-path (lambda (lib path)
224 (string-append
225 (assoc-ref inputs lib) path)))
226 (libraries '("gmp" "libatomic-ops" "libgc" "libffi" "libc"))
227 (binaries '("gcc" "ld-wrapper" "binutils"))
228 (library-directories
229 (map (lambda (lib) (input-path lib "/lib"))
230 libraries)))
231
232 (wrap-program (string-append ecl "/bin/ecl")
233 `("PATH" prefix
234 ,(map (lambda (binary)
235 (input-path binary "/bin"))
236 binaries))
237 `("CPATH" suffix
238 ,(map (lambda (lib)
239 (input-path lib "/include"))
932b2ea2 240 `("kernel-headers" ,@libraries)))
54a43ff4
AP
241 `("LIBRARY_PATH" suffix ,library-directories)
242 `("LD_LIBRARY_PATH" suffix ,library-directories)))))
108f69c4
AP
243 (add-after 'wrap 'check (assoc-ref %standard-phases 'check))
244 (add-before 'check 'fix-path-to-ecl
245 (lambda _
246 (substitute* "build/tests/Makefile"
247 (("\\$\\{exec_prefix\\}/") ""))
248 #t)))))
fb7dc6d6
AP
249 (native-search-paths
250 (list (search-path-specification
251 (variable "XDG_DATA_DIRS")
252 (files '("share")))))
00ab9458
TUBK
253 (home-page "http://ecls.sourceforge.net/")
254 (synopsis "Embeddable Common Lisp")
255 (description "ECL is an implementation of the Common Lisp language as
256defined by the ANSI X3J13 specification. Its most relevant features are: a
257bytecode compiler and interpreter, being able to compile Common Lisp with any
258C/C++ compiler, being able to build standalone executables and libraries, and
259supporting ASDF, Sockets, Gray streams, MOP, and other useful components.")
260 ;; Note that the file "Copyright" points to some files and directories
261 ;; which aren't under the lgpl2.0+ and instead contain many different,
262 ;; non-copyleft licenses.
263 (license license:lgpl2.0+)))
560f51d0
TUBK
264
265(define-public clisp
266 (package
267 (name "clisp")
e4c399fe 268 (version "2.49-92")
560f51d0
TUBK
269 (source
270 (origin
e4c399fe
EF
271 (method git-fetch)
272 (uri (git-reference
273 (url "https://gitlab.com/gnu-clisp/clisp")
274 (commit "clisp-2.49.92-2018-02-18")))
275 (file-name (git-file-name name version))
560f51d0 276 (sha256
e4c399fe
EF
277 (base32 "0k2dmgl0miz3767iks4p0mvp6xw0ysyxhjpklyh11j010rmh6hqb"))
278 (patches (search-patches "clisp-remove-failing-test.patch"))))
560f51d0
TUBK
279 (build-system gnu-build-system)
280 (inputs `(("libffcall" ,libffcall)
f473b8f1
EF
281 ("ncurses" ,ncurses)
282 ("readline" ,readline)
560f51d0
TUBK
283 ("libsigsegv" ,libsigsegv)))
284 (arguments
e4c399fe
EF
285 `(#:configure-flags '(,@(if (string-prefix? "armhf-linux"
286 (or (%current-system)
287 (%current-target-system)))
288 '("CFLAGS=-falign-functions=4")
289 '())
290 "--with-dynamic-ffi"
291 "--with-dynamic-modules"
292 "--with-module=rawsock")
f90ef3c3
MW
293 #:build #f
294 #:phases
636c77d0
RW
295 (modify-phases %standard-phases
296 (add-after 'unpack 'patch-sh-and-pwd
297 (lambda _
298 ;; The package is very messy with its references to "/bin/sh" and
299 ;; some other absolute paths to traditional tools. These appear in
300 ;; many places where our automatic patching misses them. Therefore
301 ;; we do the following, in this early (post-unpack) phase, to solve
302 ;; the problem from its root.
e4c399fe
EF
303 (substitute* '("src/clisp-link.in"
304 "src/unix.d"
305 "src/makemake.in")
306 (("/bin/sh") (which "sh")))
636c77d0
RW
307 (substitute* (find-files "." "configure|Makefile")
308 (("/bin/sh") "sh"))
309 (substitute* '("src/clisp-link.in")
310 (("/bin/pwd") "pwd"))
636c77d0 311 #t)))
560f51d0
TUBK
312 ;; Makefiles seem to have race conditions.
313 #:parallel-build? #f))
e4c399fe 314 (home-page "https://clisp.sourceforge.io/")
4cc78cb3
LC
315 (synopsis "A Common Lisp implementation")
316 (description
317 "GNU CLISP is an implementation of ANSI Common Lisp. Common Lisp is a
318high-level, object-oriented functional programming language. CLISP includes
319an interpreter, a compiler, a debugger, and much more.")
4bd2e2a5 320 (license license:gpl2+)))
b702b52d 321
cfff8ebc 322(define-public sbcl
b702b52d 323 (package
cfff8ebc 324 (name "sbcl")
10a8fb47 325 (version "2.0.0")
b702b52d
TUBK
326 (source
327 (origin
328 (method url-fetch)
329 (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-"
330 version "-source.tar.bz2"))
331 (sha256
10a8fb47 332 (base32 "1krgd69cirp4ili2pfsh1a0mfvq722jbknlvmf17qhsxh1b94dlh"))
8d0489ae
AP
333 (modules '((guix build utils)))
334 (snippet
335 ;; Add sbcl-bundle-systems to 'default-system-source-registry'.
6cbee49d
MW
336 `(begin
337 (substitute* "contrib/asdf/asdf.lisp"
338 ,@(asdf-substitutions name))
339 #t))))
b702b52d 340 (build-system gnu-build-system)
05f5ce0c 341 (outputs '("out" "doc"))
b702b52d 342 (native-inputs
4bddcae9
PN
343 ;; From INSTALL:
344 ;; Supported build hosts are:
345 ;; SBCL
346 ;; CMUCL
347 ;; CCL (formerly known as OpenMCL)
348 ;; ABCL (recent versions only)
349 ;; CLISP (only some versions: 2.44.1 is OK, 2.47 is not)
350 ;; XCL
a3439b0c
PN
351 ;;
352 ;; From NEWS:
353 ;; * build enhancement: new host quirks mechanism, support for building under
354 ;; ABCL and ECL (as well as CCL, CMUCL, CLISP and SBCL itself)
355 ;;
356 ;; CCL is not bootstrappable so it won't do. CLISP 2.49 seems to work.
357 ;; ECL too. ECL builds SBCL about 20% slower than CLISP. As of
02b63821 358 ;; 2019-09-05, ECL was last updated in 2016 while CLISP was last updated
a3439b0c
PN
359 ;; in 2010.
360 ;;
cfff8ebc
PN
361 ;; For now we stick to CLISP for all systems. We keep the `match' here to
362 ;; make it easier to change the host compiler for various architectures.
363 `(,@(match (%current-system)
364 ((or "x86_64-linux" "i686-linux")
365 `(("clisp" ,clisp)))
366 (_
367 `(("clisp" ,clisp))))
b702b52d
TUBK
368 ("which" ,which)
369 ("inetutils" ,inetutils) ;for hostname(1)
05f5ce0c 370 ("ed" ,ed)
4bddcae9 371 ("texlive" ,(texlive-union (list texlive-tex-texinfo)))
5c8b9a43
PN
372 ("texinfo" ,texinfo)
373 ("zlib" ,zlib)))
b702b52d 374 (arguments
76d520fa 375 `(#:modules ((guix build gnu-build-system)
f0b7dc7e
ST
376 (guix build utils)
377 (srfi srfi-1))
378 #:phases
1ee131df
FB
379 (modify-phases %standard-phases
380 (delete 'configure)
381 (add-before 'build 'patch-unix-tool-paths
382 (lambda* (#:key outputs inputs #:allow-other-keys)
383 (let ((out (assoc-ref outputs "out"))
384 (bash (assoc-ref inputs "bash"))
385 (coreutils (assoc-ref inputs "coreutils"))
386 (ed (assoc-ref inputs "ed")))
387 (define (quoted-path input path)
388 (string-append "\"" input path "\""))
389 ;; Patch absolute paths in string literals. Note that this
390 ;; occurs in some .sh files too (which contain Lisp code). Use
391 ;; ISO-8859-1 because some of the files are ISO-8859-1 encoded.
392 (with-fluids ((%default-port-encoding #f))
1925a879
AP
393 ;; The removed file is utf-16-be encoded, which gives substitute*
394 ;; trouble. It does not contain references to the listed programs.
395 (substitute* (delete
396 "./tests/data/compile-file-pos-utf16be.lisp"
397 (find-files "." "\\.(lisp|sh)$"))
1ee131df
FB
398 (("\"/bin/sh\"") (quoted-path bash "/bin/sh"))
399 (("\"/usr/bin/env\"") (quoted-path coreutils "/usr/bin/env"))
400 (("\"/bin/cat\"") (quoted-path coreutils "/bin/cat"))
401 (("\"/bin/ed\"") (quoted-path ed "/bin/ed"))
402 (("\"/bin/echo\"") (quoted-path coreutils "/bin/echo"))
403 (("\"/bin/uname\"") (quoted-path coreutils "/bin/uname"))))
404 ;; This one script has a non-string occurrence of /bin/sh.
405 (substitute* '("tests/foreign.test.sh")
406 ;; Leave whitespace so we don't match the shebang.
407 ((" /bin/sh ") " sh "))
408 ;; This file contains a module that can create executable files
409 ;; which depend on the presence of SBCL. It generates shell
410 ;; scripts doing "exec sbcl ..." to achieve this. We patch both
411 ;; the shebang and the reference to "sbcl", tying the generated
412 ;; executables to the exact SBCL package that generated them.
413 (substitute* '("contrib/sb-executable/sb-executable.lisp")
414 (("/bin/sh") (string-append bash "/bin/sh"))
415 (("exec sbcl") (string-append "exec " out "/bin/sbcl")))
416 ;; Disable some tests that fail in our build environment.
417 (substitute* '("contrib/sb-bsd-sockets/tests.lisp")
418 ;; This requires /etc/protocols.
419 (("\\(deftest get-protocol-by-name/error" all)
420 (string-append "#+nil ;disabled by Guix\n" all)))
421 (substitute* '("contrib/sb-posix/posix-tests.lisp")
422 ;; These assume some users/groups which we don't have.
423 (("\\(deftest pwent\\.[12]" all)
424 (string-append "#+nil ;disabled by Guix\n" all))
425 (("\\(deftest grent\\.[12]" all)
02b63821
PN
426 (string-append "#+nil ;disabled by Guix\n" all))))
427 #t))
4bddcae9
PN
428 ;; FIXME: the texlive-union insists on regenerating fonts. It stores
429 ;; them in HOME, so it needs to be writeable.
430 (add-before 'build 'set-HOME
431 (lambda _ (setenv "HOME" "/tmp") #t))
1ee131df
FB
432 (replace 'build
433 (lambda* (#:key outputs #:allow-other-keys)
434 (setenv "CC" "gcc")
cfff8ebc
PN
435 (invoke "sh" "make.sh" ,@(match (%current-system)
436 ((or "x86_64-linux" "i686-linux")
437 `("clisp"))
438 (_
439 `("clisp")))
4bddcae9 440 (string-append "--prefix="
5c8b9a43
PN
441 (assoc-ref outputs "out"))
442 "--with-sb-core-compression"
443 "--with-sb-xref-for-internals")))
1ee131df 444 (replace 'install
b702b52d 445 (lambda _
4bddcae9 446 (invoke "sh" "install.sh")))
05f5ce0c
FB
447 (add-after 'build 'build-doc
448 (lambda _
02b63821 449 ;; TODO: Doc is not deterministic, maybe there is a timespamp?
05f5ce0c 450 (with-directory-excursion "doc/manual"
4bddcae9
PN
451 (and (invoke "make" "info")
452 (invoke "make" "dist")))))
d0480ca1
PN
453 (add-after 'build 'build-source
454 (lambda* (#:key outputs #:allow-other-keys)
455 (let* ((out (assoc-ref outputs "out"))
456 (rc (string-append out "/lib/sbcl/sbclrc"))
457 (source-dir (string-append out "/share/sbcl")))
458 (for-each (lambda (p)
459 (copy-recursively p (string-append source-dir "/" p)))
460 '("src" "contrib"))
461 (mkdir-p (dirname rc))
462 (with-output-to-file rc
463 (lambda ()
464 (display
465 (string-append "(sb-ext:set-sbcl-source-location \""
466 source-dir "\")") )))
467 #t)))
05f5ce0c
FB
468 (add-after 'install 'install-doc
469 (lambda* (#:key outputs #:allow-other-keys)
470 (let* ((out (assoc-ref outputs "out"))
471 (doc (assoc-ref outputs "doc"))
472 (old-doc-dir (string-append out "/share/doc"))
473 (new-doc/sbcl-dir (string-append doc "/share/doc/sbcl")))
474 (rmdir (string-append old-doc-dir "/sbcl/html"))
475 (mkdir-p new-doc/sbcl-dir)
476 (copy-recursively (string-append old-doc-dir "/sbcl")
477 new-doc/sbcl-dir)
478 (delete-file-recursively old-doc-dir)
479 #t))))
1ee131df
FB
480 ;; No 'check' target, though "make.sh" (build phase) runs tests.
481 #:tests? #f))
8d0489ae
AP
482 (native-search-paths
483 (list (search-path-specification
484 (variable "XDG_DATA_DIRS")
485 (files '("share")))))
b702b52d
TUBK
486 (home-page "http://www.sbcl.org/")
487 (synopsis "Common Lisp implementation")
488 (description "Steel Bank Common Lisp (SBCL) is a high performance Common
489Lisp compiler. In addition to the compiler and runtime system for ANSI Common
490Lisp, it provides an interactive environment including a debugger, a
491statistical profiler, a code coverage tool, and many other extensions.")
492 ;; Public domain in jurisdictions that allow it, bsd-2 otherwise. MIT
493 ;; loop macro has its own license. See COPYING file for further notes.
494 (license (list license:public-domain license:bsd-2
495 (license:x11-style "file://src/code/loop.lisp")))))
531a9aac
TUBK
496
497(define-public ccl
a3439b0c
PN
498 ;; Warning: according to upstream, CCL is not bootstrappable.
499 ;; See https://github.com/Clozure/ccl/issues/222 from 2019-09-02:
500 ;;
501 ;; "As far as I know, there is no way to build CCL without an existing
502 ;; running CCL image. It was bootstrapped back in 1986 or so as
503 ;; Macintosh Common Lisp, by Gary Byers, I believe, who is no longer on
504 ;; the planet to tell us the story. It SHOULD be possible to port the
505 ;; CCL compiler to portable Common Lisp, so that ANY lisp could build
506 ;; it, as is the case for SBCL, but I know of no attempt to do so."
531a9aac
TUBK
507 (package
508 (name "ccl")
04ab38b7 509 (version "1.11.5")
531a9aac
TUBK
510 (source #f)
511 (build-system gnu-build-system)
512 ;; CCL consists of a "lisp kernel" and "heap image", both of which are
513 ;; shipped in precompiled form in source tarballs. The former is a C
514 ;; program which we can rebuild from scratch, but the latter cannot be
515 ;; generated without an already working copy of CCL, and is platform
516 ;; dependent, so we need to fetch the correct tarball for the platform.
517 (inputs
518 `(("ccl"
519 ,(origin
520 (method url-fetch)
521 (uri (string-append
04ab38b7 522 "https://github.com/Clozure/ccl/releases/download/v" version
3701f014 523 "/ccl-" version "-"
531a9aac
TUBK
524 (match (%current-system)
525 ((or "i686-linux" "x86_64-linux") "linuxx86")
42f11801
MW
526 ("armhf-linux" "linuxarm")
527 ;; Prevent errors when querying this package on unsupported
528 ;; platforms, e.g. when running "guix package --search="
529 (_ "UNSUPPORTED"))
531a9aac
TUBK
530 ".tar.gz"))
531 (sha256
532 (base32
533 (match (%current-system)
534 ((or "i686-linux" "x86_64-linux")
04ab38b7 535 "0hs1f3z7crgzvinpj990kv9gvbsipxvcvwbmk54n51nasvc5025q")
42f11801 536 ("armhf-linux"
04ab38b7 537 "0p0l1dzsygb6i1xxgbipjpxkn46xhq3jm41a34ga1qqp4x8lkr62")
42f11801 538 (_ ""))))))))
531a9aac
TUBK
539 (native-inputs
540 `(("m4" ,m4)
541 ("subversion" ,subversion)))
542 (arguments
543 `(#:tests? #f ;no 'check' target
fc7d5a34
AP
544 #:modules ((srfi srfi-26)
545 (guix build utils)
546 (guix build gnu-build-system))
531a9aac 547 #:phases
dc1d3cde
KK
548 (modify-phases %standard-phases
549 (replace 'unpack
550 (lambda* (#:key inputs #:allow-other-keys)
7d416066
RW
551 (invoke "tar" "xzvf" (assoc-ref inputs "ccl"))
552 (chdir "ccl")
553 #t))
dc1d3cde
KK
554 (delete 'configure)
555 (add-before 'build 'pre-build
556 ;; Enter the source directory for the current platform's lisp
557 ;; kernel, and run 'make clean' to remove the precompiled one.
558 (lambda _
bcc65510
EF
559 (substitute* "lisp-kernel/m4macros.m4"
560 (("/bin/pwd") (which "pwd")))
dc1d3cde
KK
561 (chdir (string-append
562 "lisp-kernel/"
563 ,(match (or (%current-target-system) (%current-system))
564 ("i686-linux" "linuxx8632")
565 ("x86_64-linux" "linuxx8664")
566 ("armhf-linux" "linuxarm")
567 ;; Prevent errors when querying this package
568 ;; on unsupported platforms, e.g. when running
569 ;; "guix package --search="
570 (_ "UNSUPPORTED"))))
571 (substitute* '("Makefile")
572 (("/bin/rm") "rm"))
573 (setenv "CC" "gcc")
7d416066 574 (invoke "make" "clean")))
dc1d3cde
KK
575 ;; XXX Do we need to recompile the heap image as well for Guix?
576 ;; For now just use the one we already got in the tarball.
577 (replace 'install
531a9aac
TUBK
578 (lambda* (#:key outputs inputs #:allow-other-keys)
579 ;; The lisp kernel built by running 'make' in lisp-kernel/$system
580 ;; is put back into the original directory, so go back. The heap
581 ;; image is there as well.
582 (chdir "../..")
583 (let* ((out (assoc-ref outputs "out"))
584 (libdir (string-append out "/lib/"))
585 (bindir (string-append out "/bin/"))
586 (wrapper (string-append bindir "ccl"))
587 (bash (assoc-ref inputs "bash"))
588 (kernel
589 ,(match (or (%current-target-system) (%current-system))
76eb7266 590 ("i686-linux" "lx86cl")
531a9aac 591 ("x86_64-linux" "lx86cl64")
76eb7266
MW
592 ("armhf-linux" "armcl")
593 ;; Prevent errors when querying this package
594 ;; on unsupported platforms, e.g. when running
595 ;; "guix package --search="
596 (_ "UNSUPPORTED")))
531a9aac 597 (heap (string-append kernel ".image")))
fc7d5a34
AP
598 (install-file kernel libdir)
599 (install-file heap libdir)
600
910ac0ef
PN
601 (let ((dirs '("lib" "library" "examples" "tools" "objc-bridge"
602 ,@(match (%current-system)
603 ("x86_64-linux"
604 '("x86-headers64"))
605 ("i686-linux"
606 '("x86-headers"))
607 (_ '())))))
fc7d5a34
AP
608 (for-each copy-recursively
609 dirs
610 (map (cut string-append libdir <>) dirs)))
611
531a9aac 612 (mkdir-p bindir)
531a9aac
TUBK
613 (with-output-to-file wrapper
614 (lambda ()
615 (display
616 (string-append
617 "#!" bash "/bin/sh\n"
eff8e0b4
PN
618 "export CCL_DEFAULT_DIRECTORY=" libdir "\n"
619 "exec -a \"$0\" " libdir kernel " \"$@\"\n"))))
dc1d3cde
KK
620 (chmod wrapper #o755))
621 #t)))))
531a9aac 622 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
910ac0ef 623 (home-page "https://ccl.clozure.com/")
531a9aac
TUBK
624 (synopsis "Common Lisp implementation")
625 (description "Clozure CL (often called CCL for short) is a Common Lisp
626implementation featuring fast compilation speed, native threads, a precise,
627generational, compacting garbage collector, and a convenient foreign-function
628interface.")
629 ;; See file doc/LICENSE for clarifications it makes regarding how the LGPL
630 ;; applies to Lisp code according to them.
631 (license (list license:lgpl2.1
632 license:clarified-artistic)))) ;TRIVIAL-LDAP package
423eef36 633
05c63898 634(define-public lush2
635 (package
636 (name "lush2")
637 (version "2.0.1")
638 (source
639 (origin
640 (method url-fetch)
641 (uri (string-append "mirror://sourceforge/lush/lush2/lush-"
642 version ".tar.gz"))
643 (modules '((guix build utils)))
644 (snippet
645 '(begin
646 (substitute* "src/unix.c"
6cbee49d
MW
647 (("\\{ \"LUSH_DATE\", __DATE__ \\},") "")
648 (("\\{ \"LUSH_TIME\", __TIME__ \\},") ""))
649 (substitute* "src/main.c"
650 (("\" \\(built \" __DATE__ \"\\)\"") ""))
651 #t))
05c63898 652 (sha256
653 (base32
654 "02pkfn3nqdkm9fm44911dbcz0v3r0l53vygj8xigl6id5g3iwi4k"))))
655 (build-system gnu-build-system)
656 (arguments
657 `(;; We have to add these LIBS so that they are found.
658 #:configure-flags (list "LIBS=-lz"
659 "X_EXTRA_LIBS=-lfontconfig"
660 "--with-x")
661 #:tests? #f)) ; No make check.
662 (native-inputs `(("intltool" ,intltool)))
663 (inputs
664 `(("alsa-lib" ,alsa-lib)
665 ("sdl" ,sdl)
666 ("sdl-image" ,sdl-image)
667 ("sdl-mixer" ,sdl-mixer)
668 ("sdl-net" ,sdl-net)
669 ("sdl-ttf" ,sdl-ttf)
670 ("lapack" ,lapack)
671 ("libxft" ,libxft)
672 ("fontconfig" ,fontconfig)
673 ("gsl" ,gsl)
674 ("openblas" ,openblas)
675 ("glu" ,glu)
676 ("mesa" ,mesa)
677 ("mesa-utils" ,mesa-utils)
678 ("binutils" ,binutils)
679 ("libiberty" ,libiberty)
680 ("readline" ,readline)
681 ("zlib" ,zlib)
682 ("gettext-minimal" ,gettext-minimal)))
683 (synopsis "Lisp Universal Shell")
684 (description
685 "Lush is an object-oriented Lisp interpreter/compiler with features
686designed to please people who want to prototype large numerical
687applications. Lush includes an extensive library of
688vector/matrix/tensor manipulation, numerous numerical libraries
689(including GSL, LAPACK, and BLAS), a set of graphic functions, a
690simple GUI toolkit, and interfaces to various graphic and multimedia
691libraries such as OpenGL, SDL, Video4Linux, and ALSA (video/audio
692grabbing), and others. Lush is an ideal frontend script language for
693programming projects written in C or other languages. Lush also has
694libraries for Machine Learning, Neural Nets and statistical estimation.")
695 (home-page "http://lush.sourceforge.net/")
696 (license license:lgpl2.1+)))
697
56c240ba
LC
698(define-public confusion-mdl
699 (let* ((commit "12a055581fc262225272df43287dae48281900f5"))
700 (package
701 (name "confusion-mdl")
702 (version "0.2")
703 (source (origin
704 (method git-fetch)
705 (uri (git-reference
706 (url (string-append "https://gitlab.com/emacsomancer/" name))
707 (commit commit)))
708 (sha256
709 (base32
710 "1zi8kflzvwqg97ha1sa5xjisbjs5z1mvbpa772vfxiv5ksnpxp0d"))
711 (file-name (git-file-name name version))))
712 (build-system gnu-build-system)
713 (arguments
714 `(#:tests? #f ; there are no tests
715 #:phases
716 (modify-phases %standard-phases
717 (delete 'configure)
718 (replace 'build
719 (lambda* (#:key (make-flags '()) #:allow-other-keys)
720 (apply invoke "make" "CC=gcc" make-flags)))
721 (replace 'install
722 (lambda* (#:key outputs #:allow-other-keys)
723 (let* ((out (assoc-ref outputs "out"))
724 (bin (string-append out "/bin")))
725 (install-file "mdli" bin)
726 #t))))))
727 (native-inputs
728 `(("perl" ,perl)))
729 (inputs
730 `(("libgc" ,libgc)))
731 (synopsis "Interpreter for the MIT Design Language (MDL)")
732 (description "MDL (the MIT Design Language) is a descendant of Lisp. It
733was originally developed in 1971 on the PDP-10 computer under the Incompatible
734Timesharing System (ITS) to provide high level language support for the
735Dynamic Modeling Group at MIT's Project MAC. Infocom built the original
736PDP-10 Zork in MDL and their later ZIL (Zork Implementation Language) was
737based on a subset of MDL. Confusion is a MDL interpreter that works just well
738enough to play the original mainframe Zork all the way through.")
739 (home-page "http://www.russotto.net/git/mrussotto/confusion/src/master/src/README")
740 (license license:gpl3+))))
99c61242 741
88f06fd0 742(define-public txr
d9544d91 743 (package
88f06fd0 744 (name "txr")
92fcf985 745 (version "230")
d9544d91
TGR
746 (source
747 (origin
748 (method git-fetch)
749 (uri (git-reference
88f06fd0
PN
750 (url "http://www.kylheku.com/git/txr/")
751 (commit (string-append "txr-" version))))
d9544d91 752 (file-name (git-file-name name version))
88f06fd0 753 (patches (search-patches "txr-shell.patch"))
ed0ddadc
GLV
754 (sha256
755 (base32
92fcf985 756 "1ma6nbqsnl4f8ndh47zzc8n5vzcny66v0z3ndddgm3g0bqaxzjzm"))))
88f06fd0 757 (build-system gnu-build-system)
d9544d91 758 (arguments
88f06fd0
PN
759 '(#:configure-flags '("cc=gcc")
760 #:phases (modify-phases %standard-phases
761 (add-after 'configure 'fix-tests
762 (lambda _
763 (substitute* "tests/017/realpath.tl"
764 (("/usr/bin") "/"))
765 (substitute* "tests/017/realpath.expected"
766 (("/usr/bin") "/"))
767 #t))
768 (replace 'check
769 (lambda _
770 (invoke "make" "tests"))))))
771 (native-inputs
772 `(("bison" ,bison)
773 ("flex" ,flex)))
d9544d91 774 (inputs
88f06fd0
PN
775 `(("libffi" ,libffi)))
776 (synopsis "General-purpose, multi-paradigm programming language")
d9544d91 777 (description
88f06fd0
PN
778 "TXR is a general-purpose, multi-paradigm programming language. It
779comprises two languages integrated into a single tool: a text scanning and
780extraction language referred to as the TXR Pattern Language (sometimes just
781\"TXR\"), and a general-purpose dialect of Lisp called TXR Lisp. TXR can be
782used for everything from \"one liner\" data transformation tasks at the
783command line, to data scanning and extracting scripts, to full application
784development in a wide-range of areas.")
785 (home-page "https://nongnu.org/txr/")
786 (license license:bsd-2)))
e4c9ba4d
GLV
787
788(define picolisp32
789 (package
790 (name "picolisp32")
791 (version "19.12")
792 (source
793 (origin
794 (method url-fetch)
795 (uri (string-append "https://software-lab.de/picoLisp-" version ".tgz"))
796 (sha256
797 (base32 "10np0mhihr47r3201617zccrvzpkhdl1jwvz7zimk8kxpriydq2j"))
798 (modules '((guix build utils)))
799 (snippet '(begin
800 ;; Delete the pre-compiled jar file.
801 (delete-file "ersatz/picolisp.jar")
802 #t))))
803 (build-system gnu-build-system)
804 (inputs
805 `(("openssl" ,openssl)))
806 (arguments
807 `(#:system ,(match (%current-system)
808 ((or "armhf-linux" "aarch64-linux")
809 "armhf-linux")
810 (_
811 "i686-linux"))
812 #:phases
813 (modify-phases %standard-phases
814 (delete 'configure)
815 (add-after 'unpack 'fix-paths
816 (lambda* (#:key outputs #:allow-other-keys)
817 (let* ((out (assoc-ref outputs "out"))
818 (shebang-line (string-append
819 "#!" out "/bin/picolisp "
820 out "/lib/picolisp/lib.l")))
821 (substitute* '("bin/pil"
822 "bin/pilIndent"
823 "bin/pilPretty"
824 "bin/psh"
825 "bin/replica"
826 "bin/vip"
827 "bin/watchdog"
828 "games/xchess"
829 "misc/bigtest"
830 "misc/calc"
831 "misc/chat"
832 "misc/mailing"
833 "src/mkVers")
834 (("#\\!bin/picolisp lib.l")
835 shebang-line)
836 (("#\\!\\.\\./bin/picolisp \\.\\./lib.l")
837 shebang-line)
838 (("#\\!/usr/bin/picolisp /usr/lib/picolisp/lib.l")
839 shebang-line)))
840 #t))
841 (add-after 'fix-paths 'make-build-reproducible
842 (lambda _
843 (substitute* "src64/lib/asm.l"
844 (("\\(prinl \"/\\* \" \\(datSym \\(date\\)\\) \" \\*/\\)")
845 ""))
846 #t))
847 (add-after 'make-build-reproducible 'fix-permissions
848 (lambda _
849 (for-each make-file-writable
850 '("doc/family.tgz"
851 "doc/family64.tgz"
852 "lib/map"
853 "src64/tags"))
854 #t))
855 (replace 'build
856 (lambda _
857 (invoke "make" "-C" "src" "picolisp" "tools" "gate")))
858 (add-before 'check 'set-home-for-tests
859 (lambda _
860 (setenv "HOME" "/tmp")
861 #t))
862 (replace 'check
863 (lambda _
864 (invoke "./pil" "test/lib.l" "-bye" "+")))
865 (replace 'install
866 (lambda* (#:key outputs #:allow-other-keys)
867 (let* ((out (assoc-ref outputs "out"))
868 (bin (string-append out "/bin"))
869 (man (string-append out "/share/man"))
870 (picolisp (string-append out "/lib/picolisp")))
871 (copy-recursively "man" man)
872 (copy-recursively "." picolisp)
873 (for-each (lambda (name)
874 (let ((path (string-append picolisp "/" name)))
875 (delete-file-recursively path)))
876 '("CHANGES" "COPYING" "CREDITS" "cygwin"
877 "INSTALL" "man" "pil" "README" "src" "src64"
878 "test"))
879 (mkdir-p bin)
880 (symlink (string-append picolisp "/bin/picolisp")
881 (string-append bin "/picolisp"))
882 (symlink (string-append picolisp "/bin/pil")
883 (string-append bin "/pil")))
884 #t)))))
885 (synopsis "Interpreter for the PicoLisp programming language")
886 (description
887 "PicoLisp is a programming language, or really a programming system,
888including a built-in database engine and a GUI system.")
889 (home-page "https://picolisp.com/wiki/?home")
890 (license license:expat)))
891
892(define-public picolisp
893 (match (%current-system)
894 ((or "aarch64-linux" "x86_64-linux")
895 (package
896 ;; Use the 32-bit picolisp to generate the assembly files required by
897 ;; the 64-bit picolisp.
898 (inherit picolisp32)
899 (name "picolisp")
900 (native-inputs
901 `(("picolisp32" ,picolisp32)
902 ("which" ,which)))
903 (arguments
904 (substitute-keyword-arguments (package-arguments picolisp32)
905 ((#:system _ "") (%current-system))
906 ((#:phases phases)
907 `(modify-phases ,phases
908 (delete 'fix-paths)
909 (add-before 'build 'fix-paths
910 ;; This must run after the other shebang-patching phases,
911 ;; or they will override our changes.
912 (lambda* (#:key inputs outputs #:allow-other-keys)
913 (let* ((picolisp32 (assoc-ref inputs "picolisp32"))
914 (out (assoc-ref outputs "out"))
915 (shebang-line (string-append
916 "#!" out "/bin/picolisp "
917 out "/lib/picolisp/lib.l")))
918 (substitute* '("bin/pil"
919 "bin/pilIndent"
920 "bin/pilPretty"
921 "bin/psh"
922 "bin/replica"
923 "bin/vip"
924 "bin/watchdog"
925 "games/xchess"
926 "misc/bigtest"
927 "misc/calc"
928 "misc/chat"
929 "misc/mailing"
930 "src/mkVers")
931 (("#\\!.*picolisp32.*/bin/picolisp .*lib\\.l")
932 shebang-line))
933 (substitute* "src64/mkAsm"
934 (("/usr/bin/")
935 (string-append picolisp32 "/bin/"))))
936 #t))
937 (replace 'build
938 (lambda _
939 (invoke "make" "-C" "src" "tools" "gate")
940 (invoke "make" "-C" "src64" "CC=gcc" "picolisp")))))))))
941 (_
942 (package
943 (inherit picolisp32)
944 (name "picolisp")))))