gnu: Add emacs-slime.
[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>
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
a124bbd2 62 (lambda _
f842bbed
JD
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"
a124bbd2
SB
67 (("rl_attempted_completion_function = \
68\\(CPPFunction \\*\\)rl_completion;")
f842bbed 69 "rl_attempted_completion_function = rl_completion;"))
a124bbd2
SB
70 (substitute*
71 (append
f842bbed
JD
72 '("pcl/impl/kcl/makefile.akcl"
73 "add-defs"
74 "unixport/makefile.dos"
75 "add-defs.bat"
76 "gcl-tk/makefile.prev"
77 "add-defs1")
78 (find-files "h" "\\.defs"))
79 (("SHELL=/bin/(ba)?sh")
80 (string-append "SHELL=" (which "bash")))))
46251411
AE
81 ;; drop strip phase to make maxima build, see
82 ;; https://www.ma.utexas.edu/pipermail/maxima/2008/009769.html
83 (alist-delete 'strip
84 %standard-phases))))
f842bbed
JD
85 (native-inputs
86 `(("m4" ,m4)
87 ("readline" ,readline)
88 ("texinfo" ,texinfo)
89 ("texlive" ,texlive)))
90 (home-page "http://www.gnu.org/software/gcl")
a2b63d58 91 (synopsis "A Common Lisp implementation")
f842bbed
JD
92 (description "GCL is an implementation of the Common Lisp language. It
93features the ability to compile to native object code and to load native
94object code modules directly into its lisp core. It also features a
95stratified garbage collection strategy, a source-level debugger and a built-in
96interface to the Tk widget system.")
97 (license license:lgpl2.0+)))
98
00ab9458
TUBK
99(define-public ecl
100 (package
101 (name "ecl")
cb03a9b6 102 (version "15.2.21")
00ab9458
TUBK
103 (source
104 (origin
105 (method url-fetch)
106 (uri (string-append "mirror://sourceforge/ecls/ecls/"
107 (version-major+minor version)
108 "/ecl-" version ".tgz"))
109 (sha256
cb03a9b6 110 (base32 "05di23v977byf67rq5bdshw8lqbby1ycbscdcl1vca0z6r1s204j"))))
00ab9458 111 (build-system gnu-build-system)
cb03a9b6 112 ;; src/configure uses 'which' to confirm the existence of 'gzip'.
00ab9458
TUBK
113 (native-inputs `(("which" ,which)))
114 (inputs `(("gmp" ,gmp)
115 ("libatomic-ops" ,libatomic-ops)
116 ("libgc" ,libgc)
117 ("libffi" ,libffi)))
118 (arguments
a124bbd2 119 '(;; During 'make check', ECL fails to initialize with "protocol not
cb03a9b6
TUBK
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))
a124bbd2 142 #:tests? #f))
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
146defined by the ANSI X3J13 specification. Its most relevant features are: a
147bytecode compiler and interpreter, being able to compile Common Lisp with any
148C/C++ compiler, being able to build standalone executables and libraries, and
149supporting 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
f90ef3c3
MW
171 '(;; XXX The custom configure script does not cope well when passed
172 ;; --build=<triplet>.
173 #:build #f
174 #:phases
560f51d0
TUBK
175 (alist-cons-after
176 'unpack 'patch-sh-and-pwd
177 (lambda _
178 ;; The package is very messy with its references to "/bin/sh" and
179 ;; some other absolute paths to traditional tools. These appear in
180 ;; many places where our automatic patching misses them. Therefore
181 ;; we do the following, in this early (post-unpack) phase, to solve
182 ;; the problem from its root.
183 (substitute* (find-files "." "configure|Makefile")
184 (("/bin/sh") "sh"))
185 (substitute* '("src/clisp-link.in")
186 (("/bin/pwd") "pwd")))
187 (alist-cons-before
188 'build 'chdir-to-source
189 (lambda _
190 ;; We are supposed to call make under the src sub-directory.
191 (chdir "src"))
192 %standard-phases))
193 ;; Makefiles seem to have race conditions.
194 #:parallel-build? #f))
195 (home-page "http://www.clisp.org/")
4cc78cb3
LC
196 (synopsis "A Common Lisp implementation")
197 (description
198 "GNU CLISP is an implementation of ANSI Common Lisp. Common Lisp is a
199high-level, object-oriented functional programming language. CLISP includes
200an interpreter, a compiler, a debugger, and much more.")
560f51d0
TUBK
201 ;; Website says gpl2+, COPYRIGHT file says gpl2; actual source files have
202 ;; a lot of gpl3+. (Also some parts are under non-copyleft licenses, such
203 ;; as CLX by Texas Instruments.) In that case gpl3+ wins out.
204 (license license:gpl3+)))
b702b52d
TUBK
205
206(define-public sbcl
207 (package
208 (name "sbcl")
209 (version "1.2.8")
210 (source
211 (origin
212 (method url-fetch)
213 (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-"
214 version "-source.tar.bz2"))
215 (sha256
216 (base32 "0ab9lw056yf6y0rjmx3iirn5n59pmssqxf00fbmpyl6qsnpaja1d"))))
217 (build-system gnu-build-system)
218 ;; Bootstrap with CLISP.
219 (native-inputs
220 `(("clisp" ,clisp)
221 ("which" ,which)
222 ("inetutils" ,inetutils) ;for hostname(1)
223 ("ed" ,ed)))
224 (arguments
225 '(#:phases
226 (alist-delete
227 'configure
228 (alist-cons-before
229 'build 'patch-unix-tool-paths
230 (lambda* (#:key outputs inputs #:allow-other-keys)
231 (let ((out (assoc-ref outputs "out"))
232 (bash (assoc-ref inputs "bash"))
233 (coreutils (assoc-ref inputs "coreutils"))
234 (ed (assoc-ref inputs "ed")))
235 (define (quoted-path input path)
236 (string-append "\"" input path "\""))
237 ;; Patch absolute paths in string literals. Note that this
e396976b
MW
238 ;; occurs in some .sh files too (which contain Lisp code). Use
239 ;; ISO-8859-1 because some of the files are ISO-8859-1 encoded.
240 (with-fluids ((%default-port-encoding #f))
241 (substitute* (find-files "." "\\.(lisp|sh)$")
242 (("\"/bin/sh\"") (quoted-path bash "/bin/sh"))
243 (("\"/usr/bin/env\"") (quoted-path coreutils "/usr/bin/env"))
244 (("\"/bin/cat\"") (quoted-path coreutils "/bin/cat"))
245 (("\"/bin/ed\"") (quoted-path ed "/bin/ed"))
246 (("\"/bin/echo\"") (quoted-path coreutils "/bin/echo"))
247 (("\"/bin/uname\"") (quoted-path coreutils "/bin/uname"))))
b702b52d
TUBK
248 ;; This one script has a non-string occurrence of /bin/sh.
249 (substitute* '("tests/foreign.test.sh")
250 ;; Leave whitespace so we don't match the shebang.
251 ((" /bin/sh ") " sh "))
252 ;; This file contains a module that can create executable files
253 ;; which depend on the presence of SBCL. It generates shell
254 ;; scripts doing "exec sbcl ..." to achieve this. We patch both
255 ;; the shebang and the reference to "sbcl", tying the generated
256 ;; executables to the exact SBCL package that generated them.
257 (substitute* '("contrib/sb-executable/sb-executable.lisp")
258 (("/bin/sh") (string-append bash "/bin/sh"))
259 (("exec sbcl") (string-append "exec " out "/bin/sbcl")))
260 ;; Disable some tests that fail in our build environment.
261 (substitute* '("contrib/sb-bsd-sockets/tests.lisp")
262 ;; This requires /etc/protocols.
263 (("\\(deftest get-protocol-by-name/error" all)
264 (string-append "#+nil ;disabled by Guix\n" all)))
265 (substitute* '("contrib/sb-posix/posix-tests.lisp")
266 ;; These assume some users/groups which we don't have.
267 (("\\(deftest pwent\\.[12]" all)
268 (string-append "#+nil ;disabled by Guix\n" all))
269 (("\\(deftest grent\\.[12]" all)
270 (string-append "#+nil ;disabled by Guix\n" all)))))
271 (alist-replace
272 'build
273 (lambda* (#:key outputs #:allow-other-keys)
274 (setenv "CC" "gcc")
275 (zero? (system* "sh" "make.sh" "clisp"
276 (string-append "--prefix="
277 (assoc-ref outputs "out")))))
278 (alist-replace
279 'install
280 (lambda _
281 (zero? (system* "sh" "install.sh")))
282 %standard-phases))))
283 ;; No 'check' target, though "make.sh" (build phase) runs tests.
284 #:tests? #f))
285 (home-page "http://www.sbcl.org/")
286 (synopsis "Common Lisp implementation")
287 (description "Steel Bank Common Lisp (SBCL) is a high performance Common
288Lisp compiler. In addition to the compiler and runtime system for ANSI Common
289Lisp, it provides an interactive environment including a debugger, a
290statistical profiler, a code coverage tool, and many other extensions.")
291 ;; Public domain in jurisdictions that allow it, bsd-2 otherwise. MIT
292 ;; loop macro has its own license. See COPYING file for further notes.
293 (license (list license:public-domain license:bsd-2
294 (license:x11-style "file://src/code/loop.lisp")))))
531a9aac
TUBK
295
296(define-public ccl
297 (package
298 (name "ccl")
299 (version "1.10")
300 (source #f)
301 (build-system gnu-build-system)
302 ;; CCL consists of a "lisp kernel" and "heap image", both of which are
303 ;; shipped in precompiled form in source tarballs. The former is a C
304 ;; program which we can rebuild from scratch, but the latter cannot be
305 ;; generated without an already working copy of CCL, and is platform
306 ;; dependent, so we need to fetch the correct tarball for the platform.
307 (inputs
308 `(("ccl"
309 ,(origin
310 (method url-fetch)
311 (uri (string-append
312 "ftp://ftp.clozure.com/pub/release/1.10/ccl-" version "-"
313 (match (%current-system)
314 ((or "i686-linux" "x86_64-linux") "linuxx86")
42f11801
MW
315 ("armhf-linux" "linuxarm")
316 ;; Prevent errors when querying this package on unsupported
317 ;; platforms, e.g. when running "guix package --search="
318 (_ "UNSUPPORTED"))
531a9aac
TUBK
319 ".tar.gz"))
320 (sha256
321 (base32
322 (match (%current-system)
323 ((or "i686-linux" "x86_64-linux")
324 "0mr653q5px05lr11z2mk551m5g47b4wq96vbfibpp0qlc9jp58lc")
42f11801
MW
325 ("armhf-linux"
326 "1py02irpmi2qz5rq3h33wfv6impf15z8i2rign6hvhlqn7s99wwh")
327 (_ ""))))))))
531a9aac
TUBK
328 (native-inputs
329 `(("m4" ,m4)
330 ("subversion" ,subversion)))
331 (arguments
332 `(#:tests? #f ;no 'check' target
333 #:phases
334 (alist-replace
335 'unpack
336 (lambda* (#:key inputs #:allow-other-keys)
337 (and (zero? (system* "tar" "xzvf" (assoc-ref inputs "ccl")))
338 (begin (chdir "ccl") #t)))
339 (alist-delete
340 'configure
341 (alist-cons-before
342 'build 'pre-build
343 ;; Enter the source directory for the current platform's lisp
344 ;; kernel, and run 'make clean' to remove the precompiled one.
345 (lambda _
346 (chdir (string-append
347 "lisp-kernel/"
348 ,(match (or (%current-target-system) (%current-system))
76eb7266 349 ("i686-linux" "linuxx8632")
531a9aac 350 ("x86_64-linux" "linuxx8664")
76eb7266
MW
351 ("armhf-linux" "linuxarm")
352 ;; Prevent errors when querying this package
353 ;; on unsupported platforms, e.g. when running
354 ;; "guix package --search="
355 (_ "UNSUPPORTED"))))
531a9aac
TUBK
356 (substitute* '("Makefile")
357 (("/bin/rm") "rm"))
358 (setenv "CC" "gcc")
359 (zero? (system* "make" "clean")))
360 ;; XXX Do we need to recompile the heap image as well for Guix?
361 ;; For now just use the one we already got in the tarball.
362 (alist-replace
363 'install
364 (lambda* (#:key outputs inputs #:allow-other-keys)
365 ;; The lisp kernel built by running 'make' in lisp-kernel/$system
366 ;; is put back into the original directory, so go back. The heap
367 ;; image is there as well.
368 (chdir "../..")
369 (let* ((out (assoc-ref outputs "out"))
370 (libdir (string-append out "/lib/"))
371 (bindir (string-append out "/bin/"))
372 (wrapper (string-append bindir "ccl"))
373 (bash (assoc-ref inputs "bash"))
374 (kernel
375 ,(match (or (%current-target-system) (%current-system))
76eb7266 376 ("i686-linux" "lx86cl")
531a9aac 377 ("x86_64-linux" "lx86cl64")
76eb7266
MW
378 ("armhf-linux" "armcl")
379 ;; Prevent errors when querying this package
380 ;; on unsupported platforms, e.g. when running
381 ;; "guix package --search="
382 (_ "UNSUPPORTED")))
531a9aac
TUBK
383 (heap (string-append kernel ".image")))
384 (mkdir-p libdir)
385 (mkdir-p bindir)
386 (copy-file kernel (string-append libdir kernel))
387 (copy-file heap (string-append libdir heap))
388 (with-output-to-file wrapper
389 (lambda ()
390 (display
391 (string-append
392 "#!" bash "/bin/sh\n"
393 "if [ -z \"$CCL_DEFAULT_DIRECTORY\" ]; then\n"
394 " CCL_DEFAULT_DIRECTORY=" libdir "\n"
395 "fi\n"
396 "export CCL_DEFAULT_DIRECTORY\n"
397 "exec " libdir kernel "\n"))))
398 (chmod wrapper #o755)))
399 %standard-phases))))))
400 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
401 (home-page "http://ccl.clozure.com/")
402 (synopsis "Common Lisp implementation")
403 (description "Clozure CL (often called CCL for short) is a Common Lisp
404implementation featuring fast compilation speed, native threads, a precise,
405generational, compacting garbage collector, and a convenient foreign-function
406interface.")
407 ;; See file doc/LICENSE for clarifications it makes regarding how the LGPL
408 ;; applies to Lisp code according to them.
409 (license (list license:lgpl2.1
410 license:clarified-artistic)))) ;TRIVIAL-LDAP package