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