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> |
f842bbed JD |
5 | ;;; |
6 | ;;; This file is part of GNU Guix. | |
7 | ;;; | |
8 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
9 | ;;; under the terms of the GNU General Public License as published by | |
10 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
11 | ;;; your option) any later version. | |
12 | ;;; | |
13 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
14 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | ;;; GNU General Public License for more details. | |
17 | ;;; | |
18 | ;;; You should have received a copy of the GNU General Public License | |
19 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
20 | ||
21 | (define-module (gnu packages lisp) | |
22 | #:use-module (gnu packages) | |
b5b73a82 | 23 | #:use-module ((guix licenses) #:prefix license:) |
f842bbed JD |
24 | #:use-module (guix packages) |
25 | #:use-module (gnu packages readline) | |
26 | #:use-module (gnu packages texinfo) | |
27 | #:use-module (gnu packages texlive) | |
28 | #:use-module (gnu packages m4) | |
29 | #:use-module (guix download) | |
30 | #:use-module (guix utils) | |
00ab9458 | 31 | #:use-module (guix build-system gnu) |
ce0614dd | 32 | #:use-module (gnu packages base) |
00ab9458 TUBK |
33 | #:use-module (gnu packages multiprecision) |
34 | #:use-module (gnu packages bdw-gc) | |
560f51d0 TUBK |
35 | #:use-module (gnu packages libffi) |
36 | #:use-module (gnu packages libffcall) | |
37 | #:use-module (gnu packages readline) | |
b702b52d TUBK |
38 | #:use-module (gnu packages libsigsegv) |
39 | #:use-module (gnu packages admin) | |
531a9aac TUBK |
40 | #:use-module (gnu packages ed) |
41 | #:use-module (gnu packages m4) | |
42 | #:use-module (gnu packages version-control) | |
43 | #:use-module (ice-9 match)) | |
f842bbed JD |
44 | |
45 | (define-public gcl | |
46 | (package | |
47 | (name "gcl") | |
e6c1e91d | 48 | (version "2.6.12") |
f842bbed JD |
49 | (source |
50 | (origin | |
51 | (method url-fetch) | |
52 | (uri (string-append "mirror://gnu/" name "/" name "-" version ".tar.gz")) | |
53 | (sha256 | |
e6c1e91d | 54 | (base32 "1s4hs2qbjqmn9h88l4xvsifq5c3dlc5s74lyb61rdi5grhdlkf4f")))) |
f842bbed JD |
55 | (build-system gnu-build-system) |
56 | (arguments | |
57 | `(#:parallel-build? #f ; The build system seems not to be thread safe. | |
58 | #:tests? #f ; There does not seem to be make check or anything similar. | |
59 | #:configure-flags '("--enable-ansi") ; required for use by the maxima package | |
60 | #:phases (alist-cons-before | |
61 | 'configure 'pre-conf | |
62 | (lambda _ | |
63 | ;; Patch bug when building readline support. This bug was | |
64 | ;; also observed by Debian | |
65 | ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=741819 | |
66 | (substitute* "o/gcl_readline.d" | |
67 | (("rl_attempted_completion_function = \\(CPPFunction \\*\\)rl_completion;") | |
68 | "rl_attempted_completion_function = rl_completion;")) | |
69 | (substitute* | |
70 | (append | |
71 | '("pcl/impl/kcl/makefile.akcl" | |
72 | "add-defs" | |
73 | "unixport/makefile.dos" | |
74 | "add-defs.bat" | |
75 | "gcl-tk/makefile.prev" | |
76 | "add-defs1") | |
77 | (find-files "h" "\\.defs")) | |
78 | (("SHELL=/bin/(ba)?sh") | |
79 | (string-append "SHELL=" (which "bash"))))) | |
46251411 AE |
80 | ;; drop strip phase to make maxima build, see |
81 | ;; https://www.ma.utexas.edu/pipermail/maxima/2008/009769.html | |
82 | (alist-delete 'strip | |
83 | %standard-phases)))) | |
f842bbed JD |
84 | (native-inputs |
85 | `(("m4" ,m4) | |
86 | ("readline" ,readline) | |
87 | ("texinfo" ,texinfo) | |
88 | ("texlive" ,texlive))) | |
89 | (home-page "http://www.gnu.org/software/gcl") | |
a2b63d58 | 90 | (synopsis "A Common Lisp implementation") |
f842bbed JD |
91 | (description "GCL is an implementation of the Common Lisp language. It |
92 | features the ability to compile to native object code and to load native | |
93 | object code modules directly into its lisp core. It also features a | |
94 | stratified garbage collection strategy, a source-level debugger and a built-in | |
95 | interface to the Tk widget system.") | |
96 | (license license:lgpl2.0+))) | |
97 | ||
00ab9458 TUBK |
98 | (define-public ecl |
99 | (package | |
100 | (name "ecl") | |
cb03a9b6 | 101 | (version "15.2.21") |
00ab9458 TUBK |
102 | (source |
103 | (origin | |
104 | (method url-fetch) | |
105 | (uri (string-append "mirror://sourceforge/ecls/ecls/" | |
106 | (version-major+minor version) | |
107 | "/ecl-" version ".tgz")) | |
108 | (sha256 | |
cb03a9b6 | 109 | (base32 "05di23v977byf67rq5bdshw8lqbby1ycbscdcl1vca0z6r1s204j")))) |
00ab9458 | 110 | (build-system gnu-build-system) |
cb03a9b6 | 111 | ;; src/configure uses 'which' to confirm the existence of 'gzip'. |
00ab9458 TUBK |
112 | (native-inputs `(("which" ,which))) |
113 | (inputs `(("gmp" ,gmp) | |
114 | ("libatomic-ops" ,libatomic-ops) | |
115 | ("libgc" ,libgc) | |
116 | ("libffi" ,libffi))) | |
117 | (arguments | |
cb03a9b6 TUBK |
118 | '(#:tests? #f |
119 | ;; During 'make check', ECL fails to initialize with "protocol not | |
120 | ;; supported", presumably because /etc/protocols is missing in the | |
121 | ;; build environment. See <http://sourceforge.net/p/ecls/bugs/300/>. | |
122 | ;; | |
123 | ;; Should the test suite be re-enabled, it might be necessary to add | |
124 | ;; '#:parallel-tests #f'. See the same bug report as above. | |
125 | ;; | |
126 | ;; The following might also be necessary, due to 'make check' assuming | |
127 | ;; ECL is installed. See <http://sourceforge.net/p/ecls/bugs/299/>. | |
128 | ;; | |
129 | ;; #:phases | |
130 | ;; (let* ((check-phase (assq-ref %standard-phases 'check)) | |
131 | ;; (rearranged-phases | |
132 | ;; (alist-cons-after 'install 'check check-phase | |
133 | ;; (alist-delete 'check %standard-phases)))) | |
134 | ;; (alist-cons-before | |
135 | ;; 'check 'pre-check | |
136 | ;; (lambda* (#:key outputs #:allow-other-keys) | |
137 | ;; (substitute* '("build/tests/Makefile") | |
138 | ;; (("ECL=ecl") | |
139 | ;; (string-append | |
140 | ;; "ECL=" (assoc-ref outputs "out") "/bin/ecl")))) | |
141 | ;; rearranged-phases)) | |
142 | )) | |
00ab9458 TUBK |
143 | (home-page "http://ecls.sourceforge.net/") |
144 | (synopsis "Embeddable Common Lisp") | |
145 | (description "ECL is an implementation of the Common Lisp language as | |
146 | defined by the ANSI X3J13 specification. Its most relevant features are: a | |
147 | bytecode compiler and interpreter, being able to compile Common Lisp with any | |
148 | C/C++ compiler, being able to build standalone executables and libraries, and | |
149 | supporting ASDF, Sockets, Gray streams, MOP, and other useful components.") | |
150 | ;; Note that the file "Copyright" points to some files and directories | |
151 | ;; which aren't under the lgpl2.0+ and instead contain many different, | |
152 | ;; non-copyleft licenses. | |
153 | (license license:lgpl2.0+))) | |
560f51d0 TUBK |
154 | |
155 | (define-public clisp | |
156 | (package | |
157 | (name "clisp") | |
158 | (version "2.49") | |
159 | (source | |
160 | (origin | |
161 | (method url-fetch) | |
162 | (uri (string-append "mirror://gnu/clisp/release/" version | |
163 | "/clisp-" version ".tar.gz")) | |
164 | (sha256 | |
165 | (base32 "0rp82nqp5362isl9i34rwgg04cidz7izljd9d85pqcw1qr964bxx")))) | |
166 | (build-system gnu-build-system) | |
167 | (inputs `(("libffcall" ,libffcall) | |
168 | ("readline" ,readline) | |
169 | ("libsigsegv" ,libsigsegv))) | |
170 | (arguments | |
171 | '(#:phases | |
172 | (alist-cons-after | |
173 | 'unpack 'patch-sh-and-pwd | |
174 | (lambda _ | |
175 | ;; The package is very messy with its references to "/bin/sh" and | |
176 | ;; some other absolute paths to traditional tools. These appear in | |
177 | ;; many places where our automatic patching misses them. Therefore | |
178 | ;; we do the following, in this early (post-unpack) phase, to solve | |
179 | ;; the problem from its root. | |
180 | (substitute* (find-files "." "configure|Makefile") | |
181 | (("/bin/sh") "sh")) | |
182 | (substitute* '("src/clisp-link.in") | |
183 | (("/bin/pwd") "pwd"))) | |
184 | (alist-cons-before | |
185 | 'build 'chdir-to-source | |
186 | (lambda _ | |
187 | ;; We are supposed to call make under the src sub-directory. | |
188 | (chdir "src")) | |
189 | %standard-phases)) | |
190 | ;; Makefiles seem to have race conditions. | |
191 | #:parallel-build? #f)) | |
192 | (home-page "http://www.clisp.org/") | |
4cc78cb3 LC |
193 | (synopsis "A Common Lisp implementation") |
194 | (description | |
195 | "GNU CLISP is an implementation of ANSI Common Lisp. Common Lisp is a | |
196 | high-level, object-oriented functional programming language. CLISP includes | |
197 | an interpreter, a compiler, a debugger, and much more.") | |
560f51d0 TUBK |
198 | ;; Website says gpl2+, COPYRIGHT file says gpl2; actual source files have |
199 | ;; a lot of gpl3+. (Also some parts are under non-copyleft licenses, such | |
200 | ;; as CLX by Texas Instruments.) In that case gpl3+ wins out. | |
201 | (license license:gpl3+))) | |
b702b52d TUBK |
202 | |
203 | (define-public sbcl | |
204 | (package | |
205 | (name "sbcl") | |
206 | (version "1.2.8") | |
207 | (source | |
208 | (origin | |
209 | (method url-fetch) | |
210 | (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-" | |
211 | version "-source.tar.bz2")) | |
212 | (sha256 | |
213 | (base32 "0ab9lw056yf6y0rjmx3iirn5n59pmssqxf00fbmpyl6qsnpaja1d")))) | |
214 | (build-system gnu-build-system) | |
215 | ;; Bootstrap with CLISP. | |
216 | (native-inputs | |
217 | `(("clisp" ,clisp) | |
218 | ("which" ,which) | |
219 | ("inetutils" ,inetutils) ;for hostname(1) | |
220 | ("ed" ,ed))) | |
221 | (arguments | |
222 | '(#:phases | |
223 | (alist-delete | |
224 | 'configure | |
225 | (alist-cons-before | |
226 | 'build 'patch-unix-tool-paths | |
227 | (lambda* (#:key outputs inputs #:allow-other-keys) | |
228 | (let ((out (assoc-ref outputs "out")) | |
229 | (bash (assoc-ref inputs "bash")) | |
230 | (coreutils (assoc-ref inputs "coreutils")) | |
231 | (ed (assoc-ref inputs "ed"))) | |
232 | (define (quoted-path input path) | |
233 | (string-append "\"" input path "\"")) | |
234 | ;; Patch absolute paths in string literals. Note that this | |
e396976b MW |
235 | ;; occurs in some .sh files too (which contain Lisp code). Use |
236 | ;; ISO-8859-1 because some of the files are ISO-8859-1 encoded. | |
237 | (with-fluids ((%default-port-encoding #f)) | |
238 | (substitute* (find-files "." "\\.(lisp|sh)$") | |
239 | (("\"/bin/sh\"") (quoted-path bash "/bin/sh")) | |
240 | (("\"/usr/bin/env\"") (quoted-path coreutils "/usr/bin/env")) | |
241 | (("\"/bin/cat\"") (quoted-path coreutils "/bin/cat")) | |
242 | (("\"/bin/ed\"") (quoted-path ed "/bin/ed")) | |
243 | (("\"/bin/echo\"") (quoted-path coreutils "/bin/echo")) | |
244 | (("\"/bin/uname\"") (quoted-path coreutils "/bin/uname")))) | |
b702b52d TUBK |
245 | ;; This one script has a non-string occurrence of /bin/sh. |
246 | (substitute* '("tests/foreign.test.sh") | |
247 | ;; Leave whitespace so we don't match the shebang. | |
248 | ((" /bin/sh ") " sh ")) | |
249 | ;; This file contains a module that can create executable files | |
250 | ;; which depend on the presence of SBCL. It generates shell | |
251 | ;; scripts doing "exec sbcl ..." to achieve this. We patch both | |
252 | ;; the shebang and the reference to "sbcl", tying the generated | |
253 | ;; executables to the exact SBCL package that generated them. | |
254 | (substitute* '("contrib/sb-executable/sb-executable.lisp") | |
255 | (("/bin/sh") (string-append bash "/bin/sh")) | |
256 | (("exec sbcl") (string-append "exec " out "/bin/sbcl"))) | |
257 | ;; Disable some tests that fail in our build environment. | |
258 | (substitute* '("contrib/sb-bsd-sockets/tests.lisp") | |
259 | ;; This requires /etc/protocols. | |
260 | (("\\(deftest get-protocol-by-name/error" all) | |
261 | (string-append "#+nil ;disabled by Guix\n" all))) | |
262 | (substitute* '("contrib/sb-posix/posix-tests.lisp") | |
263 | ;; These assume some users/groups which we don't have. | |
264 | (("\\(deftest pwent\\.[12]" all) | |
265 | (string-append "#+nil ;disabled by Guix\n" all)) | |
266 | (("\\(deftest grent\\.[12]" all) | |
267 | (string-append "#+nil ;disabled by Guix\n" all))))) | |
268 | (alist-replace | |
269 | 'build | |
270 | (lambda* (#:key outputs #:allow-other-keys) | |
271 | (setenv "CC" "gcc") | |
272 | (zero? (system* "sh" "make.sh" "clisp" | |
273 | (string-append "--prefix=" | |
274 | (assoc-ref outputs "out"))))) | |
275 | (alist-replace | |
276 | 'install | |
277 | (lambda _ | |
278 | (zero? (system* "sh" "install.sh"))) | |
279 | %standard-phases)))) | |
280 | ;; No 'check' target, though "make.sh" (build phase) runs tests. | |
281 | #:tests? #f)) | |
282 | (home-page "http://www.sbcl.org/") | |
283 | (synopsis "Common Lisp implementation") | |
284 | (description "Steel Bank Common Lisp (SBCL) is a high performance Common | |
285 | Lisp compiler. In addition to the compiler and runtime system for ANSI Common | |
286 | Lisp, it provides an interactive environment including a debugger, a | |
287 | statistical profiler, a code coverage tool, and many other extensions.") | |
288 | ;; Public domain in jurisdictions that allow it, bsd-2 otherwise. MIT | |
289 | ;; loop macro has its own license. See COPYING file for further notes. | |
290 | (license (list license:public-domain license:bsd-2 | |
291 | (license:x11-style "file://src/code/loop.lisp"))))) | |
531a9aac TUBK |
292 | |
293 | (define-public ccl | |
294 | (package | |
295 | (name "ccl") | |
296 | (version "1.10") | |
297 | (source #f) | |
298 | (build-system gnu-build-system) | |
299 | ;; CCL consists of a "lisp kernel" and "heap image", both of which are | |
300 | ;; shipped in precompiled form in source tarballs. The former is a C | |
301 | ;; program which we can rebuild from scratch, but the latter cannot be | |
302 | ;; generated without an already working copy of CCL, and is platform | |
303 | ;; dependent, so we need to fetch the correct tarball for the platform. | |
304 | (inputs | |
305 | `(("ccl" | |
306 | ,(origin | |
307 | (method url-fetch) | |
308 | (uri (string-append | |
309 | "ftp://ftp.clozure.com/pub/release/1.10/ccl-" version "-" | |
310 | (match (%current-system) | |
311 | ((or "i686-linux" "x86_64-linux") "linuxx86") | |
312 | ("armhf-linux" "linuxarm")) | |
313 | ".tar.gz")) | |
314 | (sha256 | |
315 | (base32 | |
316 | (match (%current-system) | |
317 | ((or "i686-linux" "x86_64-linux") | |
318 | "0mr653q5px05lr11z2mk551m5g47b4wq96vbfibpp0qlc9jp58lc") | |
319 | ("armhf" | |
320 | "1py02irpmi2qz5rq3h33wfv6impf15z8i2rign6hvhlqn7s99wwh")))))))) | |
321 | (native-inputs | |
322 | `(("m4" ,m4) | |
323 | ("subversion" ,subversion))) | |
324 | (arguments | |
325 | `(#:tests? #f ;no 'check' target | |
326 | #:phases | |
327 | (alist-replace | |
328 | 'unpack | |
329 | (lambda* (#:key inputs #:allow-other-keys) | |
330 | (and (zero? (system* "tar" "xzvf" (assoc-ref inputs "ccl"))) | |
331 | (begin (chdir "ccl") #t))) | |
332 | (alist-delete | |
333 | 'configure | |
334 | (alist-cons-before | |
335 | 'build 'pre-build | |
336 | ;; Enter the source directory for the current platform's lisp | |
337 | ;; kernel, and run 'make clean' to remove the precompiled one. | |
338 | (lambda _ | |
339 | (chdir (string-append | |
340 | "lisp-kernel/" | |
341 | ,(match (or (%current-target-system) (%current-system)) | |
342 | ("i686-linux" "linuxx8632") | |
343 | ("x86_64-linux" "linuxx8664") | |
344 | ("armhf-linux" "linuxarm")))) | |
345 | (substitute* '("Makefile") | |
346 | (("/bin/rm") "rm")) | |
347 | (setenv "CC" "gcc") | |
348 | (zero? (system* "make" "clean"))) | |
349 | ;; XXX Do we need to recompile the heap image as well for Guix? | |
350 | ;; For now just use the one we already got in the tarball. | |
351 | (alist-replace | |
352 | 'install | |
353 | (lambda* (#:key outputs inputs #:allow-other-keys) | |
354 | ;; The lisp kernel built by running 'make' in lisp-kernel/$system | |
355 | ;; is put back into the original directory, so go back. The heap | |
356 | ;; image is there as well. | |
357 | (chdir "../..") | |
358 | (let* ((out (assoc-ref outputs "out")) | |
359 | (libdir (string-append out "/lib/")) | |
360 | (bindir (string-append out "/bin/")) | |
361 | (wrapper (string-append bindir "ccl")) | |
362 | (bash (assoc-ref inputs "bash")) | |
363 | (kernel | |
364 | ,(match (or (%current-target-system) (%current-system)) | |
365 | ("i686-linux" "lx86cl") | |
366 | ("x86_64-linux" "lx86cl64") | |
367 | ("armhf-linux" "armcl"))) | |
368 | (heap (string-append kernel ".image"))) | |
369 | (mkdir-p libdir) | |
370 | (mkdir-p bindir) | |
371 | (copy-file kernel (string-append libdir kernel)) | |
372 | (copy-file heap (string-append libdir heap)) | |
373 | (with-output-to-file wrapper | |
374 | (lambda () | |
375 | (display | |
376 | (string-append | |
377 | "#!" bash "/bin/sh\n" | |
378 | "if [ -z \"$CCL_DEFAULT_DIRECTORY\" ]; then\n" | |
379 | " CCL_DEFAULT_DIRECTORY=" libdir "\n" | |
380 | "fi\n" | |
381 | "export CCL_DEFAULT_DIRECTORY\n" | |
382 | "exec " libdir kernel "\n")))) | |
383 | (chmod wrapper #o755))) | |
384 | %standard-phases)))))) | |
385 | (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux")) | |
386 | (home-page "http://ccl.clozure.com/") | |
387 | (synopsis "Common Lisp implementation") | |
388 | (description "Clozure CL (often called CCL for short) is a Common Lisp | |
389 | implementation featuring fast compilation speed, native threads, a precise, | |
390 | generational, compacting garbage collector, and a convenient foreign-function | |
391 | interface.") | |
392 | ;; See file doc/LICENSE for clarifications it makes regarding how the LGPL | |
393 | ;; applies to Lisp code according to them. | |
394 | (license (list license:lgpl2.1 | |
395 | license:clarified-artistic)))) ;TRIVIAL-LDAP package |