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