Merge remote-tracking branch 'master' into core-updates.
[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 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages chez)
23 #:use-module (gnu packages)
24 #:use-module ((guix licenses)
25 #:select (gpl2+ gpl3+ lgpl2.0+ lgpl2.1+ asl2.0 bsd-3 expat
26 public-domain))
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix utils)
31 #:use-module (guix build-system gnu)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages ncurses)
34 #:use-module (gnu packages ghostscript)
35 #:use-module (gnu packages linux)
36 #:use-module (gnu packages netpbm)
37 #:use-module (gnu packages tex)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages image)
40 #:use-module (gnu packages xorg)
41 #:use-module (ice-9 match)
42 #:use-module (srfi srfi-1))
43
44 (define nanopass
45 (let ((version "1.9"))
46 (origin
47 (method git-fetch)
48 (uri (git-reference
49 (url "https://github.com/nanopass/nanopass-framework-scheme.git")
50 (commit (string-append "v" version))))
51 (sha256 (base32 "0lrngdna6w7v9vlp1a873hgwrwsz2p0pgkccswa4smzvdyhgfsri"))
52 (file-name (git-file-name "nanopass" version)))))
53
54 (define stex
55 (let ((version "1.2.1"))
56 (origin
57 (method git-fetch)
58 (uri (git-reference
59 (url "https://github.com/dybvig/stex.git")
60 (commit (string-append "v" version))))
61 (sha256 (base32 "1jiawhhqnsj42hzmlbq5xby3iarhf8vhiqs0kg1a0zg5jsn6cf8n"))
62 (file-name (git-file-name "stex" version)))))
63
64 (define-public chez-scheme
65 (package
66 (name "chez-scheme")
67 (version "9.5.2")
68 (source
69 (origin
70 (method git-fetch)
71 (uri (git-reference
72 (url "https://github.com/cisco/ChezScheme.git")
73 (commit (string-append "v" version))))
74 (sha256
75 (base32 "1hagrqdp649n2g0wq2a9gfnz7mjcjakkw7ziplbj3db412bb7kx5"))
76 (file-name (git-file-name name version))
77 (modules '((guix build utils)))
78 (snippet
79 ;; Fix compilation with glibc >= 2.26, which removed xlocale.h.
80 '(begin
81 (substitute* "c/expeditor.c"
82 (("xlocale\\.h") "locale.h"))
83 #t))))
84 (build-system gnu-build-system)
85 (inputs
86 `(("ncurses" ,ncurses)
87 ("libx11" ,libx11)
88 ("xorg-rgb" ,xorg-rgb)
89 ("nanopass" ,nanopass)
90 ("zlib" ,zlib)
91 ("zlib:static" ,zlib "static")
92 ("stex" ,stex)))
93 (native-inputs
94 `(("texlive" ,(texlive-union (list texlive-latex-oberdiek
95 texlive-generic-epsf)))
96 ("ghostscript" ,ghostscript)
97 ("netpbm" ,netpbm)
98 ("util-linux" ,util-linux)))
99 (native-search-paths
100 (list (search-path-specification
101 (variable "CHEZSCHEMELIBDIRS")
102 (files (list (string-append "lib/csv" version "-site"))))))
103 (outputs '("out" "doc"))
104 (arguments
105 `(#:modules ((guix build gnu-build-system)
106 (guix build utils)
107 (ice-9 match))
108 #:test-target "test"
109 #:configure-flags
110 (list ,(match (or (%current-target-system) (%current-system))
111 ("x86_64-linux" '(list "--machine=ta6le"))
112 ("i686-linux" '(list "--machine=ti3le"))
113 ;; Let autodetection have its attempt on other architectures.
114 (_
115 '())))
116 #:phases
117 (modify-phases %standard-phases
118 (add-after 'unpack 'patch-processor-detection
119 (lambda _ (substitute* "configure"
120 (("uname -a") "uname -m"))
121 #t))
122 ;; Adapt the custom 'configure' script.
123 (replace 'configure
124 (lambda* (#:key inputs outputs #:allow-other-keys)
125 (let ((out (assoc-ref outputs "out"))
126 (nanopass (assoc-ref inputs "nanopass"))
127 (stex (assoc-ref inputs "stex"))
128 (zlib (assoc-ref inputs "zlib"))
129 (zlib-static (assoc-ref inputs "zlib:static"))
130 (unpack (assoc-ref %standard-phases 'unpack))
131 (patch-source-shebangs
132 (assoc-ref %standard-phases 'patch-source-shebangs)))
133 (map (match-lambda
134 ((src orig-name new-name)
135 (with-directory-excursion "."
136 (apply unpack (list #:source src))
137 (apply patch-source-shebangs (list #:source src)))
138 (delete-file-recursively new-name)
139 (invoke "mv" orig-name new-name)))
140 `((,nanopass "source" "nanopass")
141 (,stex "source" "stex")))
142 ;; The configure step wants to CURL all submodules as it
143 ;; detects a checkout without submodules. Disable curling,
144 ;; and manually patch the needed modules for compilation.
145 (substitute* "configure"
146 (("! -f '") "-d '")) ; working around CURL.
147 (substitute* (find-files "./c" "Mf-[a-zA-Z0-9.]+")
148 (("\\$\\{Kernel\\}: \\$\\{kernelobj\\} \\.\\./zlib/libz\\.a")
149 "${Kernel}: ${kernelobj}")
150 (("ld ([-a-zA-Z0-9_${} ]+) \\.\\./zlib/libz\\.a" all args)
151 (string-append "ld " args " " zlib-static "/lib/libz.a"))
152 (("\\(cd \\.\\./zlib; ([-a-zA-Z0-9=./ ]+))")
153 (which "true")))
154 (substitute* (find-files "mats" "Mf-.*")
155 (("^[[:space:]]+(cc ) *") "\tgcc "))
156 (substitute*
157 (find-files "." (string-append
158 "("
159 "Mf-[a-zA-Z0-9.]+"
160 "|Makefile[a-zA-Z0-9.]*"
161 "|checkin"
162 "|stex\\.stex"
163 "|newrelease"
164 "|workarea"
165 ;;"|[a-zA-Z0-9.]+\\.ms" ; guile can't read
166 ")"))
167 (("/bin/rm") (which "rm"))
168 (("/bin/ln") (which "ln"))
169 (("/bin/cp") (which "cp")))
170 (substitute* "makefiles/installsh"
171 (("/bin/true") (which "true")))
172 (substitute* "stex/Makefile"
173 (("PREFIX=/usr") (string-append "PREFIX=" out)))
174 (invoke "./configure" "--threads"
175 (string-append "--installprefix=" out)))))
176 ;; Installation of the documentation requires a running "chez".
177 (add-after 'install 'install-doc
178 (lambda* (#:key inputs outputs #:allow-other-keys)
179 (let ((doc (string-append (assoc-ref outputs "doc")
180 "/share/doc/" ,name "-" ,version)))
181 (invoke "make" "docs")
182 (with-directory-excursion "csug"
183 (substitute* "Makefile"
184 ;; The ‘installdir=’ can't be overruled on the command line.
185 (("/tmp/csug9") doc)
186 ;; $m is the ‘machine type’, e.g. ‘ta6le’ on x86_64, but is
187 ;; set incorrectly for some reason, e.g. to ‘a6le’ on x86_64.
188 ;; Avoid the whole mess by running the (machine-independent)
189 ;; ‘installsh’ script at its original location.
190 (("\\$m/installsh") "makefiles/installsh"))
191 (invoke "make" "install")
192 (install-file "csug.pdf" doc))
193 (with-directory-excursion "release_notes"
194 (install-file "release_notes.pdf" doc))
195 #t)))
196 ;; The binary file name is called "scheme" as the one from MIT/GNU
197 ;; Scheme. We add a symlink to use in case both are installed.
198 (add-after 'install 'install-symlink
199 (lambda* (#:key outputs #:allow-other-keys)
200 (let* ((out (assoc-ref outputs "out"))
201 (bin (string-append out "/bin"))
202 (lib (string-append out "/lib"))
203 (name "chez-scheme"))
204 (symlink (string-append bin "/scheme")
205 (string-append bin "/" name))
206 (map (lambda (file)
207 (symlink file (string-append (dirname file)
208 "/" name ".boot")))
209 (find-files lib "scheme.boot"))
210 #t)))
211 (add-before 'reset-gzip-timestamps 'make-manpages-writable
212 (lambda* (#:key outputs #:allow-other-keys)
213 (map (lambda (file)
214 (make-file-writable file))
215 (find-files (string-append (assoc-ref outputs "out")
216 "/share/man")
217 ".*\\.gz$"))
218 #t)))))
219 ;; According to the documentation MIPS is not supported.
220 ;; Cross-compiling for the Raspberry Pi is supported, but not native ARM.
221 (supported-systems (fold delete %supported-systems
222 '("mips64el-linux" "armhf-linux")))
223 (home-page "https://cisco.github.io/ChezScheme/")
224 (synopsis "R6RS Scheme compiler and run-time")
225 (description
226 "Chez Scheme is a compiler and run-time system for the language of the
227 Revised^6 Report on Scheme (R6RS), with numerous extensions. The compiler
228 generates native code for each target processor, with support for x86, x86_64,
229 and 32-bit PowerPC architectures.")
230 (license asl2.0)))
231
232 (define-public chez-srfi
233 (package
234 (name "chez-srfi")
235 (version "1.0")
236 (source
237 (origin
238 (method git-fetch)
239 (uri (git-reference
240 (url "https://github.com/fedeinthemix/chez-srfi.git")
241 (commit (string-append "v" version))))
242 (sha256
243 (base32 "1vgn984mj2q4w6r2q66h7qklp2hrh85wwh4k9yisga5fi0ps7myf"))
244 (file-name (git-file-name name version))))
245 (build-system gnu-build-system)
246 (native-inputs
247 `(("chez-scheme" ,chez-scheme)))
248 (arguments
249 `(#:make-flags (let ((out (assoc-ref %outputs "out")))
250 (list (string-append "PREFIX=" out)))
251 #:test-target "test"
252 #:phases (modify-phases %standard-phases
253 (delete 'configure))))
254 (home-page "https://github.com/fedeinthemix/chez-srfi")
255 (synopsis "SRFI libraries for Chez Scheme")
256 (description
257 "This package provides a collection of SRFI libraries for Chez Scheme.")
258 (license expat)))
259
260 (define-public chez-web
261 (let ((commit "5fd177fe53f31f466bf88720d03c95a3711a8bea")
262 (revision "1"))
263 (package
264 (name "chez-web")
265 ;; Release 2.0 is different and doesn't work.
266 (version (git-version "2.0" revision commit))
267 (source
268 (origin
269 (method git-fetch)
270 (uri (git-reference
271 (url "https://github.com/arcfide/ChezWEB.git")
272 (commit commit)))
273 (file-name (git-file-name name version))
274 (sha256
275 (base32 "1dq25qygyncbfq4kwwqqgyyakfqjwhp5q23vrf3bff1p66nyfl3b"))))
276 (build-system gnu-build-system)
277 (native-inputs
278 `(("chez-scheme" ,chez-scheme)
279 ("ghostscript" ,ghostscript)
280 ("texlive" ,(texlive-union (list texlive-latex-oberdiek
281 texlive-generic-epsf
282 texlive-metapost
283 texlive-fonts-charter
284 texlive-generic-pdftex
285 texlive-context-base
286 texlive-fonts-cm
287 texlive-tex-plain)))))
288 (arguments
289 `(#:make-flags (list (string-append "PREFIX=" %output)
290 (string-append "DOCDIR=" %output "/share/doc/"
291 ,name "-" ,version)
292 (string-append "LIBDIR=" %output "/lib/chezweb")
293 (string-append "TEXDIR=" %output "/share/texmf-local"))
294 #:tests? #f ; no tests
295 #:phases
296 (modify-phases %standard-phases
297 (add-before 'build 'set-HOME
298 (lambda _
299 ;; FIXME: texlive-union does not find the built
300 ;; metafonts, so it tries to generate them in HOME.
301 (setenv "HOME" "/tmp")
302 #t))
303 ;; This package has a custom "bootstrap" script that
304 ;; is meant to be run from the Makefile.
305 (delete 'bootstrap)
306 (replace 'configure
307 (lambda* _
308 (copy-file "config.mk.template" "config.mk")
309 (substitute* "tangleit"
310 (("\\./cheztangle\\.ss" all)
311 (string-append "chez-scheme --program " all)))
312 (substitute* "weaveit"
313 (("mpost chezweb\\.mp")
314 "mpost --tex=tex chezweb.mp")
315 (("\\./chezweave" all)
316 (string-append "chez-scheme --program " all)))
317 (substitute* "installit"
318 (("-g \\$GROUP -o \\$OWNER") ""))
319 #t)))))
320 (home-page "https://github.com/arcfide/ChezWEB")
321 (synopsis "Hygienic Literate Programming for Chez Scheme")
322 (description "ChezWEB is a system for doing Knuthian style WEB
323 programming in Scheme.")
324 (license expat))))
325
326 (define-public chez-sockets
327 (let ((commit "bce96881c06bd69a6757a6bff139744153924140")
328 (revision "1"))
329 (package
330 (name "chez-sockets")
331 (version (git-version "0.0.0" revision commit))
332 (source
333 (origin
334 (method git-fetch)
335 (uri (git-reference
336 (url "https://github.com/arcfide/chez-sockets.git")
337 (commit commit)))
338 (file-name (git-file-name name version))
339 (sha256
340 (base32 "1n5fbwwz51fdzvjackgmnsgh363g9inyxv7kmzi0469cwavwcx5m"))))
341 (build-system gnu-build-system)
342 (native-inputs
343 `(("chez-scheme" ,chez-scheme)
344 ("chez-web" ,chez-web)
345 ("texlive" ,(texlive-union (list texlive-generic-pdftex)))))
346 (arguments
347 `(#:tests? #f ; no tests
348 #:phases
349 (modify-phases %standard-phases
350 (replace 'configure
351 (lambda* (#:key outputs inputs #:allow-other-keys)
352 (let* ((out (assoc-ref outputs "out"))
353 (chez-web (assoc-ref inputs "chez-web"))
354 (chez (assoc-ref inputs "chez-scheme"))
355 (chez-h (dirname (car (find-files chez "scheme\\.h")))))
356 (substitute* "Makefile"
357 (("(SCHEMEH=).*$" all var)
358 (string-append var chez-h)))
359 #t)))
360 (add-before 'build 'tangle
361 (lambda* (#:key inputs #:allow-other-keys)
362 (setenv "TEXINPUTS"
363 (string-append
364 (getcwd) ":"
365 (assoc-ref inputs "chez-web") "/share/texmf-local/tex/generic:"
366 ":"))
367 ;; just using "make" tries to build the .c files before
368 ;; they are created.
369 (and (invoke "make" "sockets")
370 (invoke "make"))))
371 (replace 'build
372 (lambda* (#:key outputs inputs #:allow-other-keys)
373 (let* ((out (assoc-ref outputs "out"))
374 (chez-site (string-append out "/lib/csv"
375 ,(package-version chez-scheme)
376 "-site/arcfide")))
377 ;; make sure Chez Scheme can find the shared libraries.
378 (substitute* "sockets.ss"
379 (("(load-shared-object) \"(socket-ffi-values\\.[sd][oy].*)\""
380 all cmd so)
381 (string-append cmd " \"" chez-site "/" so "\""))
382 (("sockets-stub\\.[sd][oy].*" all)
383 (string-append chez-site "/" all)))
384 ;; to compile chez-sockets, the .so files must be
385 ;; installed (because of the absolute path we
386 ;; inserted above).
387 (for-each (lambda (f d) (install-file f d))
388 '("socket-ffi-values.so" "sockets-stub.so")
389 (list chez-site chez-site))
390 (zero? (system "echo '(compile-file \"sockets.sls\")' | scheme -q")))))
391 (replace 'install
392 (lambda* (#:key outputs inputs #:allow-other-keys)
393 (let* ((out (assoc-ref outputs "out"))
394 (lib (string-append out "/lib/chez-sockets"))
395 (doc (string-append out "/share/doc/" ,name "-" ,version))
396 (chez-site (string-append out "/lib/csv"
397 ,(package-version chez-scheme)
398 "-site/arcfide")))
399 (for-each (lambda (f d) (install-file f d))
400 '("sockets.pdf" "sockets.so")
401 (list doc chez-site))
402 #t))))))
403 (home-page "https://github.com/arcfide/chez-sockets")
404 (synopsis "Extensible sockets library for Chez Scheme")
405 (description "Chez-sockets is an extensible sockets library for
406 Chez Scheme.")
407 (license expat))))
408
409 ;; Help function for Chez Scheme to add the current path to
410 ;; CHEZSCHEMELIBDIRS.
411 (define chez-configure
412 '(lambda _
413 (let ((chez-env (getenv "CHEZSCHEMELIBDIRS")))
414 (setenv "CHEZSCHEMELIBDIRS"
415 (if chez-env
416 (string-append ".:" chez-env)
417 "."))
418 #t)))
419
420 ;; Help function to define make flags for some Chez Scheme custom make
421 ;; files.
422 (define (chez-make-flags name version)
423 `(let ((out (assoc-ref %outputs "out")))
424 (list (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.git")
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+)))