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