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