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