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