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