Commit | Line | Data |
---|---|---|
13bbc0cc FB |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch> | |
3 | ;;; | |
4 | ;;; This file is part of GNU Guix. | |
5 | ;;; | |
6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
7 | ;;; under the terms of the GNU General Public License as published by | |
8 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
9 | ;;; your option) any later version. | |
10 | ;;; | |
11 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | ;;; GNU General Public License for more details. | |
15 | ;;; | |
16 | ;;; You should have received a copy of the GNU General Public License | |
17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | (define-module (gnu packages chez) | |
20 | #:use-module (gnu packages) | |
21 | #:use-module ((guix licenses) | |
4dfe4eee FB |
22 | #:select (gpl2+ lgpl2.0+ lgpl2.1+ asl2.0 bsd-3 expat |
23 | public-domain)) | |
13bbc0cc FB |
24 | #:use-module (guix packages) |
25 | #:use-module (guix download) | |
4dfe4eee | 26 | #:use-module (guix git-download) |
13bbc0cc FB |
27 | #:use-module (guix utils) |
28 | #:use-module (guix build-system gnu) | |
29 | #:use-module (gnu packages compression) | |
30 | #:use-module (gnu packages ncurses) | |
31 | #:use-module (gnu packages ghostscript) | |
32 | #:use-module (gnu packages netpbm) | |
33 | #:use-module (gnu packages tex) | |
34 | #:use-module (gnu packages compression) | |
35 | #:use-module (gnu packages image) | |
36 | #:use-module (gnu packages xorg) | |
37 | #:use-module (ice-9 match)) | |
38 | ||
39 | (define nanopass | |
40 | (let ((version "1.9")) | |
41 | (origin | |
42 | (method url-fetch) | |
43 | (uri (string-append | |
44 | "https://github.com/nanopass/nanopass-framework-scheme/archive" | |
45 | "/v" version ".tar.gz")) | |
46 | (sha256 (base32 "11pwyy4jiwhcl2am3a4ciczacjbjkyvdizqzdglb3l1hj2gj6nv2")) | |
47 | (file-name (string-append "nanopass-" version ".tar.gz"))))) | |
48 | ||
49 | (define stex | |
50 | (let ((version "1.2.1")) | |
51 | (origin | |
52 | (method url-fetch) | |
53 | (uri (string-append | |
54 | "https://github.com/dybvig/stex/archive" | |
55 | "/v" version ".tar.gz")) | |
56 | (sha256 (base32 "03pl3f668h24dn51vccr1sj5lsba9zq3j37bnxjvdadcdaj4qy5z")) | |
57 | (file-name (string-append "stex-" version ".tar.gz"))))) | |
58 | ||
59 | (define-public chez-scheme | |
60 | (package | |
61 | (name "chez-scheme") | |
62 | (version "9.4") | |
63 | (source | |
64 | (origin | |
65 | (method url-fetch) | |
66 | (uri (string-append "https://github.com/cisco/ChezScheme/archive/" | |
67 | "v" version ".tar.gz")) | |
68 | (sha256 | |
69 | (base32 "0lprmpsjg2plc6ykgkz482zyvhkzv6gd0vnar71ph21h6zknyklz")) | |
70 | (file-name (string-append "chez-scheme-" version ".tar.gz")))) | |
71 | (build-system gnu-build-system) | |
72 | (inputs | |
73 | `(("ncurses" ,ncurses) | |
74 | ("libx11" ,libx11) | |
75 | ("xorg-rgb" ,xorg-rgb) | |
76 | ("nanopass" ,nanopass) | |
77 | ("zlib" ,zlib) | |
78 | ("stex" ,stex))) | |
79 | (native-inputs | |
80 | `(("texlive" ,texlive) | |
81 | ("ghostscript" ,ghostscript-gs) | |
82 | ("netpbm" ,netpbm))) | |
83 | (native-search-paths | |
84 | (list (search-path-specification | |
85 | (variable "CHEZSCHEMELIBDIRS") | |
86 | (files (list (string-append "lib/csv" version "-site")))))) | |
87 | (outputs '("out" "doc")) | |
88 | (arguments | |
89 | `(#:modules ((guix build gnu-build-system) | |
90 | (guix build utils) | |
91 | (ice-9 match)) | |
92 | #:test-target "test" | |
93 | #:configure-flags | |
94 | (list ,(match (or (%current-target-system) (%current-system)) | |
95 | ("x86_64-linux" '(list "--machine=ta6le")) | |
96 | ("i686-linux" '(list "--machine=ti3le")) | |
97 | ;; FIXME: Some people succeeded in cross-compiling to | |
98 | ;; ARM. https://github.com/cisco/ChezScheme/issues/13 | |
99 | (_ | |
100 | '()))) | |
101 | #:phases | |
102 | (modify-phases %standard-phases | |
103 | ;; Adapt the custom 'configure' script. | |
104 | (replace 'configure | |
105 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
106 | (let ((out (assoc-ref outputs "out")) | |
107 | (nanopass (assoc-ref inputs "nanopass")) | |
108 | (stex (assoc-ref inputs "stex")) | |
109 | (zlib (assoc-ref inputs "zlib")) | |
110 | (unpack (assoc-ref %standard-phases 'unpack)) | |
111 | (patch-source-shebangs | |
112 | (assoc-ref %standard-phases 'patch-source-shebangs))) | |
113 | (map (match-lambda | |
114 | ((src orig-name new-name) | |
115 | (with-directory-excursion "." | |
116 | (apply unpack (list #:source src)) | |
117 | (apply patch-source-shebangs (list #:source src))) | |
118 | (delete-file-recursively new-name) | |
119 | (system* "mv" orig-name new-name))) | |
120 | `((,nanopass "nanopass-framework-scheme-1.9" "nanopass") | |
121 | (,stex "stex-1.2.1" "stex"))) | |
122 | ;; The Makefile wants to download and compile "zlib". We patch | |
123 | ;; it to use the one from our 'zlib' package. | |
124 | (substitute* "configure" | |
125 | (("rmdir zlib .*$") "echo \"using system zlib\"\n")) | |
126 | (substitute* (find-files "./c" "Mf-[a-zA-Z0-9.]+") | |
127 | (("\\$\\{Kernel\\}: \\$\\{kernelobj\\} \\.\\./zlib/libz\\.a") | |
128 | "${Kernel}: ${kernelobj}") | |
129 | (("ld ([-a-zA-Z0-9_${} ]+) \\.\\./zlib/libz\\.a" all args) | |
130 | (string-append "ld " args " " zlib "/lib/libz.a")) | |
131 | (("\\(cd \\.\\./zlib; ([-a-zA-Z0-9=./ ]+))") | |
132 | (which "true"))) | |
133 | (substitute* (find-files "mats" "Mf-.*") | |
134 | (("^[[:space:]]+(cc ) *") "\tgcc ")) | |
135 | (substitute* | |
136 | (find-files "." (string-append | |
137 | "(" | |
138 | "Mf-[a-zA-Z0-9.]+" | |
139 | "|Makefile[a-zA-Z0-9.]*" | |
140 | "|checkin" | |
141 | "|stex\\.stex" | |
142 | "|newrelease" | |
143 | "|workarea" | |
144 | ;;"|[a-zA-Z0-9.]+\\.ms" ; guile can't read | |
145 | ")")) | |
146 | (("/bin/rm") (which "rm")) | |
147 | (("/bin/ln") (which "ln")) | |
148 | (("/bin/cp") (which "cp"))) | |
149 | (substitute* "makefiles/installsh" | |
150 | (("/bin/true") (which "true"))) | |
151 | (substitute* "stex/Makefile" | |
152 | (("PREFIX=/usr") (string-append "PREFIX=" out))) | |
153 | (zero? (system* "./configure" "--threads" | |
154 | (string-append "--installprefix=" out)))))) | |
155 | ;; Installation of the documentation requires a running "chez". | |
156 | (add-after 'install 'install-doc | |
157 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
158 | (let ((bin (string-append (assoc-ref outputs "out") "/bin")) | |
159 | (doc (string-append (assoc-ref outputs "doc") | |
160 | "/share/doc/" ,name "-" ,version))) | |
161 | (setenv "HOME" (getcwd)) | |
162 | (setenv "PATH" (string-append (getenv "PATH") ":" bin)) | |
163 | (with-directory-excursion "stex" | |
164 | (system* "make" (string-append "BIN=" bin))) | |
165 | (system* "make" "docs") | |
166 | (with-directory-excursion "csug" | |
167 | (substitute* "Makefile" | |
168 | (("/tmp/csug9") doc)) | |
169 | (system* "make" "install") | |
170 | (install-file "csug.pdf" doc)) | |
171 | (with-directory-excursion "release_notes" | |
172 | (install-file "release_notes.pdf" doc)) | |
173 | #t))) | |
174 | ;; The binary file name is called "scheme" as the one from MIT/GNU | |
175 | ;; Scheme. We add a symlink to use in case both are installed. | |
176 | (add-after 'install 'install-symlink | |
177 | (lambda* (#:key outputs #:allow-other-keys) | |
178 | (let* ((out (assoc-ref outputs "out")) | |
179 | (bin (string-append out "/bin")) | |
180 | (lib (string-append out "/lib")) | |
181 | (name "chez-scheme")) | |
182 | (symlink (string-append bin "/scheme") | |
183 | (string-append bin "/" name)) | |
184 | (map (lambda (file) | |
185 | (symlink file (string-append (dirname file) | |
186 | "/" name ".boot"))) | |
187 | (find-files lib "scheme.boot")) | |
188 | #t)))))) | |
189 | ;; According to the documentation MIPS is not supported. | |
190 | (supported-systems (delete "mips64el-linux" %supported-systems)) | |
191 | (home-page "http://www.scheme.com") | |
192 | (synopsis "R6RS Scheme compiler and run-time") | |
193 | (description | |
194 | "Chez Scheme is a compiler and run-time system for the language of the | |
195 | Revised^6 Report on Scheme (R6RS), with numerous extensions. The compiler | |
196 | generates native code for each target processor, with support for x86, x86_64, | |
197 | and 32-bit PowerPC architectures.") | |
198 | (license asl2.0))) | |
c344b85d FB |
199 | |
200 | (define-public chez-srfi | |
201 | (package | |
202 | (name "chez-srfi") | |
203 | (version "1.0") | |
204 | (source | |
205 | (origin | |
206 | (method url-fetch) | |
207 | (uri (string-append | |
208 | "https://github.com/fedeinthemix/chez-srfi/archive" | |
209 | "/v" version ".tar.gz")) | |
210 | (sha256 | |
211 | (base32 "17i4wly7bcr5kb5hf04ljpbvv4r5hsr9xsmw650fj43z9jr303gs")) | |
212 | (file-name (string-append name "-" version ".tar.gz")))) | |
213 | (build-system gnu-build-system) | |
214 | (native-inputs | |
215 | `(("chez-scheme" ,chez-scheme))) | |
216 | (arguments | |
217 | `(#:make-flags (let ((out (assoc-ref %outputs "out"))) | |
218 | (list (string-append "PREFIX=" out))) | |
219 | #:test-target "test" | |
220 | #:phases (modify-phases %standard-phases | |
221 | (delete 'configure)))) | |
222 | (home-page "https://github.com/fedeinthemix/chez-srfi") | |
223 | (synopsis "SRFI libraries for Chez Scheme") | |
224 | (description | |
225 | "This package provides a collection of SRFI libraries for Chez Scheme.") | |
226 | (license expat))) | |
4dfe4eee FB |
227 | |
228 | (define-public chez-web | |
229 | (let ((commit "5fd177fe53f31f466bf88720d03c95a3711a8bea") | |
230 | (revision "1")) | |
231 | (package | |
232 | (name "chez-web") | |
233 | ;; release 2.0 is different and doesn't work. | |
234 | (version (string-append "2.0-" revision "." | |
235 | (string-take commit 7))) | |
236 | (source | |
237 | (origin | |
238 | (method git-fetch) | |
239 | (uri (git-reference | |
240 | (url "https://github.com/arcfide/ChezWEB.git") | |
241 | (commit commit))) | |
242 | (file-name (string-append name "-" version "-checkout")) | |
243 | (sha256 | |
244 | (base32 "1dq25qygyncbfq4kwwqqgyyakfqjwhp5q23vrf3bff1p66nyfl3b")))) | |
245 | (build-system gnu-build-system) | |
246 | (native-inputs | |
247 | `(("chez-scheme" ,chez-scheme) | |
248 | ("texlive" ,texlive))) | |
249 | (arguments | |
250 | `(#:make-flags (list (string-append "PREFIX=" %output) | |
251 | (string-append "DOCDIR=" %output "/share/doc/" | |
252 | ,name "-" ,version) | |
253 | (string-append "LIBDIR=" %output "/lib/chezweb") | |
254 | (string-append "TEXDIR=" %output "/share/texmf-local")) | |
255 | #:tests? #f ; no tests | |
256 | #:phases | |
257 | (modify-phases %standard-phases | |
258 | (replace 'configure | |
259 | (lambda* _ | |
260 | (copy-file "config.mk.template" "config.mk") | |
261 | (substitute* "tangleit" | |
262 | (("\\./cheztangle\\.ss" all) | |
263 | (string-append "chez-scheme --program " all))) | |
264 | (substitute* "weaveit" | |
265 | (("mpost chezweb\\.mp") | |
266 | "mpost --tex=tex chezweb.mp") | |
267 | (("\\./chezweave" all) | |
268 | (string-append "chez-scheme --program " all))) | |
269 | (substitute* "installit" | |
270 | (("-g \\$GROUP -o \\$OWNER") ""))))))) | |
271 | (home-page "https://github.com/arcfide/ChezWEB") | |
272 | (synopsis "Hygienic Literate Programming for Chez Scheme") | |
273 | (description "ChezWEB is a system for doing Knuthian style WEB | |
274 | programming in Scheme.") | |
275 | (license expat)))) | |
74f9c190 FB |
276 | |
277 | (define-public chez-sockets | |
278 | (let ((commit "bce96881c06bd69a6757a6bff139744153924140") | |
279 | (revision "1")) | |
280 | (package | |
281 | (name "chez-sockets") | |
282 | (version (string-append "0.0-" revision "." | |
283 | (string-take commit 7))) | |
284 | (source | |
285 | (origin | |
286 | (method git-fetch) | |
287 | (uri (git-reference | |
288 | (url "https://github.com/arcfide/chez-sockets.git") | |
289 | (commit commit))) | |
290 | (file-name (string-append name "-" version "-checkout")) | |
291 | (sha256 | |
292 | (base32 "1n5fbwwz51fdzvjackgmnsgh363g9inyxv7kmzi0469cwavwcx5m")))) | |
293 | (build-system gnu-build-system) | |
294 | (native-inputs | |
295 | `(("chez-scheme" ,chez-scheme) | |
296 | ("chez-web" ,chez-web) | |
297 | ("texlive" ,texlive))) | |
298 | (arguments | |
299 | `(#:tests? #f ; no tests | |
300 | #:phases | |
301 | (modify-phases %standard-phases | |
302 | (replace 'configure | |
303 | (lambda* (#:key outputs inputs #:allow-other-keys) | |
304 | (let* ((out (assoc-ref outputs "out")) | |
305 | (chez-web (assoc-ref inputs "chez-web")) | |
306 | (chez (assoc-ref inputs "chez-scheme")) | |
307 | (chez-h (dirname (car (find-files chez "scheme\\.h"))))) | |
308 | (substitute* "Makefile" | |
309 | (("(SCHEMEH=).*$" all var) | |
310 | (string-append var chez-h))) | |
311 | #t))) | |
312 | (add-before 'build 'tangle | |
313 | (lambda _ | |
314 | ;; just using "make" tries to build the .c files before | |
315 | ;; they are created. | |
316 | (and (zero? (system* "make" "sockets")) | |
317 | (zero? (system* "make"))))) | |
318 | (replace 'build | |
319 | (lambda* (#:key outputs inputs #:allow-other-keys) | |
320 | (let* ((out (assoc-ref outputs "out")) | |
321 | (chez-site (string-append out "/lib/csv" | |
322 | ,(package-version chez-scheme) | |
323 | "-site/arcfide"))) | |
324 | ;; make sure Chez Scheme can find the shared libraries. | |
325 | (substitute* "sockets.ss" | |
326 | (("(load-shared-object) \"(socket-ffi-values\\.[sd][oy].*)\"" | |
327 | all cmd so) | |
328 | (string-append cmd " \"" chez-site "/" so "\"")) | |
329 | (("sockets-stub\\.[sd][oy].*" all) | |
330 | (string-append chez-site "/" all))) | |
331 | ;; to compile chez-sockets, the .so files must be | |
332 | ;; installed (because of the absolute path we | |
333 | ;; inserted above). | |
334 | (for-each (lambda (f d) (install-file f d)) | |
335 | '("socket-ffi-values.so" "sockets-stub.so") | |
336 | (list chez-site chez-site)) | |
337 | (zero? (system "echo '(compile-file \"sockets.sls\")' | scheme -q"))))) | |
338 | (replace 'install | |
339 | (lambda* (#:key outputs inputs #:allow-other-keys) | |
340 | (let* ((out (assoc-ref outputs "out")) | |
341 | (lib (string-append out "/lib/chez-sockets")) | |
342 | (doc (string-append out "/share/doc/" ,name "-" ,version)) | |
343 | (chez-site (string-append out "/lib/csv" | |
344 | ,(package-version chez-scheme) | |
345 | "-site/arcfide"))) | |
346 | (for-each (lambda (f d) (install-file f d)) | |
347 | '("sockets.pdf" "sockets.so") | |
348 | (list doc chez-site)) | |
349 | #t)))))) | |
350 | (home-page "https://github.com/arcfide/chez-sockets") | |
351 | (synopsis "Extensible sockets library for Chez Scheme") | |
352 | (description "Chez-sockets is an extensible sockets library for | |
353 | Chez Scheme.") | |
354 | (license expat)))) | |
38754190 FB |
355 | |
356 | ;; Help function for Chez Scheme to add the current path to | |
357 | ;; CHEZSCHEMELIBDIRS. | |
358 | (define chez-configure | |
359 | '(lambda _ | |
360 | (let ((chez-env (getenv "CHEZSCHEMELIBDIRS"))) | |
361 | (setenv "CHEZSCHEMELIBDIRS" | |
362 | (if chez-env | |
363 | (string-append ".:" chez-env) | |
364 | ".")) | |
365 | #t))) | |
366 | ||
367 | ;; Help function to define make flags for some Chez Scheme custom make | |
368 | ;; files. | |
369 | (define (chez-make-flags name version) | |
370 | `(let ((out (assoc-ref %outputs "out"))) | |
371 | (list (string-append "PREFIX=" out) | |
372 | (string-append "DOCDIR=" out "/share/doc/" | |
373 | ,name "-" ,version)))) | |
374 | ||
375 | (define-public chez-matchable | |
376 | (package | |
377 | (name "chez-matchable") | |
378 | (version "20160306") | |
379 | (home-page "https://github.com/fedeinthemix/chez-matchable") | |
380 | (source | |
381 | (origin | |
382 | (method url-fetch) | |
383 | (uri (string-append home-page "/archive" "/v" version ".tar.gz")) | |
384 | (sha256 | |
385 | (base32 "0cl4vc6487pikjq159pj4n5ghyaax31nywb5n4yn1682h3ir1hs0")) | |
386 | (file-name (string-append name "-" version ".tar.gz")))) | |
387 | (build-system gnu-build-system) | |
388 | (inputs | |
389 | `(("chez-srfi" ,chez-srfi))) ; for tests | |
390 | (native-inputs | |
391 | `(("chez-scheme" ,chez-scheme))) | |
392 | (arguments | |
393 | `(#:make-flags ,(chez-make-flags name version) | |
394 | #:test-target "test" | |
395 | #:phases (modify-phases %standard-phases | |
396 | (replace 'configure ,chez-configure)))) | |
397 | (synopsis "Portable hygienic pattern matcher for Scheme") | |
398 | (description "This package provides a superset of the popular Scheme | |
399 | @code{match} package by Andrew Wright, written in fully portable | |
400 | @code{syntax-rules} and thus preserving hygiene.") | |
401 | (license public-domain))) | |
87d6c9ef FB |
402 | |
403 | (define-public chez-irregex | |
404 | (package | |
405 | (name "chez-irregex") | |
406 | (version "0.9.4") | |
407 | (source | |
408 | (origin | |
409 | (method url-fetch) | |
410 | (uri (string-append | |
411 | "https://github.com/fedeinthemix/chez-irregex/archive" | |
412 | "/v" version ".tar.gz")) | |
413 | (sha256 | |
414 | (base32 "0ywy5syaw549a58viz68dmgnv756ic705rcnlqxgjq27lnaim53b")) | |
415 | (file-name (string-append name "-" version ".tar.gz")))) | |
416 | (build-system gnu-build-system) | |
417 | (inputs | |
418 | `(("chez-matchable" ,chez-matchable))) ; for tests | |
419 | (propagated-inputs | |
420 | `(("chez-srfi" ,chez-srfi))) ; for irregex-utils | |
421 | (native-inputs | |
422 | `(("chez-scheme" ,chez-scheme))) | |
423 | (arguments | |
424 | `(#:make-flags ,(chez-make-flags name version) | |
425 | #:test-target "test" | |
426 | #:phases (modify-phases %standard-phases | |
427 | (replace 'configure ,chez-configure)))) | |
428 | (home-page "https://github.com/fedeinthemix/chez-irregex") | |
429 | (synopsis "Portable regular expression library for Scheme") | |
430 | (description "This package provides a portable and efficient | |
431 | R[4567]RS implementation of regular expressions, supporting both POSIX | |
432 | syntax with various (irregular) PCRE extensions, as well as SCSH's SRE | |
433 | syntax, with various aliases for commonly used patterns.") | |
434 | (license bsd-3))) | |
fb6d2d75 FB |
435 | |
436 | (define-public chez-fmt | |
437 | (package | |
438 | (name "chez-fmt") | |
439 | (version "0.8.11") | |
440 | (source | |
441 | (origin | |
442 | (method url-fetch) | |
443 | (uri (string-append | |
444 | "http://synthcode.com/scheme/fmt/fmt-" version ".tar.gz")) | |
445 | (sha256 | |
446 | (base32 "1zxqlw1jyg85yzclylh8bp2b3fwcy3l3xal68jw837n5illvsjcl")) | |
447 | (file-name (string-append name "-" version ".tar.gz")))) | |
448 | (build-system gnu-build-system) | |
449 | (propagated-inputs | |
450 | `(("chez-srfi" ,chez-srfi))) ; for irregex-utils | |
451 | (native-inputs | |
452 | `(("chez-scheme" ,chez-scheme))) | |
453 | (arguments | |
454 | `(#:make-flags ,(chez-make-flags name version) | |
455 | #:test-target "chez-check" | |
456 | #:phases | |
457 | (modify-phases %standard-phases | |
458 | (replace 'configure ,chez-configure) | |
459 | (replace 'build | |
460 | (lambda* (#:key (make-flags '()) #:allow-other-keys) | |
461 | (zero? (apply system* "make" "chez-build" make-flags)))) | |
462 | (replace 'install | |
463 | (lambda* (#:key (make-flags '()) #:allow-other-keys) | |
464 | (zero? (apply system* "make" "chez-install" make-flags))))))) | |
465 | (home-page "http://synthcode.com/scheme/fmt") | |
466 | (synopsis "Combinator formatting library for Chez Scheme") | |
467 | (description "This package provides a library of procedures for | |
468 | formatting Scheme objects to text in various ways, and for easily | |
469 | concatenating, composing and extending these formatters efficiently | |
470 | without resorting to capturing and manipulating intermediate | |
471 | strings.") | |
472 | (license bsd-3))) |