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