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