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