gnu: cvs-fast-export: Update to 1.56.
[jackhill/guix/guix.git] / gnu / packages / chez.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
3 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
6 ;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
7 ;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages chez)
25 #:use-module (gnu packages)
26 #:use-module ((guix licenses)
27 #:select (gpl2+ gpl3+ lgpl2.0+ lgpl2.1+ asl2.0 bsd-3 expat
28 public-domain))
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix git-download)
32 #:use-module (guix utils)
33 #:use-module (guix gexp)
34 #:use-module (guix build-system gnu)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages ncurses)
37 #:use-module (gnu packages ghostscript)
38 #:use-module (gnu packages linux)
39 #:use-module (gnu packages netpbm)
40 #:use-module (gnu packages tex)
41 #:use-module (gnu packages compression)
42 #:use-module (gnu packages image)
43 #:use-module (gnu packages xorg)
44 #:use-module (ice-9 match)
45 #:use-module (srfi srfi-1))
46
47 (define nanopass
48 (let ((version "1.9.2"))
49 (origin
50 (method git-fetch)
51 (uri (git-reference
52 (url "https://github.com/nanopass/nanopass-framework-scheme")
53 (commit (string-append "v" version))))
54 (sha256 (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i"))
55 (file-name (git-file-name "nanopass" version)))))
56
57 (define stex
58 ;; This commit includes a fix, which we would otherwise want to use as
59 ;; patch. Let's revert to tagged releases as soon as one becomes available.
60 (let* ((commit "54051494434a197772bf6ca5b4e6cf6be55f39a5")
61 (version "1.2.2")
62 (version (git-version version "1" commit)))
63 (origin
64 (method git-fetch)
65 (uri (git-reference
66 (url "https://github.com/dybvig/stex")
67 (commit commit)))
68 (sha256 (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
69 (file-name (git-file-name "stex" version)))))
70
71 (define-public chez-scheme
72 (package
73 (name "chez-scheme")
74 (version "9.5.4")
75 (source
76 (origin
77 (method git-fetch)
78 (uri (git-reference
79 (url "https://github.com/cisco/ChezScheme")
80 (commit (string-append "v" version))))
81 (sha256
82 (base32 "0prgn2z9l888j93ydxaf04ph424g0fi3a8w7f8m0b2r7fr1v7388"))
83 (file-name (git-file-name name version))
84 (patches
85 (search-patches
86 ;; backported from upstream: remove on next release
87 "chez-scheme-build-util-paths-backport.patch"))
88 (snippet
89 ;; remove bundled libraries
90 (with-imported-modules '((guix build utils))
91 #~(begin
92 (use-modules (guix build utils))
93 (for-each (lambda (dir)
94 (when (directory-exists? dir)
95 (delete-file-recursively dir)))
96 '("stex"
97 "nanopass"
98 "lz4"
99 "zlib")))))))
100 (build-system gnu-build-system)
101 (inputs
102 `(("libuuid" ,util-linux "lib")
103 ("zlib" ,zlib)
104 ("zlib:static" ,zlib "static")
105 ("lz4" ,lz4)
106 ("lz4:static" ,lz4 "static")
107 ;; for expeditor:
108 ("ncurses" ,ncurses)
109 ;; for X11 clipboard support in expeditor:
110 ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
111 ("libx11" ,libx11)))
112 (native-inputs
113 `(("nanopass" ,nanopass) ; source only
114 ;; for docs
115 ("stex" ,stex)
116 ("xorg-rgb" ,xorg-rgb)
117 ("texlive" ,(texlive-union (list texlive-latex-oberdiek
118 texlive-generic-epsf)))
119 ("ghostscript" ,ghostscript)
120 ("netpbm" ,netpbm)))
121 (native-search-paths
122 (list (search-path-specification
123 (variable "CHEZSCHEMELIBDIRS")
124 (files (list (string-append "lib/csv" version "-site"))))))
125 (outputs '("out" "doc"))
126 (arguments
127 `(#:modules
128 ((guix build gnu-build-system)
129 (guix build utils)
130 (ice-9 ftw)
131 (ice-9 match))
132 #:test-target "test"
133 #:configure-flags
134 '("--threads") ;; TODO when we fix armhf, it doesn't support --threads
135 #:phases
136 (modify-phases %standard-phases
137 ;; put these where configure expects them to be
138 (add-after 'unpack 'unpack-nanopass+stex
139 (lambda* (#:key native-inputs inputs #:allow-other-keys)
140 (for-each (lambda (dep)
141 (define src
142 (assoc-ref (or native-inputs inputs) dep))
143 (copy-recursively src dep
144 #:keep-mtime? #t))
145 '("nanopass" "stex"))
146 #t))
147 ;; NOTE: the custom Chez 'configure' script doesn't allow
148 ;; unrecognized flags, such as those automatically added
149 ;; by `gnu-build-system`.
150 (replace 'configure
151 (lambda* (#:key inputs outputs
152 (configure-flags '())
153 #:allow-other-keys)
154 (let* ((zlib-static (assoc-ref inputs "zlib:static"))
155 (lz4-static (assoc-ref inputs "lz4:static"))
156 (out (assoc-ref outputs "out"))
157 ;; add flags which are always required:
158 (flags (cons*
159 (string-append "--installprefix=" out)
160 (string-append "ZLIB=" zlib-static "/lib/libz.a")
161 (string-append "LZ4=" lz4-static "/lib/liblz4.a")
162 ;; Guix will do compress man pages,
163 ;; and letting Chez try causes an error
164 "--nogzip-man-pages"
165 configure-flags)))
166 (format #t "configure flags: ~s~%" flags)
167 ;; Some makefiles (for tests) don't seem to propagate CC
168 ;; properly, so we take it out of their hands:
169 (setenv "CC" ,(cc-for-target))
170 (apply invoke
171 "./configure"
172 flags)
173 #t)))
174 ;; The binary file name is called "scheme" as is 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 ;; Building explicitly lets us avoid using substitute*
190 ;; to re-write makefiles.
191 (add-after 'install-symlink 'prepare-stex
192 (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
193 (let* ((stex+version
194 (strip-store-file-name
195 (assoc-ref (or native-inputs inputs) "stex")))
196 ;; Eventually we want to install stex as a real
197 ;; package so it's reusable. For now:
198 (stex-output "/tmp")
199 (doc-dir (string-append stex-output
200 "/share/doc/"
201 stex+version)))
202 (with-directory-excursion "stex"
203 (invoke "make"
204 "install"
205 (string-append "LIB="
206 stex-output
207 "/lib/"
208 stex+version)
209 (string-append "Scheme="
210 (assoc-ref outputs "out")
211 "/bin/scheme"))
212 (for-each (lambda (pth)
213 (install-file pth doc-dir))
214 '("ReadMe" ; includes the license
215 "doc/stex.html"
216 "doc/stex.css"
217 "doc/stex.pdf"))
218 #t))))
219 ;; Building the documentation requires stex and a running scheme.
220 ;; FIXME: this is probably wrong for cross-compilation
221 (add-after 'prepare-stex 'install-doc
222 (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
223 (let* ((chez+version (strip-store-file-name
224 (assoc-ref outputs "out")))
225 (stex+version
226 (strip-store-file-name
227 (assoc-ref (or native-inputs inputs) "stex")))
228 (scheme (string-append (assoc-ref outputs "out")
229 "/bin/scheme"))
230 ;; see note on stex-output in phase build-stex, above:
231 (stexlib (string-append "/tmp"
232 "/lib/"
233 stex+version))
234 (doc-dir (string-append (assoc-ref outputs "doc")
235 "/share/doc/"
236 chez+version)))
237 (define* (stex-make #:optional (suffix ""))
238 (invoke "make"
239 "install"
240 (string-append "Scheme=" scheme)
241 (string-append "STEXLIB=" stexlib)
242 (string-append "installdir=" doc-dir suffix)))
243 (with-directory-excursion "csug"
244 (stex-make "/csug"))
245 (with-directory-excursion "release_notes"
246 (stex-make "/release_notes"))
247 (with-directory-excursion doc-dir
248 (symlink "release_notes/release_notes.pdf"
249 "release_notes.pdf")
250 (symlink "csug/csug9_5.pdf"
251 "csug.pdf"))
252 #t))))))
253 ;; Chez Scheme does not have a MIPS backend.
254 ;; FIXME: Debian backports patches to get armhf working.
255 ;; We should too. It is the Chez machine type arm32le
256 ;; (no threaded version upstream yet, though there is in
257 ;; Racket's fork), more specifically (per the release notes) ARMv6.
258 (supported-systems (fold delete %supported-systems
259 '("mips64el-linux" "armhf-linux")))
260 (home-page "https://cisco.github.io/ChezScheme/")
261 (synopsis "R6RS Scheme compiler and run-time")
262 (description
263 "Chez Scheme is a compiler and run-time system for the language of the
264 Revised^6 Report on Scheme (R6RS), with numerous extensions. The compiler
265 generates native code for each target processor, with support for x86, x86_64,
266 and 32-bit PowerPC architectures.")
267 (license asl2.0)))
268
269 (define-public chez-srfi
270 (package
271 (name "chez-srfi")
272 (version "1.0")
273 (source
274 (origin
275 (method git-fetch)
276 (uri (git-reference
277 (url "https://github.com/fedeinthemix/chez-srfi")
278 (commit (string-append "v" version))))
279 (sha256
280 (base32 "1vgn984mj2q4w6r2q66h7qklp2hrh85wwh4k9yisga5fi0ps7myf"))
281 (file-name (git-file-name name version))))
282 (build-system gnu-build-system)
283 (native-inputs
284 `(("chez-scheme" ,chez-scheme)))
285 (arguments
286 `(#:make-flags (let ((out (assoc-ref %outputs "out")))
287 (list (string-append "PREFIX=" out)
288 "CHEZ=chez-scheme --libdirs ./"
289 (string-append "chezversion=" ,(package-version chez-scheme))))
290 #:test-target "test"
291 #:phases (modify-phases %standard-phases
292 (delete 'configure))))
293 (home-page "https://github.com/fedeinthemix/chez-srfi")
294 (synopsis "SRFI libraries for Chez Scheme")
295 (description
296 "This package provides a collection of SRFI libraries for Chez Scheme.")
297 (license expat)))
298
299 (define-public chez-web
300 (let ((commit "5fd177fe53f31f466bf88720d03c95a3711a8bea")
301 (revision "1"))
302 (package
303 (name "chez-web")
304 ;; Release 2.0 is different and doesn't work.
305 (version (git-version "2.0" revision commit))
306 (source
307 (origin
308 (method git-fetch)
309 (uri (git-reference
310 (url "https://github.com/arcfide/ChezWEB")
311 (commit commit)))
312 (file-name (git-file-name name version))
313 (sha256
314 (base32 "1dq25qygyncbfq4kwwqqgyyakfqjwhp5q23vrf3bff1p66nyfl3b"))))
315 (build-system gnu-build-system)
316 (native-inputs
317 `(("chez-scheme" ,chez-scheme)
318 ("ghostscript" ,ghostscript)
319 ("texlive" ,(texlive-union (list texlive-latex-oberdiek
320 texlive-generic-epsf
321 texlive-metapost
322 texlive-fonts-charter
323 texlive-generic-pdftex
324 texlive-context-base
325 texlive-fonts-cm
326 texlive-tex-plain)))))
327 (arguments
328 `(#:make-flags (list (string-append "PREFIX=" %output)
329 (string-append "DOCDIR=" %output "/share/doc/"
330 ,name "-" ,version)
331 (string-append "LIBDIR=" %output "/lib/chezweb")
332 (string-append "TEXDIR=" %output "/share/texmf-local"))
333 #:tests? #f ; no tests
334 #:phases
335 (modify-phases %standard-phases
336 (add-before 'build 'set-HOME
337 (lambda _
338 ;; FIXME: texlive-union does not find the built
339 ;; metafonts, so it tries to generate them in HOME.
340 (setenv "HOME" "/tmp")
341 #t))
342 ;; This package has a custom "bootstrap" script that
343 ;; is meant to be run from the Makefile.
344 (delete 'bootstrap)
345 (replace 'configure
346 (lambda* _
347 (copy-file "config.mk.template" "config.mk")
348 (substitute* "tangleit"
349 (("\\./cheztangle\\.ss" all)
350 (string-append "chez-scheme --program " all)))
351 (substitute* "weaveit"
352 (("mpost chezweb\\.mp")
353 "mpost --tex=tex chezweb.mp")
354 (("\\./chezweave" all)
355 (string-append "chez-scheme --program " all)))
356 (substitute* "installit"
357 (("-g \\$GROUP -o \\$OWNER") ""))
358 #t)))))
359 (home-page "https://github.com/arcfide/ChezWEB")
360 (synopsis "Hygienic Literate Programming for Chez Scheme")
361 (description "ChezWEB is a system for doing Knuthian style WEB
362 programming in Scheme.")
363 (license expat))))
364
365 (define-public chez-sockets
366 (let ((commit "bce96881c06bd69a6757a6bff139744153924140")
367 (revision "1"))
368 (package
369 (name "chez-sockets")
370 (version (git-version "0.0.0" revision commit))
371 (source
372 (origin
373 (method git-fetch)
374 (uri (git-reference
375 (url "https://github.com/arcfide/chez-sockets")
376 (commit commit)))
377 (file-name (git-file-name name version))
378 (sha256
379 (base32 "1n5fbwwz51fdzvjackgmnsgh363g9inyxv7kmzi0469cwavwcx5m"))))
380 (build-system gnu-build-system)
381 (native-inputs
382 `(("chez-scheme" ,chez-scheme)
383 ("chez-web" ,chez-web)
384 ("texlive" ,(texlive-union (list texlive-generic-pdftex)))))
385 (arguments
386 `(#:tests? #f ; no tests
387 #:phases
388 (modify-phases %standard-phases
389 (replace 'configure
390 (lambda* (#:key outputs inputs #:allow-other-keys)
391 (let* ((out (assoc-ref outputs "out"))
392 (chez-web (assoc-ref inputs "chez-web"))
393 (chez (assoc-ref inputs "chez-scheme"))
394 (chez-h (dirname (car (find-files chez "scheme\\.h")))))
395 (substitute* "Makefile"
396 (("(SCHEMEH=).*$" all var)
397 (string-append var chez-h)))
398 #t)))
399 (add-before 'build 'tangle
400 (lambda* (#:key inputs #:allow-other-keys)
401 (setenv "TEXINPUTS"
402 (string-append
403 (getcwd) ":"
404 (assoc-ref inputs "chez-web") "/share/texmf-local/tex/generic:"
405 ":"))
406 ;; just using "make" tries to build the .c files before
407 ;; they are created.
408 (and (invoke "make" "sockets")
409 (invoke "make"))))
410 (replace 'build
411 (lambda* (#:key outputs inputs #:allow-other-keys)
412 (let* ((out (assoc-ref outputs "out"))
413 (chez-site (string-append out "/lib/csv"
414 ,(package-version chez-scheme)
415 "-site/arcfide")))
416 ;; make sure Chez Scheme can find the shared libraries.
417 (substitute* "sockets.ss"
418 (("(load-shared-object) \"(socket-ffi-values\\.[sd][oy].*)\""
419 all cmd so)
420 (string-append cmd " \"" chez-site "/" so "\""))
421 (("sockets-stub\\.[sd][oy].*" all)
422 (string-append chez-site "/" all)))
423 ;; to compile chez-sockets, the .so files must be
424 ;; installed (because of the absolute path we
425 ;; inserted above).
426 (for-each (lambda (f d) (install-file f d))
427 '("socket-ffi-values.so" "sockets-stub.so")
428 (list chez-site chez-site))
429 (zero? (system "echo '(compile-file \"sockets.sls\")' | scheme -q")))))
430 (replace 'install
431 (lambda* (#:key outputs inputs #:allow-other-keys)
432 (let* ((out (assoc-ref outputs "out"))
433 (lib (string-append out "/lib/chez-sockets"))
434 (doc (string-append out "/share/doc/" ,name "-" ,version))
435 (chez-site (string-append out "/lib/csv"
436 ,(package-version chez-scheme)
437 "-site/arcfide")))
438 (for-each (lambda (f d) (install-file f d))
439 '("sockets.pdf" "sockets.so")
440 (list doc chez-site))
441 #t))))))
442 (home-page "https://github.com/arcfide/chez-sockets")
443 (synopsis "Extensible sockets library for Chez Scheme")
444 (description "Chez-sockets is an extensible sockets library for
445 Chez Scheme.")
446 (license expat))))
447
448 ;; Help function for Chez Scheme to add the current path to
449 ;; CHEZSCHEMELIBDIRS.
450 (define chez-configure
451 '(lambda _
452 (let ((chez-env (getenv "CHEZSCHEMELIBDIRS")))
453 (setenv "CHEZSCHEMELIBDIRS"
454 (if chez-env
455 (string-append ".:" chez-env)
456 "."))
457 #t)))
458
459 ;; Help function to define make flags for some Chez Scheme custom make
460 ;; files.
461 (define (chez-make-flags name version)
462 `(let ((out (assoc-ref %outputs "out")))
463 (list
464 ;; Set 'chezversion' so that libraries are installed in
465 ;; 'lib/csvX.Y.Z-site' like Chez's 'native-search-paths' expects.
466 (string-append "chezversion=" ,(package-version chez-scheme))
467 (string-append "PREFIX=" out)
468 (string-append "DOCDIR=" out "/share/doc/"
469 ,name "-" ,version))))
470
471 (define-public chez-matchable
472 (package
473 (name "chez-matchable")
474 (version "20160306")
475 (home-page "https://github.com/fedeinthemix/chez-matchable")
476 (source
477 (origin
478 (method git-fetch)
479 (uri (git-reference
480 (url home-page)
481 (commit (string-append "v" version))))
482 (sha256
483 (base32 "02qn7x348p23z1x5lwhkyj7i8z6mgwpzpnwr8dyina0yzsdkr71s"))
484 (file-name (git-file-name name version))))
485 (build-system gnu-build-system)
486 (inputs
487 `(("chez-srfi" ,chez-srfi))) ; for tests
488 (native-inputs
489 `(("chez-scheme" ,chez-scheme)))
490 (arguments
491 `(#:make-flags ,(chez-make-flags name version)
492 #:test-target "test"
493 #:phases (modify-phases %standard-phases
494 (replace 'configure ,chez-configure))))
495 (synopsis "Portable hygienic pattern matcher for Scheme")
496 (description "This package provides a superset of the popular Scheme
497 @code{match} package by Andrew Wright, written in fully portable
498 @code{syntax-rules} and thus preserving hygiene.")
499 (license public-domain)))
500
501 (define-public chez-irregex
502 (package
503 (name "chez-irregex")
504 (version "0.9.4")
505 (source
506 (origin
507 (method git-fetch)
508 (uri (git-reference
509 (url "https://github.com/fedeinthemix/chez-irregex")
510 (commit (string-append "v" version))))
511 (sha256
512 (base32 "0jh6piylw545j81llay9wfivgpv6lcnwd81gm4w17lkasslir50q"))
513 (file-name (git-file-name name version))))
514 (build-system gnu-build-system)
515 (inputs
516 `(("chez-matchable" ,chez-matchable))) ; for tests
517 (propagated-inputs
518 `(("chez-srfi" ,chez-srfi))) ; for irregex-utils
519 (native-inputs
520 `(("chez-scheme" ,chez-scheme)))
521 (arguments
522 `(#:make-flags ,(chez-make-flags name version)
523 #:test-target "test"
524 #:phases (modify-phases %standard-phases
525 (replace 'configure ,chez-configure))))
526 (home-page "https://github.com/fedeinthemix/chez-irregex")
527 (synopsis "Portable regular expression library for Scheme")
528 (description "This package provides a portable and efficient
529 R[4567]RS implementation of regular expressions, supporting both POSIX
530 syntax with various (irregular) PCRE extensions, as well as SCSH's SRE
531 syntax, with various aliases for commonly used patterns.")
532 (license bsd-3)))
533
534 (define-public chez-fmt
535 (package
536 (name "chez-fmt")
537 (version "0.8.11")
538 (source
539 (origin
540 (method url-fetch)
541 (uri (string-append
542 "http://synthcode.com/scheme/fmt/fmt-" version ".tar.gz"))
543 (sha256
544 (base32 "1zxqlw1jyg85yzclylh8bp2b3fwcy3l3xal68jw837n5illvsjcl"))
545 (file-name (string-append name "-" version ".tar.gz"))))
546 (build-system gnu-build-system)
547 (propagated-inputs
548 `(("chez-srfi" ,chez-srfi))) ; for irregex-utils
549 (native-inputs
550 `(("chez-scheme" ,chez-scheme)))
551 (arguments
552 `(#:make-flags ,(chez-make-flags name version)
553 #:test-target "chez-check"
554 #:phases
555 (modify-phases %standard-phases
556 (replace 'configure ,chez-configure)
557 (replace 'build
558 (lambda* (#:key (make-flags '()) #:allow-other-keys)
559 (apply invoke "make" "chez-build" make-flags)))
560 (replace 'install
561 (lambda* (#:key (make-flags '()) #:allow-other-keys)
562 (apply invoke "make" "chez-install" make-flags))))))
563 (home-page "http://synthcode.com/scheme/fmt")
564 (synopsis "Combinator formatting library for Chez Scheme")
565 (description "This package provides a library of procedures for
566 formatting Scheme objects to text in various ways, and for easily
567 concatenating, composing and extending these formatters efficiently
568 without resorting to capturing and manipulating intermediate
569 strings.")
570 (license bsd-3)))
571
572 (define-public chez-mit
573 (package
574 (name "chez-mit")
575 (version "0.1")
576 (home-page "https://github.com/fedeinthemix/chez-mit")
577 (source
578 (origin
579 (method git-fetch)
580 (uri (git-reference
581 (url home-page)
582 (commit (string-append "v" version))))
583 (sha256
584 (base32 "0c7i3b6i90xk96nmxn1pc9272a4yal4v40dm1a4ybdi87x53zkk0"))
585 (file-name (git-file-name name version))))
586 (build-system gnu-build-system)
587 (inputs
588 `(("chez-srfi" ,chez-srfi))) ; for tests
589 (native-inputs
590 `(("chez-scheme" ,chez-scheme)))
591 (arguments
592 `(#:make-flags ,(chez-make-flags name version)
593 #:test-target "test"
594 #:phases (modify-phases %standard-phases
595 (replace 'configure ,chez-configure))))
596 (synopsis "MIT/GNU Scheme compatibility library for Chez Scheme")
597 (description "This package provides a set of MIT/GNU Scheme compatibility
598 libraries for Chez Scheme. The main goal was to provide the functionality
599 required to port the program @code{Scmutils} to Chez Scheme.")
600 (license gpl3+)))
601
602 (define-public chez-scmutils
603 (package
604 (name "chez-scmutils")
605 (version "0.1")
606 (home-page "https://github.com/fedeinthemix/chez-scmutils")
607 (source
608 (origin
609 (method git-fetch)
610 (uri (git-reference
611 (url home-page)
612 (commit (string-append "v" version))))
613 (sha256
614 (base32 "0lb05wlf8qpgg8y0gdsyaxg1nbfx1qbaqdjvygrp64ndn8fnhq7l"))
615 (file-name (git-file-name name version))))
616 (build-system gnu-build-system)
617 (inputs
618 `(("chez-srfi" ,chez-srfi))) ; for tests
619 (native-inputs
620 `(("chez-scheme" ,chez-scheme)))
621 (propagated-inputs
622 `(("chez-mit" ,chez-mit)
623 ("chez-srfi" ,chez-srfi)))
624 (arguments
625 `(#:make-flags ,(chez-make-flags name version)
626 #:tests? #f ; no test suite
627 #:phases
628 (modify-phases %standard-phases
629 (replace 'configure ,chez-configure)
630 ;; Since the documentation is lacking, we install the source
631 ;; code. For things to work correctly we have to replace
632 ;; relative paths by absolute ones in 'include' forms. This
633 ;; in turn requires us to compile the files in the final
634 ;; destination.
635 (delete 'build)
636 (add-after 'install 'install-src
637 (lambda* (#:key (make-flags '()) #:allow-other-keys)
638 (apply invoke "make" "install-src" make-flags)))
639 (add-after 'install-src 'absolute-path-in-scm-files
640 (lambda* (#:key outputs #:allow-other-keys)
641 (let ((out (assoc-ref outputs "out")))
642 (for-each (lambda (file)
643 (substitute* file
644 (("include +\"\\./scmutils")
645 (string-append "include \"" (dirname file)))))
646 (find-files out "\\.sls"))
647 (for-each (lambda (file)
648 (substitute* file
649 (("include +\"\\./scmutils/simplify")
650 (string-append "include \"" (dirname file)))))
651 (find-files out "fbe-syntax\\.scm"))
652 #t)))
653 (add-after 'absolute-path-in-scm-files 'build
654 (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
655 (let* ((out (assoc-ref outputs "out"))
656 (mk-file (car (find-files out "Makefile"))))
657 (with-directory-excursion (dirname mk-file)
658 (apply invoke "make" "build" make-flags)))))
659 (add-after 'build 'clean-up
660 (lambda* (#:key outputs #:allow-other-keys)
661 (let* ((out (assoc-ref outputs "out")))
662 (for-each delete-file
663 (find-files out "Makefile|compile-all\\.ss"))
664 #t))))))
665 (synopsis "Port of MIT/GNU Scheme Scmutils to Chez Scheme")
666 (description "This package provides a port of the MIT/GNU Scheme
667 Scmutils program to Chez Scheme. The port consists of a set of
668 libraries providing most of the functionality of the original.")
669 (license gpl3+)))