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