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