gnu: python-deepmerge: Use pyproject-build-system.
[jackhill/guix/guix.git] / gnu / packages / lisp.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
3 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
4 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
6 ;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
7 ;;; Copyright © 2016, 2017 Andy Patterson <ajpatter@uwaterloo.ca>
8 ;;; Copyright © 2017, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2017-2019, 2022 Efraim Flashner <efraim@flashner.co.il>
10 ;;; Copyright © 2017, 2019–2022 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
12 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
13 ;;; Copyright © 2018, 2019, 2020 Pierre Neidhardt <mail@ambrevar.xyz>
14 ;;; Copyright © 2018, 2019 Pierre Langlois <pierre.langlois@gmx.com>
15 ;;; Copyright © 2019, 2020 Katherine Cox-Buday <cox.katherine.e@gmail.com>
16 ;;; Copyright © 2019 Jesse Gildersleve <jessejohngildersleve@protonmail.com>
17 ;;; Copyright © 2019, 2020, 2021, 2022 Guillaume Le Vaillant <glv@posteo.net>
18 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
19 ;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
20 ;;; Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
21 ;;; Copyright © 2021 Paul A. Patience <paul@apatience.com>
22 ;;; Copyright © 2021 Charles Jackson <charles.b.jackson@protonmail.com>
23 ;;; Copyright © 2021 jgart <jgart@dismail.de>
24 ;;; Copyright © 2022 Joeke de Graaf <joeke@posteo.net>
25 ;;;
26 ;;; This file is part of GNU Guix.
27 ;;;
28 ;;; GNU Guix is free software; you can redistribute it and/or modify it
29 ;;; under the terms of the GNU General Public License as published by
30 ;;; the Free Software Foundation; either version 3 of the License, or (at
31 ;;; your option) any later version.
32 ;;;
33 ;;; GNU Guix is distributed in the hope that it will be useful, but
34 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
35 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 ;;; GNU General Public License for more details.
37 ;;;
38 ;;; You should have received a copy of the GNU General Public License
39 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
40
41 ;;; This file only contains Common Lisp compilers and tooling.
42 ;;; Common Lisp libraries go to lisp-xyz.scm.
43 ;;; Common Lisp applications should go to the most appropriate file,
44 ;;; e.g. StumpWM is in wm.scm.
45
46 (define-module (gnu packages lisp)
47 #:use-module (gnu packages)
48 #:use-module ((guix licenses) #:prefix license:)
49 #:use-module (guix packages)
50 #:use-module (guix download)
51 #:use-module (guix git-download)
52 #:use-module (guix gexp)
53 #:use-module (guix utils)
54 #:use-module (guix build-system copy)
55 #:use-module (guix build-system gnu)
56 #:use-module (guix build-system ant)
57 #:use-module (guix build-system asdf)
58 #:use-module (guix build-system trivial)
59 #:use-module (gnu packages admin)
60 #:use-module (gnu packages base)
61 #:use-module (gnu packages bash)
62 #:use-module (gnu packages bdw-gc)
63 #:use-module (gnu packages check)
64 #:use-module (gnu packages compression)
65 #:use-module (gnu packages dbm)
66 #:use-module (gnu packages ed)
67 #:use-module (gnu packages fontutils)
68 #:use-module (gnu packages gcc)
69 #:use-module (gnu packages gettext)
70 #:use-module (gnu packages ghostscript)
71 #:use-module (gnu packages gl)
72 #:use-module (gnu packages glib)
73 #:use-module (gnu packages groff)
74 #:use-module (gnu packages libffcall)
75 #:use-module (gnu packages libffi)
76 #:use-module (gnu packages libsigsegv)
77 #:use-module (gnu packages linux)
78 #:use-module (gnu packages m4)
79 #:use-module (gnu packages maths)
80 #:use-module (gnu packages multiprecision)
81 #:use-module (gnu packages ncurses)
82 #:use-module (gnu packages onc-rpc)
83 #:use-module (gnu packages perl)
84 #:use-module (gnu packages readline)
85 #:use-module (gnu packages sdl)
86 #:use-module (gnu packages tcl)
87 #:use-module (gnu packages tex)
88 #:use-module (gnu packages texinfo)
89 #:use-module (gnu packages tls)
90 #:use-module (gnu packages version-control)
91 #:use-module (gnu packages xorg)
92 #:use-module (ice-9 match))
93
94 (define-public cl-asdf
95 (package
96 (name "cl-asdf")
97 (version "3.3.5")
98 (source
99 (origin
100 (method url-fetch)
101 (uri
102 (string-append "https://common-lisp.net/project/asdf/archives/asdf-"
103 version ".lisp"))
104 (sha256
105 (base32 "1mydyrii3f0aig1q5admj6hyf59vjn4a5x1q8hqgh483987ilz6h"))))
106 (build-system trivial-build-system)
107 (native-inputs
108 `(("config-patch" ,@(search-patches "cl-asdf-config-directories.patch"))
109 ("patch" ,patch)))
110 (arguments
111 `(#:modules ((guix build utils)
112 (guix build lisp-utils))
113 #:builder
114 (begin
115 (use-modules (guix build utils)
116 (guix build lisp-utils))
117 (let* ((out (string-append (assoc-ref %outputs "out")))
118 (asdf-install (string-append out %source-install-prefix
119 "/source/asdf/"))
120 (src-asdf (string-append (assoc-ref %build-inputs "source")))
121 (dst-asdf (string-append asdf-install "asdf.lisp"))
122 (patch (string-append (assoc-ref %build-inputs "patch")
123 "/bin/patch"))
124 (config-patch (assoc-ref %build-inputs "config-patch")))
125 (mkdir-p asdf-install)
126 (copy-file src-asdf dst-asdf)
127 (invoke patch "-p1" "-i" config-patch dst-asdf)))))
128 (home-page "https://common-lisp.net/project/asdf/")
129 (synopsis "Another System Definition Facility")
130 (description
131 "ASDF is what Common Lisp hackers use to build and load software. It is
132 the successor of the Lisp DEFSYSTEM of yore. ASDF stands for Another System
133 Definition Facility.")
134 ;; MIT License
135 (license license:expat)))
136
137 (define-public gcl
138 (let ((commit "ff7ef981765cc0efdb4b1db27c292f5c11a72753")
139 (revision "3")) ;Guix package revision
140 (package
141 (name "gcl")
142 (version (git-version "2.6.12" revision commit))
143 (source
144 (origin
145 (method git-fetch)
146 (uri (git-reference
147 (url "https://git.savannah.gnu.org/r/gcl.git")
148 (commit commit)))
149 (file-name (git-file-name name version))
150 (sha256
151 (base32 "0z64fxxcaial2i1s1hms8r095dm1ff3wd8ivwdx894a3yln9c0an"))))
152 (build-system gnu-build-system)
153 (arguments
154 `(#:parallel-build? #f ; The build system seems not to be thread safe.
155 #:test-target "ansi-tests/test_results"
156 #:configure-flags ,#~(list
157 "--enable-ansi" ; required by the maxima package
158 (string-append "CFLAGS=-I"
159 #$(this-package-input "libtirpc")
160 "/include/tirpc")
161 (string-append "LDFLAGS=-L"
162 #$(this-package-input "libtirpc")
163 "/lib")
164 "LIBS=-ltirpc")
165 #:make-flags ,#~(let ((gcc (search-input-file %build-inputs "/bin/gcc")))
166 (list (string-append "GCL_CC=" gcc)
167 (string-append "CC=" gcc)))
168 #:phases
169 (modify-phases %standard-phases
170 (add-after 'unpack 'realpath-workaround
171 ;; Calls to the realpath function can set errno even if the return
172 ;; value of the function indicates that there is no error, which
173 ;; make massert consider that there was an error.
174 (lambda _
175 (substitute* "gcl/o/main.c"
176 (("massert\\(realpath\\(s,o\\)\\);" all)
177 "massert((realpath(s, o) != NULL) && ((errno = 0) == 0));"))))
178 (add-after 'unpack 'fix-makefile
179 ;; The "final" target doesn't exist.
180 (lambda _
181 (substitute* "gcl/makefile"
182 (("\\$\\(MAKE\\) -C \\$\\(PORTDIR\\) final")
183 "$(MAKE) -C $(PORTDIR)"))))
184 (add-before 'configure 'pre-conf
185 (lambda* (#:key inputs #:allow-other-keys)
186 (chdir "gcl")
187 (substitute*
188 (append
189 '("pcl/impl/kcl/makefile.akcl"
190 "add-defs"
191 "unixport/makefile.dos"
192 "add-defs.bat"
193 "gcl-tk/makefile.prev"
194 "add-defs1")
195 (find-files "h" "\\.defs"))
196 (("SHELL=/bin/bash")
197 (string-append "SHELL=" (which "bash")))
198 (("SHELL=/bin/sh")
199 (string-append "SHELL=" (which "sh"))))
200 (substitute* "h/linux.defs"
201 (("#CC") "CC")
202 (("-fwritable-strings") "")
203 (("-Werror") ""))
204 (substitute* "lsp/gcl_top.lsp"
205 (("\"cc\"")
206 (string-append "\"" (assoc-ref %build-inputs "gcc")
207 "/bin/gcc\""))
208 (("\\(or \\(get-path \\*cc\\*\\) \\*cc\\*\\)") "*cc*")
209 (("\"ld\"")
210 (string-append "\"" (assoc-ref %build-inputs "binutils")
211 "/bin/ld\""))
212 (("\\(or \\(get-path \\*ld\\*\\) \\*ld\\*\\)") "*ld*")
213 (("\\(get-path \"objdump --source \"\\)")
214 (string-append "\"" (assoc-ref %build-inputs "binutils")
215 "/bin/objdump --source \"")))
216 #t))
217 (add-after 'install 'wrap
218 (lambda* (#:key inputs outputs #:allow-other-keys)
219 (let* ((gcl (assoc-ref outputs "out"))
220 (input-path (lambda (lib path)
221 (string-append
222 (assoc-ref inputs lib) path)))
223 (binaries '("binutils")))
224 ;; GCC and the GNU binutils are necessary for GCL to be
225 ;; able to compile Lisp functions and programs (this is
226 ;; a standard feature in Common Lisp). While the
227 ;; the location of GCC is specified in the make-flags,
228 ;; the GNU binutils must be available in GCL's $PATH.
229 (wrap-program (string-append gcl "/bin/gcl")
230 `("PATH" prefix ,(map (lambda (binary)
231 (input-path binary "/bin"))
232 binaries))))
233 #t))
234 ;; drop strip phase to make maxima build, see
235 ;; https://www.ma.utexas.edu/pipermail/maxima/2008/009769.html
236 (delete 'strip))))
237 (inputs
238 (list bash-minimal gmp libtirpc readline))
239 (native-inputs
240 (list m4 texinfo))
241 (home-page "https://www.gnu.org/software/gcl/")
242 (synopsis "Common Lisp implementation")
243 (description "GCL is an implementation of the Common Lisp language. It
244 features the ability to compile to native object code and to load native
245 object code modules directly into its lisp core. It also features a
246 stratified garbage collection strategy, a source-level debugger and a built-in
247 interface to the Tk widget system.")
248 (license license:lgpl2.0+))))
249
250 (define-public ecl
251 (package
252 (name "ecl")
253 (version "21.2.1")
254 (source
255 (origin
256 (method url-fetch)
257 (uri (string-append
258 "https://ecl.common-lisp.dev/static/files/release/"
259 name "-" version ".tgz"))
260 (sha256
261 (base32 "000906nnq25177bgsfndiw3iqqgrjc9spk10hzk653sbz3f7anmi"))))
262 (build-system gnu-build-system)
263 ;; src/configure uses 'which' to confirm the existence of 'gzip'.
264 (native-inputs
265 (list cl-asdf which texinfo))
266 (inputs (list bash-minimal))
267 ;; When ECL is embedded in a program that wants to use Common Lisp as an
268 ;; extension language, libgmp, libatomic-ops, libgc and libffi must be
269 ;; present when compiling the program because they are required by ECL's
270 ;; header file.
271 ;; Therefore we put these libraries in 'propagated-inputs' instead
272 ;; of 'inputs'.
273 (propagated-inputs
274 (list gmp libatomic-ops libgc libffi))
275 (arguments
276 `(#:configure-flags '("--without-rt")
277 #:parallel-tests? #f
278 #:phases
279 (modify-phases %standard-phases
280 ;; FIXME: As of version 20.4.24, we pass 17995 tests and fail 7.
281 ;; 2-3 tests may be due to FHS assumptions.
282 (delete 'check)
283 (add-after 'unpack 'replace-asdf
284 ;; Use system ASDF instead of bundled one.
285 (lambda* (#:key inputs #:allow-other-keys)
286 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
287 (guix-asdf (string-append
288 cl-asdf
289 "/share/common-lisp/source/asdf/asdf.lisp"))
290 (contrib-asdf "contrib/asdf/asdf.lisp"))
291 (copy-file guix-asdf contrib-asdf))))
292 (add-after 'install 'remove-build-stamp
293 (lambda* (#:key outputs #:allow-other-keys)
294 (delete-file (string-append (assoc-ref outputs "out")
295 "/lib/ecl-" ,version "/build-stamp"))))
296 (add-after 'remove-build-stamp 'wrap
297 (lambda* (#:key inputs outputs #:allow-other-keys)
298 (let* ((ecl (assoc-ref outputs "out"))
299 (input-path (lambda (lib path)
300 (string-append
301 (assoc-ref inputs lib) path)))
302 (libraries '("gmp" "libatomic-ops" "libgc" "libffi" "libc"))
303 (binaries '("gcc" "ld-wrapper" "binutils"))
304 (library-directories
305 (map (lambda (lib) (input-path lib "/lib"))
306 libraries)))
307
308 (wrap-program (string-append ecl "/bin/ecl")
309 `("PATH" prefix
310 ,(map (lambda (binary)
311 (input-path binary "/bin"))
312 binaries))
313 `("CPATH" suffix
314 ,(map (lambda (lib)
315 (input-path lib "/include"))
316 `("kernel-headers" ,@libraries)))
317 `("LIBRARY_PATH" suffix ,library-directories)
318 `("LD_LIBRARY_PATH" suffix ,library-directories)))))
319 (add-after 'wrap 'check (assoc-ref %standard-phases 'check))
320 (add-before 'check 'fix-path-to-ecl
321 (lambda _
322 (substitute* "build/tests/Makefile"
323 (("\\$\\{exec_prefix\\}/") "")))))))
324 (native-search-paths
325 (list (search-path-specification
326 (variable "XDG_DATA_DIRS")
327 (files '("share")))
328 (search-path-specification
329 (variable "XDG_CONFIG_DIRS")
330 (files '("etc")))))
331 (home-page "https://ecl.common-lisp.dev/")
332 (synopsis "Embeddable Common Lisp")
333 (description "ECL is an implementation of the Common Lisp language as
334 defined by the ANSI X3J13 specification. Its most relevant features are: a
335 bytecode compiler and interpreter, being able to compile Common Lisp with any
336 C/C++ compiler, being able to build standalone executables and libraries, and
337 supporting ASDF, Sockets, Gray streams, MOP, and other useful components.")
338 ;; Note that the file "Copyright" points to some files and directories
339 ;; which aren't under the lgpl2.1+ and instead contain many different,
340 ;; non-copyleft licenses.
341 ;; See https://common-lisp.net/project/ecl/posts/ECL-license.html.
342 (license license:lgpl2.1+)))
343
344 (define-public clisp
345 (package
346 (name "clisp")
347 (version "2.49-92")
348 (source
349 (origin
350 (method git-fetch)
351 (uri (git-reference
352 (url "https://gitlab.com/gnu-clisp/clisp")
353 (commit "clisp-2.49.92-2018-02-18")))
354 (file-name (git-file-name name version))
355 (sha256
356 (base32 "0k2dmgl0miz3767iks4p0mvp6xw0ysyxhjpklyh11j010rmh6hqb"))))
357 (build-system gnu-build-system)
358 (native-inputs
359 (list cl-asdf))
360 (inputs (list libffcall ncurses readline libsigsegv))
361 (arguments
362 `(#:configure-flags '(,@(if (string-prefix? "armhf-linux"
363 (or (%current-system)
364 (%current-target-system)))
365 '("CFLAGS=-falign-functions=4")
366 '())
367 "--with-dynamic-ffi"
368 "--with-dynamic-modules"
369 "--with-ffcall"
370 "--with-readline"
371 "--with-sigsegv"
372 "--with-module=asdf"
373 "--with-module=rawsock")
374 #:phases
375 (modify-phases %standard-phases
376 (add-after 'unpack 'patch-sh-and-pwd
377 (lambda _
378 ;; The package is very messy with its references to "/bin/sh" and
379 ;; some other absolute paths to traditional tools. These appear in
380 ;; many places where our automatic patching misses them. Therefore
381 ;; we do the following, in this early (post-unpack) phase, to solve
382 ;; the problem from its root.
383 (substitute* '("src/clisp-link.in"
384 "src/unix.d"
385 "src/makemake.in")
386 (("/bin/sh") (which "sh")))
387 (substitute* (find-files "." "configure|Makefile")
388 (("/bin/sh") "sh"))
389 (substitute* '("src/clisp-link.in")
390 (("/bin/pwd") "pwd"))
391 #t))
392 (add-after 'unpack 'replace-asdf
393 ;; Use system ASDF instead of bundled one.
394 (lambda* (#:key inputs #:allow-other-keys)
395 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
396 (guix-asdf (string-append
397 cl-asdf
398 "/share/common-lisp/source/asdf/asdf.lisp"))
399 (contrib-asdf "modules/asdf/asdf.lisp"))
400 (delete-file contrib-asdf)
401 (copy-file guix-asdf contrib-asdf)))))))
402 (native-search-paths
403 (list (search-path-specification
404 (variable "XDG_DATA_DIRS")
405 (files '("share")))
406 (search-path-specification
407 (variable "XDG_CONFIG_DIRS")
408 (files '("etc")))))
409 (home-page "https://clisp.sourceforge.io/")
410 (synopsis "Common Lisp implementation")
411 (description
412 "GNU CLISP is an implementation of ANSI Common Lisp. Common Lisp is a
413 high-level, object-oriented functional programming language. CLISP includes
414 an interpreter, a compiler, a debugger, and much more.")
415 (license license:gpl2+)))
416
417 (define-public sbcl
418 (package
419 (name "sbcl")
420 (version "2.2.6")
421 (source
422 (origin
423 (method url-fetch)
424 (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-"
425 version "-source.tar.bz2"))
426 (sha256
427 (base32 "18044dqx37mkipnrzs7jrp0cbnwp6snb5gi06a8zn9m8iy6088ry"))))
428 (build-system gnu-build-system)
429 (outputs '("out" "doc"))
430 (native-inputs
431 ;; From INSTALL:
432 ;; Supported build hosts are:
433 ;; SBCL
434 ;; CMUCL
435 ;; CCL (formerly known as OpenMCL)
436 ;; ABCL (recent versions only)
437 ;; CLISP (only some versions: 2.44.1 is OK, 2.47 is not)
438 ;; XCL
439 ;;
440 ;; From NEWS:
441 ;; * build enhancement: new host quirks mechanism, support for building under
442 ;; ABCL and ECL (as well as CCL, CMUCL, CLISP and SBCL itself)
443 ;;
444 ;; CCL is not bootstrappable so it won't do. CLISP 2.49 seems to work.
445 ;; ECL too. As of 2020-07-01, ECL was last updated in 2020 while CLISP
446 ;; was last updated in 2010, and both take about the same time to build SBCL.
447 ;;
448 ;; For now we stick to CLISP as the default for all systems. In any event, keep
449 ;; the `match' here to make it easier to change the host compiler for various
450 ;; architectures. Consider switching to ECL if it gets faster than CLISP
451 ;; (maybe post 2020 release).
452 (list (match (%current-system)
453 ("powerpc-linux" ; CLISP fails to build, needs investigating.
454 ecl)
455 (_
456 clisp))
457 cl-asdf
458 ed
459 inetutils ;for hostname(1)
460 texinfo
461 (texlive-updmap.cfg (list texlive-tex-texinfo))
462 which))
463 (inputs
464 (list gmp ; for sb-gmp
465 mpfr ; for sb-mpfr
466 (list zstd "lib")))
467 (arguments
468 `(#:modules ((guix build gnu-build-system)
469 (guix build utils)
470 (srfi srfi-1))
471 #:phases
472 (modify-phases %standard-phases
473 ,@(if (target-arm32?)
474 ;; TODO: Move to snippet in staging.
475 `((add-after 'unpack 'dont-force-armv5
476 (lambda _
477 (substitute* "src/runtime/Config.arm-linux"
478 (("-march=armv5") "")))))
479 '())
480 (delete 'configure)
481 (add-after 'unpack 'fix-build-id
482 ;; One of the build scripts makes a build id using the current date.
483 ;; Replace it with a reproducible id using a part of the output hash.
484 (lambda* (#:key outputs #:allow-other-keys)
485 (let ((hash (substring (assoc-ref outputs "out")
486 (+ (string-length (%store-directory)) 1)
487 (+ (string-length (%store-directory)) 9))))
488 (substitute* "make-config.sh"
489 (("echo .* > output/build-id.inc")
490 (string-append "echo '\"'guix-sbcl-"
491 hash
492 "'\"' > output/build-id.inc"))))))
493 (add-after 'unpack 'replace-asdf
494 ;; SBCL developers have not committed to keeping ASDF up to date
495 ;; due to breaking changes [1]. Guix can handle this situation
496 ;; easily, and it behooves us to have more control over what version
497 ;; of ASDF we use to build software; therefore, replace the contrib
498 ;; ASDF with the version packaged into Guix.
499 ;; [1] - https://bugs.launchpad.net/sbcl/+bug/1823442
500 (lambda* (#:key inputs #:allow-other-keys)
501 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
502 (guix-asdf (string-append
503 cl-asdf
504 "/share/common-lisp/source/asdf/asdf.lisp"))
505 (contrib-asdf "contrib/asdf/asdf.lisp"))
506 (copy-file guix-asdf contrib-asdf))
507 #t))
508 (add-before 'build 'patch-unix-tool-paths
509 (lambda* (#:key outputs inputs #:allow-other-keys)
510 (let ((out (assoc-ref outputs "out"))
511 (bash (assoc-ref inputs "bash"))
512 (coreutils (assoc-ref inputs "coreutils"))
513 (ed (assoc-ref inputs "ed")))
514 (define (quoted-path input path)
515 (string-append "\"" input path "\""))
516 ;; Patch absolute paths in string literals. Note that this
517 ;; occurs in some .sh files too (which contain Lisp code). Use
518 ;; ISO-8859-1 because some of the files are ISO-8859-1 encoded.
519 (with-fluids ((%default-port-encoding #f))
520 ;; The removed file is utf-16-be encoded, which gives substitute*
521 ;; trouble. It does not contain references to the listed programs.
522 (substitute* (delete
523 "./tests/data/compile-file-pos-utf16be.lisp"
524 (find-files "." "\\.(lisp|sh)$"))
525 (("\"/bin/sh\"") (quoted-path bash "/bin/sh"))
526 (("\"/usr/bin/env\"") (quoted-path coreutils "/usr/bin/env"))
527 (("\"/bin/cat\"") (quoted-path coreutils "/bin/cat"))
528 (("\"/bin/ed\"") (quoted-path ed "/bin/ed"))
529 (("\"/bin/echo\"") (quoted-path coreutils "/bin/echo"))
530 (("\"/bin/uname\"") (quoted-path coreutils "/bin/uname"))))
531 ;; This one script has a non-string occurrence of /bin/sh.
532 (substitute* '("tests/foreign.test.sh")
533 ;; Leave whitespace so we don't match the shebang.
534 ((" /bin/sh ") " sh "))
535 ;; This file contains a module that can create executable files
536 ;; which depend on the presence of SBCL. It generates shell
537 ;; scripts doing "exec sbcl ..." to achieve this. We patch both
538 ;; the shebang and the reference to "sbcl", tying the generated
539 ;; executables to the exact SBCL package that generated them.
540 (substitute* '("contrib/sb-executable/sb-executable.lisp")
541 (("/bin/sh") (string-append bash "/bin/sh"))
542 (("exec sbcl") (string-append "exec " out "/bin/sbcl")))
543 ;; Disable some tests that fail in our build environment.
544 (substitute* '("contrib/sb-bsd-sockets/tests.lisp")
545 ;; This requires /etc/protocols.
546 (("\\(deftest get-protocol-by-name/error" all)
547 (string-append "#+nil ;disabled by Guix\n" all)))
548 (substitute* '("contrib/sb-posix/posix-tests.lisp")
549 ;; These assume some users/groups which we don't have.
550 (("\\(deftest pwent\\.[12]" all)
551 (string-append "#+nil ;disabled by Guix\n" all))
552 (("\\(deftest grent\\.[12]" all)
553 (string-append "#+nil ;disabled by Guix\n" all))))
554 #t))
555 (add-before 'build 'fix-shared-library-makefile
556 (lambda _
557 (substitute* '("src/runtime/GNUmakefile")
558 ((" cc") " $(CC)"))
559 #t))
560 (add-before 'build 'fix-contrib-library-path
561 (lambda* (#:key inputs #:allow-other-keys)
562 (let ((gmp (assoc-ref inputs "gmp"))
563 (mpfr (assoc-ref inputs "mpfr")))
564 (substitute* '("contrib/sb-gmp/gmp.lisp")
565 (("\"libgmp\\.so") (string-append "\"" gmp "/lib/libgmp.so")))
566 (substitute* '("contrib/sb-mpfr/mpfr.lisp")
567 (("\"libmpfr\\.so") (string-append "\"" mpfr "/lib/libmpfr.so"))))
568 #t))
569 (replace 'build
570 (lambda* (#:key outputs #:allow-other-keys)
571 (setenv "CC" "gcc")
572 (invoke "sh" "make.sh" ,@(match (%current-system)
573 ("powerpc-linux"
574 `("ecl"))
575 (_
576 `("clisp")))
577 (string-append "--prefix="
578 (assoc-ref outputs "out"))
579 ,@(if (target-ppc32?)
580 ;; 3072 is too much for this architecture.
581 `("--dynamic-space-size=2048")
582 `("--dynamic-space-size=3072"))
583 "--with-sb-core-compression"
584 "--with-sb-xref-for-internals"
585 ;; SB-SIMD will only be built on x86_64 CPUs supporting
586 ;; AVX2 instructions. Some x86_64 CPUs don't, so for reproducibility
587 ;; we disable it and we don't build its documentation (see the
588 ;; 'build-doc' phase).
589 "--without-sb-simd")))
590 (add-after 'build 'build-shared-library
591 (lambda* (#:key outputs #:allow-other-keys)
592 (setenv "CC" "gcc")
593 (invoke "sh" "make-shared-library.sh")))
594 (replace 'install
595 (lambda _
596 (invoke "sh" "install.sh")))
597 (add-after 'build 'build-doc
598 (lambda _
599 ;; Don't build the documentation for SB-SIMD as it is disabled in
600 ;; the 'build' phase.
601 (substitute* "doc/manual/generate-texinfo.lisp"
602 (("exclude '\\(\"asdf\"\\)")
603 "exclude '(\"asdf\" \"sb-simd\")"))
604 (with-directory-excursion "doc/manual"
605 (and (invoke "make" "info")
606 (invoke "make" "dist")))))
607 (add-after 'build 'build-source
608 (lambda* (#:key outputs #:allow-other-keys)
609 (let* ((out (assoc-ref outputs "out"))
610 (rc (string-append out "/lib/sbcl/sbclrc"))
611 (source-dir (string-append out "/share/sbcl")))
612 (for-each (lambda (p)
613 (copy-recursively p (string-append source-dir "/" p)))
614 '("src" "contrib"))
615 (mkdir-p (dirname rc))
616 (with-output-to-file rc
617 (lambda ()
618 (display
619 (string-append "(sb-ext:set-sbcl-source-location \""
620 source-dir "\")") )))
621 #t)))
622 (add-after 'install 'remove-coreutils-references
623 ;; They are only useful on non-Linux, non-SBCL.
624 (lambda* (#:key outputs #:allow-other-keys)
625 (let* ((out (assoc-ref outputs "out"))
626 (share-dir (string-append out "/share/sbcl/")))
627 (substitute* (string-append share-dir "src/code/run-program.lisp")
628 (("\\(run-program \".*uname\"")
629 "(run-program \"uname\""))
630 (substitute* (string-append share-dir "contrib/asdf/asdf.lisp")
631 (("\\(\".*/usr/bin/env\"")
632 "(\"/usr/bin/env\""))
633 (substitute* (string-append share-dir "contrib/asdf/uiop.lisp")
634 (("\\(\".*/usr/bin/env\"")
635 "(\"/usr/bin/env\""))
636 #t)))
637 (add-after 'install 'install-shared-library
638 (lambda* (#:key outputs #:allow-other-keys)
639 (let* ((out (assoc-ref outputs "out"))
640 (lib-dir (string-append out "/lib")))
641 (install-file "src/runtime/libsbcl.so" lib-dir)
642 #t)))
643 (add-after 'install 'install-doc
644 (lambda* (#:key outputs #:allow-other-keys)
645 (let* ((out (assoc-ref outputs "out"))
646 (doc (assoc-ref outputs "doc"))
647 (old-doc-dir (string-append out "/share/doc"))
648 (new-doc/sbcl-dir (string-append doc "/share/doc/sbcl")))
649 (rmdir (string-append old-doc-dir "/sbcl/html"))
650 (mkdir-p new-doc/sbcl-dir)
651 (copy-recursively (string-append old-doc-dir "/sbcl")
652 new-doc/sbcl-dir)
653 (delete-file-recursively old-doc-dir)
654 #t))))
655 ;; No 'check' target, though "make.sh" (build phase) runs tests.
656 #:tests? #f))
657 (native-search-paths
658 (list (search-path-specification
659 (variable "XDG_DATA_DIRS")
660 (files '("share")))
661 (search-path-specification
662 (variable "XDG_CONFIG_DIRS")
663 (files '("etc")))))
664 (home-page "http://www.sbcl.org/")
665 (synopsis "Common Lisp implementation")
666 (description "Steel Bank Common Lisp (SBCL) is a high performance Common
667 Lisp compiler. In addition to the compiler and runtime system for ANSI Common
668 Lisp, it provides an interactive environment including a debugger, a
669 statistical profiler, a code coverage tool, and many other extensions.")
670 ;; Public domain in jurisdictions that allow it, bsd-2 otherwise. MIT
671 ;; loop macro has its own license. See COPYING file for further notes.
672 (license (list license:public-domain license:bsd-2
673 (license:x11-style "file://src/code/loop.lisp")))))
674
675 (define-public ccl
676 ;; Warning: according to upstream, CCL is not bootstrappable.
677 ;; See https://github.com/Clozure/ccl/issues/222 from 2019-09-02:
678 ;;
679 ;; "As far as I know, there is no way to build CCL without an existing
680 ;; running CCL image. It was bootstrapped back in 1986 or so as
681 ;; Macintosh Common Lisp, by Gary Byers, I believe, who is no longer on
682 ;; the planet to tell us the story. It SHOULD be possible to port the
683 ;; CCL compiler to portable Common Lisp, so that ANY lisp could build
684 ;; it, as is the case for SBCL, but I know of no attempt to do so."
685 (package
686 (name "ccl")
687 ;; XXX When updating this package, check whether we can simply append
688 ;; VERSION to the ccl-bootstrap URL again, instead of per architecture.
689 (version "1.12.1")
690 (source (origin
691 (method git-fetch)
692 (uri (git-reference
693 (url "https://github.com/Clozure/ccl/")
694 (commit (string-append "v" version))))
695 (file-name (git-file-name "ccl" version))
696 (sha256
697 (base32
698 "1zz291lvsrr7pps8wfl2kdxsnzjngqi4v3mil14pga4r5zanmsi7"))))
699 (build-system gnu-build-system)
700 ;; CCL consists of a "lisp kernel" and "heap image", both of which are
701 ;; shipped in precompiled form in source tarballs. The former is a C
702 ;; program which we can rebuild from scratch, but the latter cannot be
703 ;; generated without an already working copy of CCL, and is platform
704 ;; dependent, so we need to fetch the correct tarball for the platform.
705 (inputs
706 `(("ccl-bootstrap"
707 ,(origin
708 (method url-fetch)
709 (uri (string-append
710 "https://github.com/Clozure/ccl/releases/download/v"
711 (match (%current-system)
712 ("armhf-linux" "1.12/linuxarm")
713 ;; XXX: This source only works on x86, but provide it as a
714 ;; catch-all to prevent errors when querying this package
715 ;; on unsupported platforms.
716 (_ "1.12.1/linuxx86"))
717 ".tar.gz"))
718 (sha256
719 (base32
720 (match (%current-system)
721 ("armhf-linux"
722 "0x4bjx6cxsjvxyagijhlvmc7jkyxifdvz5q5zvz37028va65243c")
723 (_ "0ll017ajcfsyx8f7zsy4394y8xxvz40iz0gcsmznp0n3mf0xi67c"))))))))
724 (native-inputs
725 (list cl-asdf m4))
726 (arguments
727 `(#:tests? #f ;no 'check' target
728 #:modules ((ice-9 match)
729 (srfi srfi-26)
730 (guix build utils)
731 (guix build gnu-build-system))
732 #:phases
733 (modify-phases %standard-phases
734 (add-after 'unpack 'unpack-image
735 (lambda* (#:key inputs #:allow-other-keys)
736 (invoke "tar" "xzvf" (assoc-ref inputs "ccl-bootstrap"))))
737 (add-after 'unpack 'replace-asdf
738 ;; Use system ASDF instead of bundled one.
739 (lambda* (#:key inputs #:allow-other-keys)
740 (let* ((cl-asdf (assoc-ref inputs "cl-asdf"))
741 (guix-asdf (string-append
742 cl-asdf
743 "/share/common-lisp/source/asdf/asdf.lisp"))
744 (contrib-asdf "tools/asdf.lisp"))
745 (delete-file contrib-asdf)
746 (copy-file guix-asdf contrib-asdf))))
747 (delete 'configure)
748 (add-before 'build 'pre-build
749 ;; Enter the source directory for the current platform's lisp
750 ;; kernel, and run 'make clean' to remove the precompiled one.
751 (lambda* (#:key system #:allow-other-keys)
752 (substitute* "lisp-kernel/m4macros.m4"
753 (("/bin/pwd") (which "pwd")))
754 (chdir (string-append
755 "lisp-kernel/"
756 (match system
757 ("i686-linux" "linuxx8632")
758 ("x86_64-linux" "linuxx8664")
759 ("armhf-linux" "linuxarm")
760 (_ (string-append "unknown system: " system)))))
761 (substitute* '("Makefile")
762 (("/bin/rm") "rm"))
763 (setenv "CC" "gcc")
764 (invoke "make" "clean")))
765 ;; XXX Do we need to recompile the heap image as well for Guix?
766 ;; For now just use the one we already got in the tarball.
767 (replace 'install
768 (lambda* (#:key outputs inputs system #:allow-other-keys)
769 ;; The lisp kernel built by running 'make' in lisp-kernel/$system
770 ;; is put back into the original directory, so go back. The heap
771 ;; image is there as well.
772 (chdir "../..")
773 (let* ((out (assoc-ref outputs "out"))
774 (libdir (string-append out "/lib/"))
775 (bindir (string-append out "/bin/"))
776 (wrapper (string-append bindir "ccl"))
777 (bash (assoc-ref inputs "bash"))
778 (kernel
779 (match system
780 ("i686-linux" "lx86cl")
781 ("x86_64-linux" "lx86cl64")
782 ("armhf-linux" "armcl")
783 ;; Unlikely to work, but try it anyway...
784 (_ system)))
785 (heap (string-append kernel ".image")))
786 (install-file kernel libdir)
787 (install-file heap libdir)
788
789 (let ((dirs `("lib" "library" "examples" "tools" "objc-bridge"
790 ,@(match system
791 ("x86_64-linux"
792 '("x86-headers64"))
793 ("i686-linux"
794 '("x86-headers"))
795 (_ '())))))
796 (for-each copy-recursively
797 dirs
798 (map (cut string-append libdir <>) dirs)))
799
800 (mkdir-p bindir)
801 (with-output-to-file wrapper
802 (lambda ()
803 (display
804 (string-append
805 "#!" bash "/bin/sh\n"
806 "export CCL_DEFAULT_DIRECTORY=" libdir "\n"
807 "exec -a \"$0\" " libdir kernel " \"$@\"\n"))))
808 (chmod wrapper #o755))
809 #t)))))
810 (native-search-paths
811 (list (search-path-specification
812 (variable "XDG_DATA_DIRS")
813 (files '("share")))
814 (search-path-specification
815 (variable "XDG_CONFIG_DIRS")
816 (files '("etc")))))
817 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
818 (home-page "https://ccl.clozure.com/")
819 (synopsis "Common Lisp implementation")
820 (description "Clozure CL (often called CCL for short) is a Common Lisp
821 implementation featuring fast compilation speed, native threads, a precise,
822 generational, compacting garbage collector, and a convenient foreign-function
823 interface.")
824 (license license:asl2.0)))
825
826 (define-public lush2
827 (package
828 (name "lush2")
829 (version "2.0.1")
830 (source
831 (origin
832 (method url-fetch)
833 (uri (string-append "mirror://sourceforge/lush/lush2/lush-"
834 version ".tar.gz"))
835 (modules '((guix build utils)))
836 (snippet
837 '(begin
838 (substitute* "src/unix.c"
839 (("\\{ \"LUSH_DATE\", __DATE__ \\},") "")
840 (("\\{ \"LUSH_TIME\", __TIME__ \\},") ""))
841 (substitute* "src/main.c"
842 (("\" \\(built \" __DATE__ \"\\)\"") ""))
843 #t))
844 (sha256
845 (base32
846 "02pkfn3nqdkm9fm44911dbcz0v3r0l53vygj8xigl6id5g3iwi4k"))))
847 (build-system gnu-build-system)
848 (arguments
849 `(;; We have to add these LIBS so that they are found.
850 #:configure-flags (list "LIBS=-lz"
851 "X_EXTRA_LIBS=-lfontconfig"
852 "--with-x")
853 #:tests? #f)) ; No make check.
854 (native-inputs (list intltool))
855 (inputs
856 `(("alsa-lib" ,alsa-lib)
857 ("sdl" ,sdl)
858 ("sdl-image" ,sdl-image)
859 ("sdl-mixer" ,sdl-mixer)
860 ("sdl-net" ,sdl-net)
861 ("sdl-ttf" ,sdl-ttf)
862 ("lapack" ,lapack)
863 ("libxft" ,libxft)
864 ("fontconfig" ,fontconfig)
865 ("gsl" ,gsl)
866 ("openblas" ,openblas)
867 ("glu" ,glu)
868 ("mesa" ,mesa)
869 ("mesa-utils" ,mesa-utils)
870 ("binutils" ,binutils)
871 ("libiberty" ,libiberty)
872 ("readline" ,readline)
873 ("zlib" ,zlib)
874 ("gettext-minimal" ,gettext-minimal)))
875 (synopsis "Lisp Universal Shell")
876 (description
877 "Lush is an object-oriented Lisp interpreter/compiler with features
878 designed to please people who want to prototype large numerical
879 applications. Lush includes an extensive library of
880 vector/matrix/tensor manipulation, numerous numerical libraries
881 (including GSL, LAPACK, and BLAS), a set of graphic functions, a
882 simple GUI toolkit, and interfaces to various graphic and multimedia
883 libraries such as OpenGL, SDL, Video4Linux, and ALSA (video/audio
884 grabbing), and others. Lush is an ideal frontend script language for
885 programming projects written in C or other languages. Lush also has
886 libraries for Machine Learning, Neural Nets and statistical estimation.")
887 (home-page "http://lush.sourceforge.net/")
888 (license license:lgpl2.1+)))
889
890 (define-public confusion-mdl
891 (let* ((commit "12a055581fc262225272df43287dae48281900f5"))
892 (package
893 (name "confusion-mdl")
894 (version "0.2")
895 (source (origin
896 (method git-fetch)
897 (uri (git-reference
898 (url (string-append "https://gitlab.com/emacsomancer/" name))
899 (commit commit)))
900 (sha256
901 (base32
902 "1zi8kflzvwqg97ha1sa5xjisbjs5z1mvbpa772vfxiv5ksnpxp0d"))
903 (file-name (git-file-name name version))))
904 (build-system gnu-build-system)
905 (arguments
906 `(#:tests? #f ; there are no tests
907 #:phases
908 (modify-phases %standard-phases
909 (delete 'configure)
910 (replace 'build
911 (lambda* (#:key (make-flags '()) #:allow-other-keys)
912 (apply invoke "make" "CC=gcc" make-flags)))
913 (replace 'install
914 (lambda* (#:key outputs #:allow-other-keys)
915 (let* ((out (assoc-ref outputs "out"))
916 (bin (string-append out "/bin")))
917 (install-file "mdli" bin)
918 #t))))))
919 (native-inputs
920 (list perl))
921 (inputs
922 (list libgc))
923 (synopsis "Interpreter for the MIT Design Language (MDL)")
924 (description "MDL (the MIT Design Language) is a descendant of Lisp. It
925 was originally developed in 1971 on the PDP-10 computer under the Incompatible
926 Timesharing System (ITS) to provide high level language support for the
927 Dynamic Modeling Group at MIT's Project MAC. Infocom built the original
928 PDP-10 Zork in MDL and their later ZIL (Zork Implementation Language) was
929 based on a subset of MDL. Confusion is a MDL interpreter that works just well
930 enough to play the original mainframe Zork all the way through.")
931 (home-page "http://www.russotto.net/git/mrussotto/confusion/src/master/src/README")
932 (license license:gpl3+))))
933
934 (define man-for-txr
935 (let ((commit "dfbf19b9a96474b8c1bacac85e43605e5691ceb2")
936 ;; Number of additional commits since the last tag (see the output of
937 ;; "git describe --tags").
938 (revision "41"))
939 (package
940 (name "man-for-txr")
941 (version (git-version "1.6g" revision commit))
942 (source
943 (origin
944 (method git-fetch)
945 (uri (git-reference
946 (url "http://www.kylheku.com/git/man/")
947 (commit commit)))
948 (file-name (git-file-name name version))
949 (sha256
950 (base32 "1zy0g8fj9nsfwzvg88hyaiy94r8j14xhs8vy2ln2niqdm6x2lvy2"))))
951 (build-system gnu-build-system)
952 (arguments
953 `(#:tests? #f ; There are no tests.
954 #:phases
955 (modify-phases %standard-phases
956 (add-after 'unpack 'fix-man2html-makefile
957 (lambda _
958 (substitute* "man2html/Makefile.in"
959 ;; It inadvertently ignores @bindir@.
960 (("^(bindir = \\$\\(DESTDIR\\)\\$\\(PREFIX\\)).*" _ prefix)
961 (string-append prefix "@bindir@\n")))
962 #t))
963 (add-after 'unpack 'delete-generated-files
964 (lambda _
965 (for-each delete-file
966 (append
967 (list "conf_script")
968 (map (lambda (d) (string-append d "/Makefile"))
969 '("." "man" "man2html" "src"))
970 (map (lambda (f) (string-append "src/" f))
971 '("makewhatis.in" "man.conf"
972 "paths.h" "version.h"))))
973 #t))
974 (replace 'configure
975 (lambda* (#:key outputs #:allow-other-keys)
976 (setenv "CC" ,(cc-for-target))
977 ;; Humor the manually written configure script.
978 (invoke "./configure" "+lang" "en" "+fhs"
979 (string-append "-prefix=" (assoc-ref outputs "out")))
980 #t)))))
981 (home-page "http://www.kylheku.com/cgit/man/")
982 (synopsis "Modifications to the man utilities, specifically man2html")
983 (description
984 "This is a fork of the man utilities intended specifically for building
985 the HTML documentation of TXR.")
986 (license license:gpl2))))
987
988 (define-public txr
989 (package
990 (name "txr")
991 (version "282")
992 (source
993 (origin
994 (method git-fetch)
995 (uri (git-reference
996 (url "https://www.kylheku.com/git/txr/")
997 (commit (string-append "txr-" version))))
998 (file-name (git-file-name name version))
999 (sha256
1000 (base32 "1hzni1v9qlh1vy8spz8prink7v9hp2bin15vnyfha2ax306w6dq5"))))
1001 (build-system gnu-build-system)
1002 (arguments
1003 `(#:configure-flags
1004 (list ,(string-append "cc=" (cc-for-target))
1005 (string-append "--prefix=" (assoc-ref %outputs "out")))
1006 #:test-target "tests"
1007 #:phases
1008 (modify-phases %standard-phases
1009 (add-after 'unpack 'fix-license-installation
1010 (lambda* (#:key outputs #:allow-other-keys)
1011 (substitute* "Makefile"
1012 (("INSTALL(,.*LICENSE,.*)\\$\\(datadir\\)" _ match)
1013 (string-append "INSTALL" match
1014 (assoc-ref outputs "out")
1015 "/share/doc/" ,name "-" ,version)))))
1016 (delete 'install-license-files)
1017 (add-after 'unpack 'inhibit-doc-syms-generation
1018 (lambda _
1019 (substitute* "genman.txr"
1020 ;; Exit from genman.txr before it tries to write to
1021 ;; stdlib/doc-syms.tl, which is anyway kept up to date with
1022 ;; each release (and is already compiled to stdlib/doc-syms.tlo
1023 ;; when genman.txr is run).
1024 (("^@\\(output \"stdlib/doc-syms\\.tl\"\\).*" line)
1025 (string-append "@(do (exit))\n" line)))))
1026 (add-after 'unpack 'fix-paths
1027 (lambda* (#:key inputs #:allow-other-keys)
1028 (substitute* "stream.c"
1029 (("/bin/sh")
1030 (string-append (assoc-ref inputs "bash") "/bin/bash")))))
1031 (add-after 'unpack 'fix-tests
1032 (lambda _
1033 (substitute* (list "tests/017/realpath.tl"
1034 "tests/017/realpath.expected")
1035 (("/usr/bin") "/"))))
1036 (replace 'configure
1037 ;; ./configure is a hand-written script that can't handle standard
1038 ;; autotools arguments like CONFIG_SHELL.
1039 (lambda* (#:key configure-flags #:allow-other-keys)
1040 (setenv "txr_shell" (which "bash"))
1041 (apply invoke "./configure" configure-flags)))
1042 (add-after 'build 'build-doc
1043 (lambda _
1044 (setenv "GS_GENERATE_UUIDS" "0")
1045 (invoke "make" "txr-manpage.html" "txr-manpage.pdf")))
1046 (add-after 'install 'install-doc
1047 (lambda* (#:key outputs #:allow-other-keys)
1048 (let ((doc (string-append (assoc-ref outputs "out")
1049 "/share/doc/" ,name "-" ,version)))
1050 (for-each (lambda (f) (install-file f doc))
1051 '("txr-manpage.html" "txr-manpage.pdf")))))
1052 (add-after 'install 'install-vim-files
1053 (lambda* (#:key outputs #:allow-other-keys)
1054 (let* ((out (assoc-ref outputs "out"))
1055 (syntax (string-append out "/share/vim/vimfiles/syntax")))
1056 (install-file "tl.vim" syntax)
1057 (install-file "txr.vim" syntax)))))))
1058 (native-inputs
1059 ;; Required to build the documentation.
1060 (list ghostscript
1061 groff
1062 man-for-txr))
1063 (inputs
1064 (list bash-minimal
1065 libffi
1066 zlib))
1067 (synopsis "General-purpose, multi-paradigm programming language")
1068 (description
1069 "TXR is a general-purpose, multi-paradigm programming language. It
1070 comprises two languages integrated into a single tool: a text scanning and
1071 extraction language referred to as the TXR Pattern Language (sometimes just
1072 \"TXR\"), and a general-purpose dialect of Lisp called TXR Lisp. TXR can be
1073 used for everything from \"one liner\" data transformation tasks at the
1074 command line, to data scanning and extracting scripts, to full application
1075 development in a wide-range of areas.")
1076 (home-page "https://nongnu.org/txr/")
1077 (license license:bsd-2)))
1078
1079 (define picolisp32
1080 (package
1081 (name "picolisp32")
1082 (version "19.12")
1083 (source
1084 (origin
1085 (method url-fetch)
1086 (uri (string-append "https://software-lab.de/picoLisp-" version ".tgz"))
1087 (sha256
1088 (base32 "10np0mhihr47r3201617zccrvzpkhdl1jwvz7zimk8kxpriydq2j"))
1089 (modules '((guix build utils)))
1090 (snippet '(begin
1091 ;; Delete the pre-compiled jar file.
1092 (delete-file "ersatz/picolisp.jar")
1093 #t))))
1094 (build-system gnu-build-system)
1095 (inputs
1096 `(("openssl" ,openssl)))
1097 (arguments
1098 `(#:system ,(match (%current-system)
1099 ((or "armhf-linux" "aarch64-linux")
1100 "armhf-linux")
1101 (_
1102 "i686-linux"))
1103 #:phases
1104 (modify-phases %standard-phases
1105 (delete 'configure)
1106 (add-after 'unpack 'fix-paths
1107 (lambda* (#:key outputs #:allow-other-keys)
1108 (let* ((out (assoc-ref outputs "out"))
1109 (shebang-line (string-append
1110 "#!" out "/bin/picolisp "
1111 out "/lib/picolisp/lib.l")))
1112 (substitute* '("bin/pil"
1113 "bin/pilIndent"
1114 "bin/pilPretty"
1115 "bin/psh"
1116 "bin/replica"
1117 "bin/vip"
1118 "bin/watchdog"
1119 "games/xchess"
1120 "misc/bigtest"
1121 "misc/calc"
1122 "misc/chat"
1123 "misc/mailing"
1124 "src/mkVers")
1125 (("#\\!bin/picolisp lib.l")
1126 shebang-line)
1127 (("#\\!\\.\\./bin/picolisp \\.\\./lib.l")
1128 shebang-line)
1129 (("#\\!/usr/bin/picolisp /usr/lib/picolisp/lib.l")
1130 shebang-line)))
1131 #t))
1132 (add-after 'fix-paths 'make-build-reproducible
1133 (lambda _
1134 (substitute* "src64/lib/asm.l"
1135 (("\\(prinl \"/\\* \" \\(datSym \\(date\\)\\) \" \\*/\\)")
1136 ""))
1137 #t))
1138 (add-after 'make-build-reproducible 'fix-permissions
1139 (lambda _
1140 (for-each make-file-writable
1141 '("doc/family.tgz"
1142 "doc/family64.tgz"
1143 "lib/map"
1144 "src64/tags"))
1145 #t))
1146 (replace 'build
1147 (lambda _
1148 (invoke "make" "-C" "src" "picolisp" "tools" "gate")))
1149 (add-before 'check 'set-home-for-tests
1150 (lambda _
1151 (setenv "HOME" "/tmp")
1152 #t))
1153 (replace 'check
1154 (lambda _
1155 (invoke "./pil" "test/lib.l" "-bye" "+")))
1156 (replace 'install
1157 (lambda* (#:key outputs #:allow-other-keys)
1158 (let* ((out (assoc-ref outputs "out"))
1159 (bin (string-append out "/bin"))
1160 (man (string-append out "/share/man"))
1161 (picolisp (string-append out "/lib/picolisp")))
1162 (copy-recursively "man" man)
1163 (copy-recursively "." picolisp)
1164 (for-each (lambda (name)
1165 (let ((path (string-append picolisp "/" name)))
1166 (delete-file-recursively path)))
1167 '("CHANGES" "COPYING" "CREDITS" "cygwin"
1168 "INSTALL" "man" "pil" "README" "src" "src64"
1169 "test"))
1170 (mkdir-p bin)
1171 (symlink (string-append picolisp "/bin/picolisp")
1172 (string-append bin "/picolisp"))
1173 (symlink (string-append picolisp "/bin/pil")
1174 (string-append bin "/pil")))
1175 #t)))))
1176 (synopsis "Interpreter for the PicoLisp programming language")
1177 (description
1178 "PicoLisp is a programming language, or really a programming system,
1179 including a built-in database engine and a GUI system.")
1180 (home-page "https://picolisp.com/wiki/?home")
1181 (license license:expat)))
1182
1183 (define-public picolisp
1184 (match (%current-system)
1185 ((or "aarch64-linux" "x86_64-linux")
1186 (package
1187 ;; Use the 32-bit picolisp to generate the assembly files required by
1188 ;; the 64-bit picolisp.
1189 (inherit picolisp32)
1190 (name "picolisp")
1191 (native-inputs
1192 (list picolisp32 which))
1193 (arguments
1194 (substitute-keyword-arguments (package-arguments picolisp32)
1195 ((#:system _ "") (%current-system))
1196 ((#:phases phases)
1197 `(modify-phases ,phases
1198 (delete 'fix-paths)
1199 (add-before 'build 'fix-paths
1200 ;; This must run after the other shebang-patching phases,
1201 ;; or they will override our changes.
1202 (lambda* (#:key inputs outputs #:allow-other-keys)
1203 (let* ((picolisp32 (assoc-ref inputs "picolisp32"))
1204 (out (assoc-ref outputs "out"))
1205 (shebang-line (string-append
1206 "#!" out "/bin/picolisp "
1207 out "/lib/picolisp/lib.l")))
1208 (substitute* '("bin/pil"
1209 "bin/pilIndent"
1210 "bin/pilPretty"
1211 "bin/psh"
1212 "bin/replica"
1213 "bin/vip"
1214 "bin/watchdog"
1215 "games/xchess"
1216 "misc/bigtest"
1217 "misc/calc"
1218 "misc/chat"
1219 "misc/mailing"
1220 "src/mkVers")
1221 (("#\\!.*picolisp32.*/bin/picolisp .*lib\\.l")
1222 shebang-line))
1223 (substitute* "src64/mkAsm"
1224 (("/usr/bin/")
1225 (string-append picolisp32 "/bin/"))))
1226 #t))
1227 (replace 'build
1228 (lambda _
1229 (invoke "make" "-C" "src" "tools" "gate")
1230 (invoke "make" "-C" "src64" "CC=gcc" "picolisp")))))))))
1231 (_
1232 (package
1233 (inherit picolisp32)
1234 (name "picolisp")))))
1235
1236 (define-public janet
1237 (package
1238 (name "janet")
1239 (version "1.24.1")
1240 (source
1241 (origin
1242 (method git-fetch)
1243 (uri (git-reference
1244 (url "https://github.com/janet-lang/janet")
1245 (commit (string-append "v" version))))
1246 (file-name (git-file-name name version))
1247 (sha256
1248 (base32 "1zaf2z2x5mgfp2nwj3q6pmcj558mw1772a09xn8b8na0cahxlrmq"))))
1249 (build-system gnu-build-system)
1250 (arguments
1251 (list #:make-flags
1252 #~(list
1253 (string-append "DESTDIR=" #$output)
1254 (string-append "PREFIX=")
1255 (string-append "CC=" #$(cc-for-target)))
1256 #:test-target "test"
1257 #:phases
1258 #~(modify-phases %standard-phases
1259 (delete 'configure))))
1260 (home-page "https://janet-lang.org/")
1261 (synopsis "Functional, imperative and embeddable programming language")
1262 (description
1263 "Janet is a functional and imperative programming language. It can be
1264 used for rapid prototyping, dynamic systems, and other domains where dynamic
1265 languages shine. You can also add Janet scripting to an application by
1266 embedding a single C file and two headers. It can be easily ported to new
1267 platforms. The entire language (core library, interpreter, compiler,
1268 assembler, PEG) is less than 1MB.")
1269 (license license:expat)))
1270
1271 (define-public lisp-repl-core-dumper
1272 (package
1273 (name "lisp-repl-core-dumper")
1274 (version "0.7.0")
1275 (source
1276 (origin
1277 (method git-fetch)
1278 (uri (git-reference
1279 (url "https://gitlab.com/ambrevar/lisp-repl-core-dumper.git")
1280 (commit version)))
1281 (file-name (git-file-name name version))
1282 (sha256
1283 (base32 "0yfsyxj462yi3bx587yssp4gwb54jdm6fjk9q93gjrfv8a65ilp7"))))
1284 (build-system copy-build-system)
1285 (arguments
1286 '(#:install-plan
1287 '(("lisp-repl-core-dumper" "bin/"))
1288 #:phases
1289 (modify-phases %standard-phases
1290 (add-before 'install 'fix-utils-path
1291 (lambda* (#:key inputs #:allow-other-keys)
1292 (let* ((cat (search-input-file inputs "/bin/cat"))
1293 (paste (search-input-file inputs "/bin/paste"))
1294 (sort (search-input-file inputs "/bin/sort"))
1295 (basename (search-input-file inputs "/bin/basename"))
1296 (sed (search-input-file inputs "/bin/sed")))
1297 (substitute* "lisp-repl-core-dumper"
1298 (("\\$\\(basename") (string-append "$(" basename))
1299 (("\\<cat\\>") cat)
1300 (("\\<paste\\>") paste)
1301 (("\\<sed\\>") sed)
1302 (("\\<sort\\>") sort))))))))
1303 (inputs
1304 `(("coreutils" ,coreutils-minimal)
1305 ("sed" ,sed)))
1306 (home-page "https://gitlab.com/ambrevar/lisp-repl-core-dumper")
1307 (synopsis "Generate REPL-optimized Lisp cores on demand")
1308 (description
1309 "This tool generates Lisp images that can embed the provided systems
1310 and make for REPLs that start blazing fast.
1311
1312 @itemize
1313 @item It’s portable and should work with any compiler.
1314 @item It works for any REPL.
1315 @item It allows you to include arbitrary libraries.
1316 @end itemize\n")
1317 (license license:gpl3+)))
1318
1319 (define-public buildapp
1320 (package
1321 (name "buildapp")
1322 (version "1.5.6")
1323 (source
1324 (origin
1325 (method git-fetch)
1326 (uri (git-reference
1327 (url "https://github.com/xach/buildapp")
1328 (commit (string-append "release-" version))))
1329 (file-name (git-file-name name version))
1330 (sha256
1331 (base32 "020ipjfqa3l8skd97cj5kq837wgpj28ygfxnkv64cnjrlbnzh161"))))
1332 (build-system gnu-build-system)
1333 (native-inputs
1334 (list sbcl))
1335 (arguments
1336 `(#:tests? #f
1337 #:make-flags
1338 (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))
1339 #:strip-binaries? #f
1340 #:phases
1341 (modify-phases %standard-phases
1342 (delete 'configure)
1343 (add-after 'unpack 'set-home
1344 (lambda _
1345 (setenv "HOME" "/tmp")
1346 #t))
1347 (add-before 'install 'create-target-directory
1348 (lambda* (#:key outputs #:allow-other-keys)
1349 (let* ((bin (string-append (assoc-ref outputs "out") "/bin")))
1350 (mkdir-p bin)
1351 #t))))))
1352 (home-page "https://www.xach.com/lisp/buildapp/")
1353 (synopsis "Makes easy to build application executables with SBCL")
1354 (description
1355 "Buildapp is an application for SBCL or CCL that configures and saves an
1356 executable Common Lisp image. It is similar to cl-launch and hu.dwim.build.")
1357 (license license:bsd-2)))
1358
1359 (define-public eisl
1360 (package
1361 (name "eisl")
1362 (version "2.63")
1363 (source
1364 (origin
1365 (method git-fetch)
1366 (uri (git-reference
1367 (url "https://github.com/sasagawa888/eisl")
1368 (commit (string-append "v" version))))
1369 (file-name (git-file-name name version))
1370 (sha256
1371 (base32 "01fwffk71c1cvq7pf50xwpl2a32rbghcymllg67wvm07yfw3gi0q"))))
1372 (build-system gnu-build-system)
1373 (inputs
1374 (list bash-minimal freeglut gdbm libiconv ncurses tcl tk))
1375 (native-inputs
1376 (list cppcheck))
1377 (arguments
1378 (list #:make-flags
1379 #~(list (string-append "PREFIX=" #$output)
1380 (string-append "CC=" #$(cc-for-target)))
1381 #:phases
1382 #~(modify-phases %standard-phases
1383 (add-after 'unpack 'fix-paths
1384 (lambda* (#:key inputs #:allow-other-keys)
1385 (substitute* "library/compiler.lsp"
1386 (("\"cc ")
1387 "\"gcc "))
1388 (substitute* "library/tcltk.lsp"
1389 (("c-include \"<tcl/tcl\\.h>\"")
1390 "c-include \"<tcl.h>\"")
1391 (("c-option \"-ltcl -ltk\" linux")
1392 "c-option \"-ltcl8.6 -ltk8.6\" linux"))))
1393 (delete 'configure)
1394 (add-after 'install 'wrap
1395 (lambda* (#:key inputs #:allow-other-keys)
1396 (wrap-program (string-append #$output "/bin/eisl")
1397 `("PATH" prefix
1398 ,(map (lambda (bin)
1399 (string-append (assoc-ref inputs bin) "/bin"))
1400 '("binutils" "coreutils" "gcc" "ld-wrapper")))
1401 `("LIBRARY_PATH" suffix
1402 ,(map (lambda (lib)
1403 (string-append (assoc-ref inputs lib) "/lib"))
1404 '("libc")))))))))
1405 (home-page "https://github.com/sasagawa888/eisl")
1406 (synopsis "Implementation of ISLisp")
1407 (description "Easy ISLISP (eisl) is an implementation of ISLisp which
1408 includes a compiler as well as an interpreter.")
1409 (license (list license:bsd-2 ;; documents/license.txt
1410 license:expat ;; cii/LICENSE
1411 license:gpl2+ ;; nana/gdb/test.c and others under nana/
1412 license:bsd-3)))) ;; bench/*