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