gnu: clisp: Remove ineffective 'remove-timestamp' phase.
[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>
4a78fd46 6;;; Copyright © 2016, 2017 Nils Gillmann <ng0@n0.is>
14afc7b8 7;;; Copyright © 2016, 2017 Andy Patterson <ajpatter@uwaterloo.ca>
636c77d0 8;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
f3cd6633 9;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
5dff0752 10;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
f842bbed
JD
11;;;
12;;; This file is part of GNU Guix.
13;;;
14;;; GNU Guix is free software; you can redistribute it and/or modify it
15;;; under the terms of the GNU General Public License as published by
16;;; the Free Software Foundation; either version 3 of the License, or (at
17;;; your option) any later version.
18;;;
19;;; GNU Guix is distributed in the hope that it will be useful, but
20;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;;; GNU General Public License for more details.
23;;;
24;;; You should have received a copy of the GNU General Public License
25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27(define-module (gnu packages lisp)
28 #:use-module (gnu packages)
b5b73a82 29 #:use-module ((guix licenses) #:prefix license:)
f842bbed
JD
30 #:use-module (guix packages)
31 #:use-module (gnu packages readline)
32 #:use-module (gnu packages texinfo)
8f9ac901 33 #:use-module (gnu packages tex)
f842bbed
JD
34 #:use-module (gnu packages m4)
35 #:use-module (guix download)
423eef36 36 #:use-module (guix git-download)
f473b8f1 37 #:use-module (guix hg-download)
f842bbed 38 #:use-module (guix utils)
00ab9458 39 #:use-module (guix build-system gnu)
a72debb7 40 #:use-module (guix build-system asdf)
e3e171ee 41 #:use-module (guix build-system trivial)
ce0614dd 42 #:use-module (gnu packages base)
05c63898 43 #:use-module (gnu packages compression)
44 #:use-module (gnu packages fontutils)
45 #:use-module (gnu packages maths)
00ab9458 46 #:use-module (gnu packages multiprecision)
f473b8f1 47 #:use-module (gnu packages ncurses)
00ab9458 48 #:use-module (gnu packages bdw-gc)
560f51d0
TUBK
49 #:use-module (gnu packages libffi)
50 #:use-module (gnu packages libffcall)
51 #:use-module (gnu packages readline)
05c63898 52 #:use-module (gnu packages sdl)
b702b52d 53 #:use-module (gnu packages libsigsegv)
05c63898 54 #:use-module (gnu packages linux)
b702b52d 55 #:use-module (gnu packages admin)
531a9aac 56 #:use-module (gnu packages ed)
05c63898 57 #:use-module (gnu packages gl)
58 #:use-module (gnu packages gcc)
59 #:use-module (gnu packages glib)
60 #:use-module (gnu packages gettext)
531a9aac 61 #:use-module (gnu packages m4)
05c63898 62 #:use-module (gnu packages pkg-config)
531a9aac 63 #:use-module (gnu packages version-control)
05c63898 64 #:use-module (gnu packages xorg)
419fb3f1 65 #:use-module (ice-9 match)
66 #:use-module (srfi srfi-1))
f842bbed 67
8d0489ae
AP
68(define (asdf-substitutions lisp)
69 ;; Prepend XDG_DATA_DIRS/LISP-bundle-systems to ASDF's
70 ;; 'default-system-source-registry'.
71 `((("\\(,dir \"systems/\"\\)\\)")
72 (format #f
73 "(,dir \"~a-bundle-systems\")))
74
75 ,@(loop :for dir :in (xdg-data-dirs \"common-lisp/\")
76 :collect `(:directory (,dir \"systems\"))"
77 ,lisp))))
78
f842bbed 79(define-public gcl
dd0134fc
KK
80 (let ((commit "5956140b1083e2302a59d7ce2054b0b7c2cbb417")
81 (revision "1")) ;Guix package revision
82 (package
83 (name "gcl")
84 (version (string-append "2.6.12-" revision "."
85 (string-take commit 7)))
86 (source
87 (origin
88 (method git-fetch)
89 (uri (git-reference
90 (url "https://git.savannah.gnu.org/r/gcl.git")
91 (commit commit)))
92 (file-name (string-append "gcl-" version "-checkout"))
93 (sha256
94 (base32 "0mwclf2879mh3d9xqkqhghf58lwy7srsnsq9x0f1cc6j302sy4hb"))))
95 (build-system gnu-build-system)
96 (arguments
97 `(#:parallel-build? #f ; The build system seems not to be thread safe.
98 #:tests? #f ; There does not seem to be make check or anything similar.
99 #:configure-flags '("--enable-ansi") ; required for use by the maxima package
100 #:make-flags (list
101 (string-append "GCL_CC=" (assoc-ref %build-inputs "gcc")
102 "/bin/gcc")
103 (string-append "CC=" (assoc-ref %build-inputs "gcc")
104 "/bin/gcc"))
105 #:phases
106 (modify-phases %standard-phases
107 (add-before 'configure 'pre-conf
108 (lambda* (#:key inputs #:allow-other-keys)
109 (chdir "gcl")
110 (substitute*
111 (append
112 '("pcl/impl/kcl/makefile.akcl"
113 "add-defs"
114 "unixport/makefile.dos"
115 "add-defs.bat"
116 "gcl-tk/makefile.prev"
117 "add-defs1")
118 (find-files "h" "\\.defs"))
119 (("SHELL=/bin/bash")
120 (string-append "SHELL=" (which "bash")))
121 (("SHELL=/bin/sh")
122 (string-append "SHELL=" (which "sh"))))
123 (substitute* "h/linux.defs"
124 (("#CC") "CC")
125 (("-fwritable-strings") "")
126 (("-Werror") ""))
127 (substitute* "lsp/gcl_top.lsp"
128 (("\"cc\"")
129 (string-append "\"" (assoc-ref %build-inputs "gcc")
130 "/bin/gcc\""))
131 (("\\(or \\(get-path \\*cc\\*\\) \\*cc\\*\\)") "*cc*")
132 (("\"ld\"")
133 (string-append "\"" (assoc-ref %build-inputs "binutils")
134 "/bin/ld\""))
135 (("\\(or \\(get-path \\*ld\\*\\) \\*ld\\*\\)") "*ld*")
136 (("\\(get-path \"objdump --source \"\\)")
137 (string-append "\"" (assoc-ref %build-inputs "binutils")
138 "/bin/objdump --source \"")))
139 #t))
140 (add-after 'install 'wrap
141 (lambda* (#:key inputs outputs #:allow-other-keys)
142 (let* ((gcl (assoc-ref outputs "out"))
143 (input-path (lambda (lib path)
144 (string-append
145 (assoc-ref inputs lib) path)))
146 (binaries '("binutils")))
147 ;; GCC and the GNU binutils are necessary for GCL to be
148 ;; able to compile Lisp functions and programs (this is
149 ;; a standard feature in Common Lisp). While the
150 ;; the location of GCC is specified in the make-flags,
151 ;; the GNU binutils must be available in GCL's $PATH.
152 (wrap-program (string-append gcl "/bin/gcl")
153 `("PATH" prefix ,(map (lambda (binary)
154 (input-path binary "/bin"))
155 binaries))))
156 #t))
157 ;; drop strip phase to make maxima build, see
158 ;; https://www.ma.utexas.edu/pipermail/maxima/2008/009769.html
159 (delete 'strip))))
160 (inputs
161 `(("gmp" ,gmp)
162 ("readline" ,readline)))
163 (native-inputs
164 `(("gcc" ,gcc-4.9)
165 ("m4" ,m4)
166 ("texinfo" ,texinfo)
167 ("texlive" ,texlive)))
168 (home-page "https://www.gnu.org/software/gcl/")
169 (synopsis "A Common Lisp implementation")
170 (description "GCL is an implementation of the Common Lisp language. It
f842bbed
JD
171features the ability to compile to native object code and to load native
172object code modules directly into its lisp core. It also features a
173stratified garbage collection strategy, a source-level debugger and a built-in
174interface to the Tk widget system.")
dd0134fc 175 (license license:lgpl2.0+))))
f842bbed 176
00ab9458
TUBK
177(define-public ecl
178 (package
179 (name "ecl")
108f69c4 180 (version "16.1.3")
00ab9458
TUBK
181 (source
182 (origin
183 (method url-fetch)
e0524511
AP
184 (uri (string-append
185 "https://common-lisp.net/project/ecl/static/files/release/"
186 name "-" version ".tgz"))
00ab9458 187 (sha256
108f69c4 188 (base32 "0m0j24w5d5a9dwwqyrg0d35c0nys16ijb4r0nyk87yp82v38b9bn"))
fb7dc6d6
AP
189 (modules '((guix build utils)))
190 (snippet
191 ;; Add ecl-bundle-systems to 'default-system-source-registry'.
192 `(substitute* "contrib/asdf/asdf.lisp"
193 ,@(asdf-substitutions name)))))
00ab9458 194 (build-system gnu-build-system)
cb03a9b6 195 ;; src/configure uses 'which' to confirm the existence of 'gzip'.
00ab9458
TUBK
196 (native-inputs `(("which" ,which)))
197 (inputs `(("gmp" ,gmp)
198 ("libatomic-ops" ,libatomic-ops)
199 ("libgc" ,libgc)
200 ("libffi" ,libffi)))
201 (arguments
60474cd1 202 '(#:tests? #t
60474cd1
AP
203 #:parallel-tests? #f
204 #:phases
205 (modify-phases %standard-phases
206 (delete 'check)
54a43ff4
AP
207 (add-after 'install 'wrap
208 (lambda* (#:key inputs outputs #:allow-other-keys)
209 (let* ((ecl (assoc-ref outputs "out"))
210 (input-path (lambda (lib path)
211 (string-append
212 (assoc-ref inputs lib) path)))
213 (libraries '("gmp" "libatomic-ops" "libgc" "libffi" "libc"))
214 (binaries '("gcc" "ld-wrapper" "binutils"))
215 (library-directories
216 (map (lambda (lib) (input-path lib "/lib"))
217 libraries)))
218
219 (wrap-program (string-append ecl "/bin/ecl")
220 `("PATH" prefix
221 ,(map (lambda (binary)
222 (input-path binary "/bin"))
223 binaries))
224 `("CPATH" suffix
225 ,(map (lambda (lib)
226 (input-path lib "/include"))
932b2ea2 227 `("kernel-headers" ,@libraries)))
54a43ff4
AP
228 `("LIBRARY_PATH" suffix ,library-directories)
229 `("LD_LIBRARY_PATH" suffix ,library-directories)))))
108f69c4
AP
230 (add-after 'wrap 'check (assoc-ref %standard-phases 'check))
231 (add-before 'check 'fix-path-to-ecl
232 (lambda _
233 (substitute* "build/tests/Makefile"
234 (("\\$\\{exec_prefix\\}/") ""))
235 #t)))))
fb7dc6d6
AP
236 (native-search-paths
237 (list (search-path-specification
238 (variable "XDG_DATA_DIRS")
239 (files '("share")))))
00ab9458
TUBK
240 (home-page "http://ecls.sourceforge.net/")
241 (synopsis "Embeddable Common Lisp")
242 (description "ECL is an implementation of the Common Lisp language as
243defined by the ANSI X3J13 specification. Its most relevant features are: a
244bytecode compiler and interpreter, being able to compile Common Lisp with any
245C/C++ compiler, being able to build standalone executables and libraries, and
246supporting ASDF, Sockets, Gray streams, MOP, and other useful components.")
247 ;; Note that the file "Copyright" points to some files and directories
248 ;; which aren't under the lgpl2.0+ and instead contain many different,
249 ;; non-copyleft licenses.
250 (license license:lgpl2.0+)))
560f51d0
TUBK
251
252(define-public clisp
253 (package
254 (name "clisp")
f473b8f1 255 (version "2.49-60")
560f51d0
TUBK
256 (source
257 (origin
f473b8f1
EF
258 (method hg-fetch)
259 (uri (hg-reference
260 (url "http://hg.code.sf.net/p/clisp/clisp")
261 (changeset "clisp_2_49_60-2017-06-25")))
262 (file-name (string-append name "-" version "-checkout"))
560f51d0 263 (sha256
f473b8f1 264 (base32 "0qjv3z274rbdmb941hy03hl63f4z7bmci234f8dyz4skgfr82d3i"))
75033216
KK
265 (patches (search-patches "clisp-glibc-2.26.patch"
266 "clisp-remove-failing-test.patch"))))
560f51d0
TUBK
267 (build-system gnu-build-system)
268 (inputs `(("libffcall" ,libffcall)
f473b8f1
EF
269 ("ncurses" ,ncurses)
270 ("readline" ,readline)
560f51d0
TUBK
271 ("libsigsegv" ,libsigsegv)))
272 (arguments
f3cd6633 273 '(#:configure-flags '("--enable-portability"
f473b8f1
EF
274 "--with-dynamic-ffi"
275 "--with-dynamic-modules"
f473b8f1 276 "--with-module=rawsock")
f90ef3c3
MW
277 #:build #f
278 #:phases
636c77d0
RW
279 (modify-phases %standard-phases
280 (add-after 'unpack 'patch-sh-and-pwd
281 (lambda _
282 ;; The package is very messy with its references to "/bin/sh" and
283 ;; some other absolute paths to traditional tools. These appear in
284 ;; many places where our automatic patching misses them. Therefore
285 ;; we do the following, in this early (post-unpack) phase, to solve
286 ;; the problem from its root.
287 (substitute* (find-files "." "configure|Makefile")
288 (("/bin/sh") "sh"))
289 (substitute* '("src/clisp-link.in")
290 (("/bin/pwd") "pwd"))
636c77d0 291 #t)))
560f51d0
TUBK
292 ;; Makefiles seem to have race conditions.
293 #:parallel-build? #f))
294 (home-page "http://www.clisp.org/")
4cc78cb3
LC
295 (synopsis "A Common Lisp implementation")
296 (description
297 "GNU CLISP is an implementation of ANSI Common Lisp. Common Lisp is a
298high-level, object-oriented functional programming language. CLISP includes
299an interpreter, a compiler, a debugger, and much more.")
560f51d0
TUBK
300 ;; Website says gpl2+, COPYRIGHT file says gpl2; actual source files have
301 ;; a lot of gpl3+. (Also some parts are under non-copyleft licenses, such
302 ;; as CLX by Texas Instruments.) In that case gpl3+ wins out.
303 (license license:gpl3+)))
b702b52d
TUBK
304
305(define-public sbcl
306 (package
307 (name "sbcl")
3a52bb71 308 (version "1.4.4")
b702b52d
TUBK
309 (source
310 (origin
311 (method url-fetch)
312 (uri (string-append "mirror://sourceforge/sbcl/sbcl/" version "/sbcl-"
313 version "-source.tar.bz2"))
314 (sha256
3a52bb71 315 (base32 "1k6v5b8qv7vyxvh8asx6phf2hbapx5pp5p5j47hgnq123fwnh4fa"))
8d0489ae
AP
316 (modules '((guix build utils)))
317 (snippet
318 ;; Add sbcl-bundle-systems to 'default-system-source-registry'.
319 `(substitute* "contrib/asdf/asdf.lisp"
320 ,@(asdf-substitutions name)))))
b702b52d 321 (build-system gnu-build-system)
05f5ce0c 322 (outputs '("out" "doc"))
b702b52d
TUBK
323 ;; Bootstrap with CLISP.
324 (native-inputs
325 `(("clisp" ,clisp)
326 ("which" ,which)
327 ("inetutils" ,inetutils) ;for hostname(1)
05f5ce0c
FB
328 ("ed" ,ed)
329 ("texlive" ,texlive)
330 ("texinfo" ,texinfo)))
b702b52d 331 (arguments
f0b7dc7e
ST
332 '(#:modules ((guix build gnu-build-system)
333 (guix build utils)
334 (srfi srfi-1))
335 #:phases
1ee131df
FB
336 (modify-phases %standard-phases
337 (delete 'configure)
338 (add-before 'build 'patch-unix-tool-paths
339 (lambda* (#:key outputs inputs #:allow-other-keys)
340 (let ((out (assoc-ref outputs "out"))
341 (bash (assoc-ref inputs "bash"))
342 (coreutils (assoc-ref inputs "coreutils"))
343 (ed (assoc-ref inputs "ed")))
344 (define (quoted-path input path)
345 (string-append "\"" input path "\""))
346 ;; Patch absolute paths in string literals. Note that this
347 ;; occurs in some .sh files too (which contain Lisp code). Use
348 ;; ISO-8859-1 because some of the files are ISO-8859-1 encoded.
349 (with-fluids ((%default-port-encoding #f))
1925a879
AP
350 ;; The removed file is utf-16-be encoded, which gives substitute*
351 ;; trouble. It does not contain references to the listed programs.
352 (substitute* (delete
353 "./tests/data/compile-file-pos-utf16be.lisp"
354 (find-files "." "\\.(lisp|sh)$"))
1ee131df
FB
355 (("\"/bin/sh\"") (quoted-path bash "/bin/sh"))
356 (("\"/usr/bin/env\"") (quoted-path coreutils "/usr/bin/env"))
357 (("\"/bin/cat\"") (quoted-path coreutils "/bin/cat"))
358 (("\"/bin/ed\"") (quoted-path ed "/bin/ed"))
359 (("\"/bin/echo\"") (quoted-path coreutils "/bin/echo"))
360 (("\"/bin/uname\"") (quoted-path coreutils "/bin/uname"))))
361 ;; This one script has a non-string occurrence of /bin/sh.
362 (substitute* '("tests/foreign.test.sh")
363 ;; Leave whitespace so we don't match the shebang.
364 ((" /bin/sh ") " sh "))
365 ;; This file contains a module that can create executable files
366 ;; which depend on the presence of SBCL. It generates shell
367 ;; scripts doing "exec sbcl ..." to achieve this. We patch both
368 ;; the shebang and the reference to "sbcl", tying the generated
369 ;; executables to the exact SBCL package that generated them.
370 (substitute* '("contrib/sb-executable/sb-executable.lisp")
371 (("/bin/sh") (string-append bash "/bin/sh"))
372 (("exec sbcl") (string-append "exec " out "/bin/sbcl")))
373 ;; Disable some tests that fail in our build environment.
374 (substitute* '("contrib/sb-bsd-sockets/tests.lisp")
375 ;; This requires /etc/protocols.
376 (("\\(deftest get-protocol-by-name/error" all)
377 (string-append "#+nil ;disabled by Guix\n" all)))
378 (substitute* '("contrib/sb-posix/posix-tests.lisp")
379 ;; These assume some users/groups which we don't have.
380 (("\\(deftest pwent\\.[12]" all)
381 (string-append "#+nil ;disabled by Guix\n" all))
382 (("\\(deftest grent\\.[12]" all)
383 (string-append "#+nil ;disabled by Guix\n" all))))))
384 (replace 'build
385 (lambda* (#:key outputs #:allow-other-keys)
386 (setenv "CC" "gcc")
387 (zero? (system* "sh" "make.sh" "clisp"
388 (string-append "--prefix="
389 (assoc-ref outputs "out"))))))
390 (replace 'install
b702b52d 391 (lambda _
05f5ce0c
FB
392 (zero? (system* "sh" "install.sh"))))
393 (add-after 'build 'build-doc
394 (lambda _
395 (with-directory-excursion "doc/manual"
396 (and (zero? (system* "make" "info"))
397 (zero? (system* "make" "dist"))))))
398 (add-after 'install 'install-doc
399 (lambda* (#:key outputs #:allow-other-keys)
400 (let* ((out (assoc-ref outputs "out"))
401 (doc (assoc-ref outputs "doc"))
402 (old-doc-dir (string-append out "/share/doc"))
403 (new-doc/sbcl-dir (string-append doc "/share/doc/sbcl")))
404 (rmdir (string-append old-doc-dir "/sbcl/html"))
405 (mkdir-p new-doc/sbcl-dir)
406 (copy-recursively (string-append old-doc-dir "/sbcl")
407 new-doc/sbcl-dir)
408 (delete-file-recursively old-doc-dir)
409 #t))))
1ee131df
FB
410 ;; No 'check' target, though "make.sh" (build phase) runs tests.
411 #:tests? #f))
8d0489ae
AP
412 (native-search-paths
413 (list (search-path-specification
414 (variable "XDG_DATA_DIRS")
415 (files '("share")))))
b702b52d
TUBK
416 (home-page "http://www.sbcl.org/")
417 (synopsis "Common Lisp implementation")
418 (description "Steel Bank Common Lisp (SBCL) is a high performance Common
419Lisp compiler. In addition to the compiler and runtime system for ANSI Common
420Lisp, it provides an interactive environment including a debugger, a
421statistical profiler, a code coverage tool, and many other extensions.")
422 ;; Public domain in jurisdictions that allow it, bsd-2 otherwise. MIT
423 ;; loop macro has its own license. See COPYING file for further notes.
424 (license (list license:public-domain license:bsd-2
425 (license:x11-style "file://src/code/loop.lisp")))))
531a9aac
TUBK
426
427(define-public ccl
428 (package
429 (name "ccl")
04ab38b7 430 (version "1.11.5")
531a9aac
TUBK
431 (source #f)
432 (build-system gnu-build-system)
433 ;; CCL consists of a "lisp kernel" and "heap image", both of which are
434 ;; shipped in precompiled form in source tarballs. The former is a C
435 ;; program which we can rebuild from scratch, but the latter cannot be
436 ;; generated without an already working copy of CCL, and is platform
437 ;; dependent, so we need to fetch the correct tarball for the platform.
438 (inputs
439 `(("ccl"
440 ,(origin
441 (method url-fetch)
442 (uri (string-append
04ab38b7 443 "https://github.com/Clozure/ccl/releases/download/v" version
3701f014 444 "/ccl-" version "-"
531a9aac
TUBK
445 (match (%current-system)
446 ((or "i686-linux" "x86_64-linux") "linuxx86")
42f11801
MW
447 ("armhf-linux" "linuxarm")
448 ;; Prevent errors when querying this package on unsupported
449 ;; platforms, e.g. when running "guix package --search="
450 (_ "UNSUPPORTED"))
531a9aac
TUBK
451 ".tar.gz"))
452 (sha256
453 (base32
454 (match (%current-system)
455 ((or "i686-linux" "x86_64-linux")
04ab38b7 456 "0hs1f3z7crgzvinpj990kv9gvbsipxvcvwbmk54n51nasvc5025q")
42f11801 457 ("armhf-linux"
04ab38b7 458 "0p0l1dzsygb6i1xxgbipjpxkn46xhq3jm41a34ga1qqp4x8lkr62")
42f11801 459 (_ ""))))))))
531a9aac
TUBK
460 (native-inputs
461 `(("m4" ,m4)
462 ("subversion" ,subversion)))
463 (arguments
464 `(#:tests? #f ;no 'check' target
fc7d5a34
AP
465 #:modules ((srfi srfi-26)
466 (guix build utils)
467 (guix build gnu-build-system))
531a9aac 468 #:phases
dc1d3cde
KK
469 (modify-phases %standard-phases
470 (replace 'unpack
471 (lambda* (#:key inputs #:allow-other-keys)
472 (and (zero? (system* "tar" "xzvf" (assoc-ref inputs "ccl")))
473 (begin (chdir "ccl") #t))))
474 (delete 'configure)
475 (add-before 'build 'pre-build
476 ;; Enter the source directory for the current platform's lisp
477 ;; kernel, and run 'make clean' to remove the precompiled one.
478 (lambda _
bcc65510
EF
479 (substitute* "lisp-kernel/m4macros.m4"
480 (("/bin/pwd") (which "pwd")))
dc1d3cde
KK
481 (chdir (string-append
482 "lisp-kernel/"
483 ,(match (or (%current-target-system) (%current-system))
484 ("i686-linux" "linuxx8632")
485 ("x86_64-linux" "linuxx8664")
486 ("armhf-linux" "linuxarm")
487 ;; Prevent errors when querying this package
488 ;; on unsupported platforms, e.g. when running
489 ;; "guix package --search="
490 (_ "UNSUPPORTED"))))
491 (substitute* '("Makefile")
492 (("/bin/rm") "rm"))
493 (setenv "CC" "gcc")
494 (zero? (system* "make" "clean"))))
495 ;; XXX Do we need to recompile the heap image as well for Guix?
496 ;; For now just use the one we already got in the tarball.
497 (replace 'install
531a9aac
TUBK
498 (lambda* (#:key outputs inputs #:allow-other-keys)
499 ;; The lisp kernel built by running 'make' in lisp-kernel/$system
500 ;; is put back into the original directory, so go back. The heap
501 ;; image is there as well.
502 (chdir "../..")
503 (let* ((out (assoc-ref outputs "out"))
504 (libdir (string-append out "/lib/"))
505 (bindir (string-append out "/bin/"))
506 (wrapper (string-append bindir "ccl"))
507 (bash (assoc-ref inputs "bash"))
508 (kernel
509 ,(match (or (%current-target-system) (%current-system))
76eb7266 510 ("i686-linux" "lx86cl")
531a9aac 511 ("x86_64-linux" "lx86cl64")
76eb7266
MW
512 ("armhf-linux" "armcl")
513 ;; Prevent errors when querying this package
514 ;; on unsupported platforms, e.g. when running
515 ;; "guix package --search="
516 (_ "UNSUPPORTED")))
531a9aac 517 (heap (string-append kernel ".image")))
fc7d5a34
AP
518 (install-file kernel libdir)
519 (install-file heap libdir)
520
521 (let ((dirs '("lib" "library" "examples" "contrib"
522 "tools" "objc-bridge")))
523 (for-each copy-recursively
524 dirs
525 (map (cut string-append libdir <>) dirs)))
526
531a9aac 527 (mkdir-p bindir)
531a9aac
TUBK
528 (with-output-to-file wrapper
529 (lambda ()
530 (display
531 (string-append
532 "#!" bash "/bin/sh\n"
58b24078 533 "CCL_DEFAULT_DIRECTORY=" libdir "\n"
531a9aac
TUBK
534 "export CCL_DEFAULT_DIRECTORY\n"
535 "exec " libdir kernel "\n"))))
dc1d3cde
KK
536 (chmod wrapper #o755))
537 #t)))))
531a9aac
TUBK
538 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
539 (home-page "http://ccl.clozure.com/")
540 (synopsis "Common Lisp implementation")
541 (description "Clozure CL (often called CCL for short) is a Common Lisp
542implementation featuring fast compilation speed, native threads, a precise,
543generational, compacting garbage collector, and a convenient foreign-function
544interface.")
545 ;; See file doc/LICENSE for clarifications it makes regarding how the LGPL
546 ;; applies to Lisp code according to them.
547 (license (list license:lgpl2.1
548 license:clarified-artistic)))) ;TRIVIAL-LDAP package
423eef36 549
995e5092 550(define-public femtolisp
551 (let ((commit "68c5b1225572ecf2c52baf62f928063e5a30511b")
552 (revision "1"))
553 (package
554 (name "femtolisp")
555 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
556 (source (origin
557 (method git-fetch)
558 (uri (git-reference
559 (url "https://github.com/JeffBezanson/femtolisp.git")
560 (commit commit)))
561 (file-name (string-append name "-" version "-checkout"))
562 (sha256
563 (base32
564 "04rnwllxnl86zw8c6pwxznn49bvkvh0f1lfliy085vjzvlq3rgja"))))
419fb3f1 565 ;; See "utils.h" for supported systems. Upstream bug:
566 ;; https://github.com/JeffBezanson/femtolisp/issues/25
567 (supported-systems
568 (fold delete %supported-systems
dc00f635 569 '("armhf-linux" "mips64el-linux" "aarch64-linux")))
995e5092 570 (build-system gnu-build-system)
571 (arguments
f7fe5f7a 572 `(#:make-flags '("CC=gcc" "release")
573 #:test-target "test"
995e5092 574 #:phases
575 (modify-phases %standard-phases
576 (delete 'configure) ; No configure script
995e5092 577 (replace 'install ; Makefile has no 'install phase
578 (lambda* (#:key outputs #:allow-other-keys)
579 (let* ((out (assoc-ref outputs "out"))
580 (bin (string-append out "/bin")))
581 (install-file "flisp" bin)
582 #t)))
583 ;; The flisp binary is now available, run bootstrap to
584 ;; generate flisp.boot and afterwards runs make test.
585 (add-after 'install 'bootstrap-gen-and-test
586 (lambda* (#:key outputs #:allow-other-keys)
587 (let* ((out (assoc-ref outputs "out"))
588 (bin (string-append out "/bin")))
589 (and
590 (zero? (system* "./bootstrap.sh"))
591 (install-file "flisp.boot" bin))))))))
592 (synopsis "Scheme-like lisp implementation")
593 (description
594 "@code{femtolisp} is a scheme-like lisp implementation with a
595simple, elegant Scheme dialect. It is a lisp-1 with lexical scope.
596The core is 12 builtin special forms and 33 builtin functions.")
597 (home-page "https://github.com/JeffBezanson/femtolisp")
598 (license license:bsd-3))))
a72debb7 599
05c63898 600(define-public lush2
601 (package
602 (name "lush2")
603 (version "2.0.1")
604 (source
605 (origin
606 (method url-fetch)
607 (uri (string-append "mirror://sourceforge/lush/lush2/lush-"
608 version ".tar.gz"))
609 (modules '((guix build utils)))
610 (snippet
611 '(begin
612 (substitute* "src/unix.c"
613 (("\\{ \"LUSH_DATE\", __DATE__ \\},") "")
614 (("\\{ \"LUSH_TIME\", __TIME__ \\},") ""))
615 (substitute* "src/main.c"
616 (("\" \\(built \" __DATE__ \"\\)\"") ""))))
617 (sha256
618 (base32
619 "02pkfn3nqdkm9fm44911dbcz0v3r0l53vygj8xigl6id5g3iwi4k"))))
620 (build-system gnu-build-system)
621 (arguments
622 `(;; We have to add these LIBS so that they are found.
623 #:configure-flags (list "LIBS=-lz"
624 "X_EXTRA_LIBS=-lfontconfig"
625 "--with-x")
626 #:tests? #f)) ; No make check.
627 (native-inputs `(("intltool" ,intltool)))
628 (inputs
629 `(("alsa-lib" ,alsa-lib)
630 ("sdl" ,sdl)
631 ("sdl-image" ,sdl-image)
632 ("sdl-mixer" ,sdl-mixer)
633 ("sdl-net" ,sdl-net)
634 ("sdl-ttf" ,sdl-ttf)
635 ("lapack" ,lapack)
636 ("libxft" ,libxft)
637 ("fontconfig" ,fontconfig)
638 ("gsl" ,gsl)
639 ("openblas" ,openblas)
640 ("glu" ,glu)
641 ("mesa" ,mesa)
642 ("mesa-utils" ,mesa-utils)
643 ("binutils" ,binutils)
644 ("libiberty" ,libiberty)
645 ("readline" ,readline)
646 ("zlib" ,zlib)
647 ("gettext-minimal" ,gettext-minimal)))
648 (synopsis "Lisp Universal Shell")
649 (description
650 "Lush is an object-oriented Lisp interpreter/compiler with features
651designed to please people who want to prototype large numerical
652applications. Lush includes an extensive library of
653vector/matrix/tensor manipulation, numerous numerical libraries
654(including GSL, LAPACK, and BLAS), a set of graphic functions, a
655simple GUI toolkit, and interfaces to various graphic and multimedia
656libraries such as OpenGL, SDL, Video4Linux, and ALSA (video/audio
657grabbing), and others. Lush is an ideal frontend script language for
658programming projects written in C or other languages. Lush also has
659libraries for Machine Learning, Neural Nets and statistical estimation.")
660 (home-page "http://lush.sourceforge.net/")
661 (license license:lgpl2.1+)))
662
a72debb7
AP
663(define-public sbcl-alexandria
664 (let ((revision "1")
665 (commit "926a066611b7b11cb71e26c827a271e500888c30"))
666 (package
667 (name "sbcl-alexandria")
668 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
669 (source
670 (origin
671 (method git-fetch)
672 (uri (git-reference
673 (url "https://gitlab.common-lisp.net/alexandria/alexandria.git")
674 (commit commit)))
675 (sha256
676 (base32
677 "18yncicdkh294j05rhgm23gzi36y9qy6vrfba8vg69jrxjp1hx8l"))
678 (file-name (string-append "alexandria-" version "-checkout"))))
679 (build-system asdf-build-system/sbcl)
680 (synopsis "Collection of portable utilities for Common Lisp")
681 (description
682 "Alexandria is a collection of portable utilities. It does not contain
683conceptual extensions to Common Lisp. It is conservative in scope, and
684portable between implementations.")
685 (home-page "https://common-lisp.net/project/alexandria/")
686 (license license:public-domain))))
687
688(define-public cl-alexandria
689 (sbcl-package->cl-source-package sbcl-alexandria))
690
691(define-public ecl-alexandria
692 (sbcl-package->ecl-package sbcl-alexandria))
86022c92
AP
693
694(define-public sbcl-fiveam
695 (package
696 (name "sbcl-fiveam")
697 (version "1.2")
698 (source
699 (origin
700 (method url-fetch)
701 (uri (string-append
702 "https://github.com/sionescu/fiveam/archive/v"
703 version ".tar.gz"))
704 (sha256
705 (base32 "0f48pcbhqs3wwwzjl5nk57d4hcbib4l9xblxc66b8c2fhvhmhxnv"))
706 (file-name (string-append "fiveam-" version ".tar.gz"))))
0e1371be 707 (inputs `(("alexandria" ,sbcl-alexandria)))
86022c92
AP
708 (build-system asdf-build-system/sbcl)
709 (synopsis "Common Lisp testing framework")
710 (description "FiveAM is a simple (as far as writing and running tests
711goes) regression testing framework. It has been designed with Common Lisp's
712interactive development model in mind.")
713 (home-page "https://common-lisp.net/project/fiveam/")
714 (license license:bsd-3)))
715
716(define-public cl-fiveam
717 (sbcl-package->cl-source-package sbcl-fiveam))
718
719(define-public ecl-fiveam
720 (sbcl-package->ecl-package sbcl-fiveam))
8662809d
AP
721
722(define-public sbcl-bordeaux-threads
543cf6fd
AP
723 (let ((commit "354abb0ae9f1d9324001e1a8abab3128d7420e0e")
724 (revision "1"))
725 (package
726 (name "sbcl-bordeaux-threads")
727 (version (git-version "0.8.5" revision commit))
728 (source (origin
729 (method git-fetch)
730 (uri (git-reference
731 (url "https://github.com/sionescu/bordeaux-threads.git")
732 (commit commit)))
733 (sha256
734 (base32 "1hcfp21l6av1xj6z7r77sp6h4mwf9vvx4s745803sysq2qy2mwnq"))
735 (file-name
736 (git-file-name "bordeaux-threads" version))))
737 (inputs `(("alexandria" ,sbcl-alexandria)))
738 (native-inputs `(("fiveam" ,sbcl-fiveam)))
739 (build-system asdf-build-system/sbcl)
740 (synopsis "Portable shared-state concurrency library for Common Lisp")
741 (description "BORDEAUX-THREADS is a proposed standard for a minimal
8662809d
AP
742MP/Threading interface. It is similar to the CLIM-SYS threading and lock
743support.")
543cf6fd
AP
744 (home-page "https://common-lisp.net/project/bordeaux-threads/")
745 (license license:x11))))
8662809d
AP
746
747(define-public cl-bordeaux-threads
748 (sbcl-package->cl-source-package sbcl-bordeaux-threads))
749
750(define-public ecl-bordeaux-threads
751 (sbcl-package->ecl-package sbcl-bordeaux-threads))
059cab30
AP
752
753(define-public sbcl-trivial-gray-streams
754 (let ((revision "1")
755 (commit "0483ade330508b4b2edeabdb47d16ec9437ee1cb"))
756 (package
757 (name "sbcl-trivial-gray-streams")
758 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
759 (source
760 (origin
761 (method git-fetch)
762 (uri
763 (git-reference
764 (url "https://github.com/trivial-gray-streams/trivial-gray-streams.git")
765 (commit commit)))
766 (sha256
767 (base32 "0m3rpf2x0zmdk3nf1qfa01j6a55vj7gkwhyw78qslcgbjlgh8p4d"))
768 (file-name
769 (string-append "trivial-gray-streams-" version "-checkout"))))
770 (build-system asdf-build-system/sbcl)
771 (synopsis "Compatibility layer for Gray streams implementations")
772 (description "Gray streams is an interface proposed for inclusion with
773ANSI CL by David N. Gray. The proposal did not make it into ANSI CL, but most
774popular CL implementations implement it. This package provides an extremely
775thin compatibility layer for gray streams.")
776 (home-page "http://www.cliki.net/trivial-gray-streams")
777 (license license:x11))))
778
779(define-public cl-trivial-gray-streams
780 (sbcl-package->cl-source-package sbcl-trivial-gray-streams))
781
782(define-public ecl-trivial-gray-streams
783 (sbcl-package->ecl-package sbcl-trivial-gray-streams))
3c55c780
AP
784
785(define-public sbcl-flexi-streams
786 (package
787 (name "sbcl-flexi-streams")
5dff0752 788 (version "1.0.16")
3c55c780
AP
789 (source
790 (origin
791 (method url-fetch)
792 (uri (string-append
793 "https://github.com/edicl/flexi-streams/archive/v"
794 version ".tar.gz"))
795 (sha256
5dff0752 796 (base32 "1fb0jrwxr5c3i2lhy7kn30m1n0vggfzwjm1dacx6y5wf9wfsbamw"))
3c55c780
AP
797 (file-name (string-append "flexi-streams-" version ".tar.gz"))))
798 (build-system asdf-build-system/sbcl)
0e1371be 799 (inputs `(("trivial-gray-streams" ,sbcl-trivial-gray-streams)))
3c55c780
AP
800 (synopsis "Implementation of virtual bivalent streams for Common Lisp")
801 (description "Flexi-streams is an implementation of \"virtual\" bivalent
802streams that can be layered atop real binary or bivalent streams and that can
803be used to read and write character data in various single- or multi-octet
804encodings which can be changed on the fly. It also supplies in-memory binary
805streams which are similar to string streams.")
806 (home-page "http://weitz.de/flexi-streams/")
807 (license license:bsd-3)))
808
809(define-public cl-flexi-streams
810 (sbcl-package->cl-source-package sbcl-flexi-streams))
811
812(define-public ecl-flexi-streams
813 (sbcl-package->ecl-package sbcl-flexi-streams))
5aa608a7
AP
814
815(define-public sbcl-cl-ppcre
816 (package
817 (name "sbcl-cl-ppcre")
818 (version "2.0.11")
819 (source
820 (origin
821 (method url-fetch)
822 (uri (string-append
823 "https://github.com/edicl/cl-ppcre/archive/v"
824 version ".tar.gz"))
825 (sha256
826 (base32 "1i7daxf0wnydb0pgwiym7qh2wy70n14lxd6dyv28sy0naa8p31gd"))
827 (file-name (string-append "cl-ppcre-" version ".tar.gz"))))
828 (build-system asdf-build-system/sbcl)
0e1371be 829 (native-inputs `(("flexi-streams" ,sbcl-flexi-streams)))
5aa608a7
AP
830 (synopsis "Portable regular expression library for Common Lisp")
831 (description "CL-PPCRE is a portable regular expression library for Common
832Lisp, which is compatible with perl. It is pretty fast, thread-safe, and
833compatible with ANSI-compliant Common Lisp implementations.")
834 (home-page "http://weitz.de/cl-ppcre/")
835 (license license:bsd-2)))
836
837(define-public cl-ppcre
838 (sbcl-package->cl-source-package sbcl-cl-ppcre))
839
840(define-public ecl-cl-ppcre
841 (sbcl-package->ecl-package sbcl-cl-ppcre))
4b51b21c 842
ac259253
RW
843(define sbcl-cl-unicode-base
844 (let ((revision "1")
845 (commit "9fcd06fba1ddc9e66aed2f2d6c32dc9b764f03ea"))
846 (package
847 (name "sbcl-cl-unicode-base")
848 (version (string-append "0.1.5-" revision "." (string-take commit 7)))
849 (source (origin
850 (method git-fetch)
851 (uri (git-reference
852 (url "https://github.com/edicl/cl-unicode.git")
853 (commit commit)))
854 (file-name (string-append "cl-unicode-" version "-checkout"))
855 (sha256
856 (base32
857 "1jicprb5b3bv57dy1kg03572gxkcaqdjhak00426s76g0plmx5ki"))))
858 (build-system asdf-build-system/sbcl)
859 (arguments
860 '(#:asd-file "cl-unicode.asd"
861 #:asd-system-name "cl-unicode/base"))
862 (inputs
863 `(("cl-ppcre" ,sbcl-cl-ppcre)))
864 (home-page "http://weitz.de/cl-unicode/")
865 (synopsis "Portable Unicode library for Common Lisp")
866 (description "CL-UNICODE is a portable Unicode library Common Lisp, which
867is compatible with perl. It is pretty fast, thread-safe, and compatible with
868ANSI-compliant Common Lisp implementations.")
869 (license license:bsd-2))))
870
871(define-public sbcl-cl-unicode
872 (package
873 (inherit sbcl-cl-unicode-base)
874 (name "sbcl-cl-unicode")
875 (inputs
876 `(("cl-unicode/base" ,sbcl-cl-unicode-base)
877 ,@(package-inputs sbcl-cl-unicode-base)))
878 (native-inputs
879 `(("flexi-streams" ,sbcl-flexi-streams)))
880 (arguments '())))
881
882(define-public ecl-cl-unicode
883 (sbcl-package->ecl-package sbcl-cl-unicode))
884
885(define-public cl-unicode
886 (sbcl-package->cl-source-package sbcl-cl-unicode))
887
4b51b21c
AP
888(define-public sbcl-clx
889 (let ((revision "1")
890 (commit "1c62774b03c1cf3fe6e5cb532df8b14b44c96b95"))
891 (package
892 (name "sbcl-clx")
893 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
894 (source
895 (origin
896 (method git-fetch)
897 (uri
898 (git-reference
899 (url "https://github.com/sharplispers/clx.git")
900 (commit commit)))
901 (sha256
902 (base32 "0qffag03ns52kwq9xjns2qg1yr0bf3ba507iwq5cmx5xz0b0rmjm"))
903 (file-name (string-append "clx-" version "-checkout"))
904 (patches
905 (list
906 (search-patch "clx-remove-demo.patch")))
907 (modules '((guix build utils)))
908 (snippet
909 '(begin
910 ;; These removed files cause the compiled system to crash when
911 ;; loading.
912 (delete-file-recursively "demo")
913 (delete-file "test/trapezoid.lisp")
914 (substitute* "clx.asd"
915 (("\\(:file \"trapezoid\"\\)") ""))))))
916 (build-system asdf-build-system/sbcl)
4b51b21c
AP
917 (home-page "http://www.cliki.net/portable-clx")
918 (synopsis "X11 client library for Common Lisp")
919 (description "CLX is an X11 client library for Common Lisp. The code was
920originally taken from a CMUCL distribution, was modified somewhat in order to
921make it compile and run under SBCL, then a selection of patches were added
922from other CLXes around the net.")
923 (license license:x11))))
924
925(define-public cl-clx
926 (sbcl-package->cl-source-package sbcl-clx))
927
928(define-public ecl-clx
929 (sbcl-package->ecl-package sbcl-clx))
d075960f 930
b693aa6e
RW
931(define-public sbcl-cl-ppcre-unicode
932 (package (inherit sbcl-cl-ppcre)
933 (name "sbcl-cl-ppcre-unicode")
934 (arguments
935 `(#:tests? #f ; tests fail with "Component :CL-PPCRE-TEST not found"
936 #:asd-file "cl-ppcre-unicode.asd"))
937 (inputs
938 `(("sbcl-cl-ppcre" ,sbcl-cl-ppcre)
939 ("sbcl-cl-unicode" ,sbcl-cl-unicode)))))
940
d075960f
AP
941(define-public sbcl-stumpwm
942 (package
943 (name "sbcl-stumpwm")
bdeecf56 944 (version "1.0.0")
d075960f
AP
945 (source (origin
946 (method url-fetch)
947 (uri (string-append
948 "https://github.com/stumpwm/stumpwm/archive/"
949 version ".tar.gz"))
950 (sha256
bdeecf56 951 (base32 "1maxp98gh64az3d9vz9br6zdd6rc9fmj2imvax4by85g6kxvdz1i"))
d075960f
AP
952 (file-name (string-append "stumpwm-" version ".tar.gz"))))
953 (build-system asdf-build-system/sbcl)
0e1371be
AP
954 (inputs `(("cl-ppcre" ,sbcl-cl-ppcre)
955 ("clx" ,sbcl-clx)))
290bf612 956 (outputs '("out" "lib"))
d075960f 957 (arguments
35189728 958 '(#:phases
d075960f
AP
959 (modify-phases %standard-phases
960 (add-after 'create-symlinks 'build-program
b4c9f0c5 961 (lambda* (#:key outputs #:allow-other-keys)
d075960f 962 (build-program
290bf612 963 (string-append (assoc-ref outputs "out") "/bin/stumpwm")
4209c31b 964 outputs
d075960f
AP
965 #:entry-program '((stumpwm:stumpwm) 0))))
966 (add-after 'build-program 'create-desktop-file
290bf612
AP
967 (lambda* (#:key outputs #:allow-other-keys)
968 (let* ((out (assoc-ref outputs "out"))
969 (xsessions (string-append out "/share/xsessions")))
970 (mkdir-p xsessions)
971 (call-with-output-file
972 (string-append xsessions "/stumpwm.desktop")
973 (lambda (file)
974 (format file
d075960f
AP
975 "[Desktop Entry]~@
976 Name=stumpwm~@
977 Comment=The Stump Window Manager~@
978 Exec=~a/bin/stumpwm~@
979 TryExec=~@*~a/bin/stumpwm~@
980 Icon=~@
981 Type=Application~%"
290bf612 982 out)))
d075960f
AP
983 #t))))))
984 (synopsis "Window manager written in Common Lisp")
985 (description "Stumpwm is a window manager written entirely in Common Lisp.
986It attempts to be highly customizable while relying entirely on the keyboard
987for input. These design decisions reflect the growing popularity of
988productive, customizable lisp based systems.")
7bf837fd 989 (home-page "https://github.com/stumpwm/stumpwm")
d075960f
AP
990 (license license:gpl2+)
991 (properties `((ecl-variant . ,(delay ecl-stumpwm))))))
992
993(define-public cl-stumpwm
994 (sbcl-package->cl-source-package sbcl-stumpwm))
995
996(define-public ecl-stumpwm
997 (let ((base (sbcl-package->ecl-package sbcl-stumpwm)))
998 (package
999 (inherit base)
1000 (outputs '("out"))
1001 (arguments '()))))
e3e171ee 1002
75e8b3af
AP
1003;; The slynk that users expect to install includes all of slynk's contrib
1004;; modules. Therefore, we build the base module and all contribs first; then
1005;; we expose the union of these as `sbcl-slynk'. The following variable
1006;; describes the base module.
e3e171ee
AP
1007(define sbcl-slynk-boot0
1008 (let ((revision "1")
1009 (commit "5706cd45d484a4f25795abe8e643509d31968aa2"))
1010 (package
f56da605 1011 (name "sbcl-slynk-boot0")
e3e171ee
AP
1012 (version (string-append "1.0.0-beta-" revision "." (string-take commit 7)))
1013 (source
1014 (origin
1015 (method git-fetch)
1016 (uri
1017 (git-reference
1018 (url "https://github.com/joaotavora/sly.git")
1019 (commit commit)))
1020 (sha256
1021 (base32 "0h4gg3sndl2bf6jdnx9nrf14p9hhi43hagrl0f4v4l11hczl8w81"))
1022 (file-name (string-append "slynk-" version "-checkout"))
1023 (modules '((guix build utils)
1024 (ice-9 ftw)))
1025 (snippet
1026 '(begin
1027 ;; Move the contribs into the main source directory for easier
1028 ;; access
1029 (substitute* "slynk/slynk.asd"
1030 (("\\.\\./contrib")
1031 "contrib")
1032 (("\\(defsystem :slynk-util")
1033 "(defsystem :slynk-util :depends-on (:slynk)"))
1034 (substitute* "contrib/slynk-trace-dialog.lisp"
1035 (("\\(slynk::reset-inspector\\)") ; Causes problems on load
1036 "nil"))
1037 (substitute* "contrib/slynk-profiler.lisp"
1038 (("slynk:to-line")
1039 "slynk-pprint-to-line"))
1040 (rename-file "contrib" "slynk/contrib")
1041 ;; Move slynk's contents into the base directory for easier
1042 ;; access
1043 (for-each
1044 (lambda (file)
1045 (unless (string-prefix? "." file)
1046 (rename-file (string-append "slynk/" file)
1047 (string-append "./" (basename file)))))
1048 (scandir "slynk"))))))
1049 (build-system asdf-build-system/sbcl)
1050 (arguments
f56da605
AP
1051 `(#:tests? #f ; No test suite
1052 #:asd-system-name "slynk"))
e3e171ee 1053 (synopsis "Common Lisp IDE for Emacs")
14afc7b8
AP
1054 (description "SLY is a fork of SLIME, an IDE backend for Common Lisp.
1055It also features a completely redesigned REPL based on Emacs's own
1056full-featured comint.el, live code annotations, and a consistent interactive
1057button interface. Everything can be copied to the REPL. One can create
1058multiple inspectors with independent history.")
e3e171ee
AP
1059 (home-page "https://github.com/joaotavora/sly")
1060 (license license:public-domain)
1061 (properties `((cl-source-variant . ,(delay cl-slynk)))))))
1062
1063(define-public cl-slynk
f56da605
AP
1064 (package
1065 (inherit (sbcl-package->cl-source-package sbcl-slynk-boot0))
1066 (name "cl-slynk")))
e3e171ee
AP
1067
1068(define ecl-slynk-boot0
1069 (sbcl-package->ecl-package sbcl-slynk-boot0))
1070
1071(define sbcl-slynk-arglists
1072 (package
1073 (inherit sbcl-slynk-boot0)
1074 (name "sbcl-slynk-arglists")
0e1371be 1075 (inputs `(("slynk" ,sbcl-slynk-boot0)))
e3e171ee 1076 (arguments
f56da605
AP
1077 (substitute-keyword-arguments (package-arguments sbcl-slynk-boot0)
1078 ((#:asd-file _ "") "slynk.asd")
1079 ((#:asd-system-name _ #f) #f)))))
e3e171ee
AP
1080
1081(define ecl-slynk-arglists
1082 (sbcl-package->ecl-package sbcl-slynk-arglists))
1083
1084(define sbcl-slynk-util
1085 (package
1086 (inherit sbcl-slynk-arglists)
1087 (name "sbcl-slynk-util")))
1088
1089(define ecl-slynk-util
1090 (sbcl-package->ecl-package sbcl-slynk-util))
1091
1092(define sbcl-slynk-fancy-inspector
1093 (package
1094 (inherit sbcl-slynk-arglists)
1095 (name "sbcl-slynk-fancy-inspector")
0e1371be 1096 (inputs `(("slynk-util" ,sbcl-slynk-util)
e3e171ee
AP
1097 ,@(package-inputs sbcl-slynk-arglists)))))
1098
1099(define ecl-slynk-fancy-inspector
1100 (sbcl-package->ecl-package sbcl-slynk-fancy-inspector))
1101
1102(define sbcl-slynk-package-fu
1103 (package
1104 (inherit sbcl-slynk-arglists)
1105 (name "sbcl-slynk-package-fu")))
1106
1107(define ecl-slynk-package-fu
1108 (sbcl-package->ecl-package sbcl-slynk-package-fu))
1109
1110(define sbcl-slynk-mrepl
1111 (package
1112 (inherit sbcl-slynk-arglists)
1113 (name "sbcl-slynk-mrepl")))
1114
1115(define ecl-slynk-mrepl
1116 (sbcl-package->ecl-package sbcl-slynk-mrepl))
1117
1118(define sbcl-slynk-trace-dialog
1119 (package
1120 (inherit sbcl-slynk-arglists)
1121 (name "sbcl-slynk-trace-dialog")))
1122
1123(define ecl-slynk-trace-dialog
1124 (sbcl-package->ecl-package sbcl-slynk-trace-dialog))
1125
1126(define sbcl-slynk-profiler
1127 (package
1128 (inherit sbcl-slynk-arglists)
1129 (name "sbcl-slynk-profiler")))
1130
1131(define ecl-slynk-profiler
1132 (sbcl-package->ecl-package sbcl-slynk-profiler))
1133
1134(define sbcl-slynk-stickers
1135 (package
1136 (inherit sbcl-slynk-arglists)
1137 (name "sbcl-slynk-stickers")))
1138
1139(define ecl-slynk-stickers
1140 (sbcl-package->ecl-package sbcl-slynk-stickers))
1141
1142(define sbcl-slynk-indentation
1143 (package
1144 (inherit sbcl-slynk-arglists)
1145 (name "sbcl-slynk-indentation")))
1146
1147(define ecl-slynk-indentation
1148 (sbcl-package->ecl-package sbcl-slynk-indentation))
1149
1150(define sbcl-slynk-retro
1151 (package
1152 (inherit sbcl-slynk-arglists)
1153 (name "sbcl-slynk-retro")))
1154
1155(define ecl-slynk-retro
1156 (sbcl-package->ecl-package sbcl-slynk-retro))
1157
1158(define slynk-systems
1159 '("slynk"
1160 "slynk-util"
1161 "slynk-arglists"
1162 "slynk-fancy-inspector"
1163 "slynk-package-fu"
1164 "slynk-mrepl"
1165 "slynk-profiler"
1166 "slynk-trace-dialog"
1167 "slynk-stickers"
1168 "slynk-indentation"
1169 "slynk-retro"))
1170
1171(define-public sbcl-slynk
1172 (package
1173 (inherit sbcl-slynk-boot0)
f56da605 1174 (name "sbcl-slynk")
e3e171ee
AP
1175 (inputs
1176 `(("slynk" ,sbcl-slynk-boot0)
1177 ("slynk-util" ,sbcl-slynk-util)
1178 ("slynk-arglists" ,sbcl-slynk-arglists)
1179 ("slynk-fancy-inspector" ,sbcl-slynk-fancy-inspector)
1180 ("slynk-package-fu" ,sbcl-slynk-package-fu)
1181 ("slynk-mrepl" ,sbcl-slynk-mrepl)
1182 ("slynk-profiler" ,sbcl-slynk-profiler)
1183 ("slynk-trace-dialog" ,sbcl-slynk-trace-dialog)
1184 ("slynk-stickers" ,sbcl-slynk-stickers)
1185 ("slynk-indentation" ,sbcl-slynk-indentation)
1186 ("slynk-retro" ,sbcl-slynk-retro)))
1187 (native-inputs `(("sbcl" ,sbcl)))
1188 (build-system trivial-build-system)
1189 (source #f)
1190 (outputs '("out" "image"))
1191 (arguments
1192 `(#:modules ((guix build union)
1193 (guix build utils)
1194 (guix build lisp-utils))
1195 #:builder
1196 (begin
1197 (use-modules (ice-9 match)
1198 (srfi srfi-1)
1199 (guix build union)
1200 (guix build lisp-utils))
1201
1202 (union-build
1203 (assoc-ref %outputs "out")
1204 (filter-map
1205 (match-lambda
1206 ((name . path)
1207 (if (string-prefix? "slynk" name) path #f)))
1208 %build-inputs))
1209
1210 (prepend-to-source-registry
1211 (string-append (assoc-ref %outputs "out") "//"))
b4c9f0c5
AP
1212
1213 (parameterize ((%lisp-type "sbcl")
1214 (%lisp (string-append (assoc-ref %build-inputs "sbcl")
1215 "/bin/sbcl")))
1216 (build-image (string-append
1217 (assoc-ref %outputs "image")
1218 "/bin/slynk")
4209c31b 1219 %outputs
b4c9f0c5 1220 #:dependencies ',slynk-systems)))))))
e3e171ee
AP
1221
1222(define-public ecl-slynk
1223 (package
1224 (inherit sbcl-slynk)
1225 (name "ecl-slynk")
1226 (inputs
1227 (map (match-lambda
1228 ((name pkg . _)
1229 (list name (sbcl-package->ecl-package pkg))))
1230 (package-inputs sbcl-slynk)))
1231 (native-inputs '())
1232 (outputs '("out"))
1233 (arguments
1234 '(#:modules ((guix build union))
1235 #:builder
1236 (begin
1237 (use-modules (ice-9 match)
1238 (guix build union))
1239 (match %build-inputs
1240 (((names . paths) ...)
1241 (union-build (assoc-ref %outputs "out")
1242 paths))))))))
96784438
AP
1243
1244(define-public sbcl-stumpwm+slynk
1245 (package
1246 (inherit sbcl-stumpwm)
1247 (name "sbcl-stumpwm-with-slynk")
1248 (outputs '("out"))
4209c31b 1249 (inputs
290bf612 1250 `(("stumpwm" ,sbcl-stumpwm "lib")
96784438
AP
1251 ("slynk" ,sbcl-slynk)))
1252 (arguments
1253 (substitute-keyword-arguments (package-arguments sbcl-stumpwm)
1254 ((#:phases phases)
1255 `(modify-phases ,phases
1256 (replace 'build-program
4209c31b 1257 (lambda* (#:key inputs outputs #:allow-other-keys)
96784438
AP
1258 (let* ((out (assoc-ref outputs "out"))
1259 (program (string-append out "/bin/stumpwm")))
4209c31b 1260 (build-program program outputs
96784438
AP
1261 #:entry-program '((stumpwm:stumpwm) 0)
1262 #:dependencies '("stumpwm"
4209c31b
AP
1263 ,@slynk-systems)
1264 #:dependency-prefixes
1265 (map (lambda (input) (assoc-ref inputs input))
1266 '("stumpwm" "slynk")))
96784438
AP
1267 ;; Remove unneeded file.
1268 (delete-file (string-append out "/bin/stumpwm-exec.fasl"))
1269 #t)))
1270 (delete 'copy-source)
1271 (delete 'build)
1272 (delete 'check)
290bf612 1273 (delete 'create-asd-file)
96784438
AP
1274 (delete 'cleanup)
1275 (delete 'create-symlinks)))))))
d00c96d7
RW
1276
1277(define-public sbcl-parse-js
1278 (let ((commit "fbadc6029bec7039602abfc06c73bb52970998f6")
1279 (revision "1"))
1280 (package
1281 (name "sbcl-parse-js")
1282 (version (string-append "0.0.0-" revision "." (string-take commit 9)))
1283 (source
1284 (origin
1285 (method git-fetch)
1286 (uri (git-reference
1287 (url "http://marijn.haverbeke.nl/git/parse-js")
1288 (commit commit)))
1289 (file-name (string-append name "-" commit "-checkout"))
1290 (sha256
1291 (base32
1292 "1wddrnr5kiya5s3gp4cdq6crbfy9fqcz7fr44p81502sj3bvdv39"))))
1293 (build-system asdf-build-system/sbcl)
1294 (home-page "http://marijnhaverbeke.nl/parse-js/")
1295 (synopsis "Parse JavaScript")
1296 (description "Parse-js is a Common Lisp package for parsing
1297JavaScript (ECMAScript 3). It has basic support for ECMAScript 5.")
1298 (license license:zlib))))
d0eec99a
RW
1299
1300(define-public sbcl-parse-number
1301 (package
1302 (name "sbcl-parse-number")
1303 (version "1.5")
1304 (source
1305 (origin
1306 (method url-fetch)
1307 (uri (string-append "https://github.com/sharplispers/parse-number/"
1308 "archive/v" version ".tar.gz"))
1309 (file-name (string-append name "-" version ".tar.gz"))
1310 (sha256
1311 (base32
1312 "1k6s4v65ksc1j5i0dprvzfvj213v6nah7i0rgd0726ngfjisj9ir"))))
1313 (build-system asdf-build-system/sbcl)
1314 (home-page "http://www.cliki.net/PARSE-NUMBER")
1315 (synopsis "Parse numbers")
1316 (description "@code{parse-number} is a library of functions for parsing
1317strings into one of the standard Common Lisp number types without using the
1318reader. @code{parse-number} accepts an arbitrary string and attempts to parse
1319the string into one of the standard Common Lisp number types, if possible, or
1320else @code{parse-number} signals an error of type @code{invalid-number}.")
1321 (license license:bsd-3)))
1322
476b583f
RW
1323(define-public sbcl-iterate
1324 (package
1325 (name "sbcl-iterate")
1326 ;; The latest official release (1.4.3) fails to build so we have to take
1327 ;; the current darcs tarball from quicklisp.
1328 (version "20160825")
1329 (source
1330 (origin
1331 (method url-fetch)
1332 (uri (string-append "http://beta.quicklisp.org/archive/iterate/"
1333 "2016-08-25/iterate-"
1334 version "-darcs.tgz"))
1335 (sha256
1336 (base32
1337 "0kvz16gnxnkdz0fy1x8y5yr28nfm7i2qpvix7mgwccdpjmsb4pgm"))))
1338 (build-system asdf-build-system/sbcl)
1339 (home-page "https://common-lisp.net/project/iterate/")
1340 (synopsis "Iteration construct for Common Lisp")
1341 (description "@code{iterate} is an iteration construct for Common Lisp.
1342It is similar to the @code{CL:LOOP} macro, with these distinguishing marks:
1343
1344@itemize
1345@item it is extensible,
1346@item it helps editors like Emacs indent iterate forms by having a more
1347 lisp-like syntax, and
1348@item it isn't part of the ANSI standard for Common Lisp.
1349@end itemize\n")
1350 (license license:expat)))
52650a4d
RW
1351
1352(define-public sbcl-cl-uglify-js
1353 ;; There have been many bug fixes since the 2010 release.
1354 (let ((commit "429c5e1d844e2f96b44db8fccc92d6e8e28afdd5")
1355 (revision "1"))
1356 (package
1357 (name "sbcl-cl-uglify-js")
1358 (version (string-append "0.1-" revision "." (string-take commit 9)))
1359 (source
1360 (origin
1361 (method git-fetch)
1362 (uri (git-reference
1363 (url "https://github.com/mishoo/cl-uglify-js.git")
1364 (commit commit)))
03e8182b 1365 (file-name (git-file-name name version))
52650a4d
RW
1366 (sha256
1367 (base32
1368 "0k39y3c93jgxpr7gwz7w0d8yknn1fdnxrjhd03057lvk5w8js27a"))))
1369 (build-system asdf-build-system/sbcl)
1370 (inputs
1371 `(("sbcl-parse-js" ,sbcl-parse-js)
1372 ("sbcl-cl-ppcre" ,sbcl-cl-ppcre)
1373 ("sbcl-cl-ppcre-unicode" ,sbcl-cl-ppcre-unicode)
1374 ("sbcl-parse-number" ,sbcl-parse-number)
1375 ("sbcl-iterate" ,sbcl-iterate)))
1376 (home-page "https://github.com/mishoo/cl-uglify-js")
1377 (synopsis "JavaScript compressor library for Common Lisp")
1378 (description "This is a Common Lisp version of UglifyJS, a JavaScript
1379compressor. It works on data produced by @code{parse-js} to generate a
1380@dfn{minified} version of the code. Currently it can:
1381
1382@itemize
1383@item reduce variable names (usually to single letters)
1384@item join consecutive @code{var} statements
1385@item resolve simple binary expressions
1386@item group most consecutive statements using the ``sequence'' operator (comma)
1387@item remove unnecessary blocks
1388@item convert @code{IF} expressions in various ways that result in smaller code
1389@item remove some unreachable code
1390@end itemize\n")
1391 (license license:zlib))))
dd35abfe
RW
1392
1393(define-public uglify-js
1394 (package
1395 (inherit sbcl-cl-uglify-js)
1396 (name "uglify-js")
1397 (build-system trivial-build-system)
1398 (arguments
1399 `(#:modules ((guix build utils))
1400 #:builder
1401 (let* ((bin (string-append (assoc-ref %outputs "out") "/bin/"))
1402 (script (string-append bin "uglify-js")))
1403 (use-modules (guix build utils))
1404 (mkdir-p bin)
1405 (with-output-to-file script
1406 (lambda _
1407 (format #t "#!~a/bin/sbcl --script
1408 (require :asdf)
1409 (push (truename \"~a/lib/sbcl\") asdf:*central-registry*)"
1410 (assoc-ref %build-inputs "sbcl")
1411 (assoc-ref %build-inputs "sbcl-cl-uglify-js"))
1412 ;; FIXME: cannot use progn here because otherwise it fails to
1413 ;; find cl-uglify-js.
1414 (for-each
1415 write
1416 '(;; Quiet, please!
1417 (let ((*standard-output* (make-broadcast-stream))
1418 (*error-output* (make-broadcast-stream)))
1419 (asdf:load-system :cl-uglify-js))
1420 (let ((file (cadr *posix-argv*)))
1421 (if file
1422 (format t "~a"
1423 (cl-uglify-js:ast-gen-code
1424 (cl-uglify-js:ast-mangle
1425 (cl-uglify-js:ast-squeeze
1426 (with-open-file (in file)
1427 (parse-js:parse-js in))))
1428 :beautify nil))
1429 (progn
1430 (format *error-output*
1431 "Please provide a JavaScript file.~%")
1432 (sb-ext:exit :code 1))))))))
1433 (chmod script #o755)
1434 #t)))
1435 (inputs
1436 `(("sbcl" ,sbcl)
1437 ("sbcl-cl-uglify-js" ,sbcl-cl-uglify-js)))
1438 (synopsis "JavaScript compressor")))