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