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