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