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