gnu: chez-web: Return #t from all phases.
[jackhill/guix/guix.git] / gnu / packages / chez.scm
CommitLineData
13bbc0cc
FB
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
1e16648f 3;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
f88c1c5d 4;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
13bbc0cc
FB
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)
53b9684e 24 #:select (gpl2+ gpl3+ lgpl2.0+ lgpl2.1+ asl2.0 bsd-3 expat
4dfe4eee 25 public-domain))
13bbc0cc
FB
26 #:use-module (guix packages)
27 #:use-module (guix download)
4dfe4eee 28 #:use-module (guix git-download)
13bbc0cc
FB
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)
bc05caee
EF
39 #:use-module (ice-9 match)
40 #:use-module (srfi srfi-1))
13bbc0cc
FB
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")
f88c1c5d 65 (version "9.5")
13bbc0cc
FB
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
f88c1c5d 72 (base32 "135991hspq0grf26pvl2lkwhp92yz204h6rgiwyym0x6v0xzknd1"))
9e9a207b
LC
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.
6cbee49d
MW
77 '(begin
78 (substitute* "c/expeditor.c"
79 (("xlocale\\.h") "locale.h"))
80 #t))))
13bbc0cc
FB
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)
08f535eb 88 ("zlib:static" ,zlib "static")
13bbc0cc
FB
89 ("stex" ,stex)))
90 (native-inputs
c11f3b3d
PN
91 `(("texlive" ,(texlive-union (list texlive-latex-oberdiek
92 texlive-generic-epsf)))
b09e0cd1 93 ("ghostscript" ,ghostscript)
13bbc0cc
FB
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"))
1e16648f 109 ;; Let autodetection have its attempt on other architectures.
13bbc0cc
FB
110 (_
111 '())))
112 #:phases
113 (modify-phases %standard-phases
7ceee88c
EF
114 (add-after 'unpack 'patch-processor-detection
115 (lambda _ (substitute* "configure"
116 (("uname -a") "uname -m"))
f88c1c5d
TGR
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
13bbc0cc
FB
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"))
08f535eb 133 (zlib-static (assoc-ref inputs "zlib:static"))
13bbc0cc
FB
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)
08f535eb 154 (string-append "ld " args " " zlib-static "/lib/libz.a"))
13bbc0cc
FB
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"))
fa63939a
MB
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)))))
13bbc0cc 221 ;; According to the documentation MIPS is not supported.
1e16648f
EF
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")))
13bbc0cc
FB
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
229Revised^6 Report on Scheme (R6RS), with numerous extensions. The compiler
230generates native code for each target processor, with support for x86, x86_64,
231and 32-bit PowerPC architectures.")
232 (license asl2.0)))
c344b85d
FB
233
234(define-public chez-srfi
235 (package
236 (name "chez-srfi")
237 (version "1.0")
238 (source
239 (origin
240 (method url-fetch)
241 (uri (string-append
242 "https://github.com/fedeinthemix/chez-srfi/archive"
243 "/v" version ".tar.gz"))
244 (sha256
245 (base32 "17i4wly7bcr5kb5hf04ljpbvv4r5hsr9xsmw650fj43z9jr303gs"))
246 (file-name (string-append name "-" version ".tar.gz"))))
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)))
4dfe4eee
FB
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 (string-append "2.0-" revision "."
269 (string-take commit 7)))
270 (source
271 (origin
272 (method git-fetch)
273 (uri (git-reference
274 (url "https://github.com/arcfide/ChezWEB.git")
275 (commit commit)))
276 (file-name (string-append name "-" version "-checkout"))
277 (sha256
278 (base32 "1dq25qygyncbfq4kwwqqgyyakfqjwhp5q23vrf3bff1p66nyfl3b"))))
279 (build-system gnu-build-system)
280 (native-inputs
281 `(("chez-scheme" ,chez-scheme)
bc9319f4
PN
282 ("ghostscript" ,ghostscript)
283 ("texlive" ,(texlive-union (list texlive-latex-oberdiek
284 texlive-generic-epsf
285 texlive-metapost
286 texlive-fonts-charter
287 texlive-generic-pdftex
288 texlive-context-base
289 texlive-fonts-cm
290 texlive-tex-plain)))))
4dfe4eee
FB
291 (arguments
292 `(#:make-flags (list (string-append "PREFIX=" %output)
293 (string-append "DOCDIR=" %output "/share/doc/"
294 ,name "-" ,version)
295 (string-append "LIBDIR=" %output "/lib/chezweb")
296 (string-append "TEXDIR=" %output "/share/texmf-local"))
297 #:tests? #f ; no tests
298 #:phases
299 (modify-phases %standard-phases
bc9319f4
PN
300 (add-before 'build 'set-HOME
301 (lambda _
302 ;; FIXME: texlive-union does not find the built
303 ;; metafonts, so it tries to generate them in HOME.
304 (setenv "HOME" "/tmp")
305 #t))
13d37d84
PN
306 ;; This package has a custom "bootstrap" script that
307 ;; is meant to be run from the Makefile.
308 (delete 'bootstrap)
4dfe4eee
FB
309 (replace 'configure
310 (lambda* _
311 (copy-file "config.mk.template" "config.mk")
312 (substitute* "tangleit"
313 (("\\./cheztangle\\.ss" all)
314 (string-append "chez-scheme --program " all)))
315 (substitute* "weaveit"
316 (("mpost chezweb\\.mp")
317 "mpost --tex=tex chezweb.mp")
318 (("\\./chezweave" all)
319 (string-append "chez-scheme --program " all)))
320 (substitute* "installit"
a0bdbf8b
TGR
321 (("-g \\$GROUP -o \\$OWNER") ""))
322 #t)))))
4dfe4eee
FB
323 (home-page "https://github.com/arcfide/ChezWEB")
324 (synopsis "Hygienic Literate Programming for Chez Scheme")
325 (description "ChezWEB is a system for doing Knuthian style WEB
326programming in Scheme.")
327 (license expat))))
74f9c190
FB
328
329(define-public chez-sockets
330 (let ((commit "bce96881c06bd69a6757a6bff139744153924140")
331 (revision "1"))
332 (package
333 (name "chez-sockets")
334 (version (string-append "0.0-" revision "."
335 (string-take commit 7)))
336 (source
337 (origin
338 (method git-fetch)
339 (uri (git-reference
340 (url "https://github.com/arcfide/chez-sockets.git")
341 (commit commit)))
342 (file-name (string-append name "-" version "-checkout"))
343 (sha256
344 (base32 "1n5fbwwz51fdzvjackgmnsgh363g9inyxv7kmzi0469cwavwcx5m"))))
345 (build-system gnu-build-system)
346 (native-inputs
347 `(("chez-scheme" ,chez-scheme)
348 ("chez-web" ,chez-web)
1e0f2ae0 349 ("texlive" ,(texlive-union (list texlive-generic-pdftex)))))
74f9c190
FB
350 (arguments
351 `(#:tests? #f ; no tests
352 #:phases
353 (modify-phases %standard-phases
354 (replace 'configure
355 (lambda* (#:key outputs inputs #:allow-other-keys)
356 (let* ((out (assoc-ref outputs "out"))
357 (chez-web (assoc-ref inputs "chez-web"))
358 (chez (assoc-ref inputs "chez-scheme"))
359 (chez-h (dirname (car (find-files chez "scheme\\.h")))))
360 (substitute* "Makefile"
361 (("(SCHEMEH=).*$" all var)
362 (string-append var chez-h)))
363 #t)))
364 (add-before 'build 'tangle
1e0f2ae0
PN
365 (lambda* (#:key inputs #:allow-other-keys)
366 (setenv "TEXINPUTS"
367 (string-append
368 (getcwd) ":"
369 (assoc-ref inputs "chez-web") "/share/texmf-local/tex/generic:"
370 ":"))
74f9c190
FB
371 ;; just using "make" tries to build the .c files before
372 ;; they are created.
1e0f2ae0
PN
373 (and (invoke "make" "sockets")
374 (invoke "make"))))
74f9c190
FB
375 (replace 'build
376 (lambda* (#:key outputs inputs #:allow-other-keys)
377 (let* ((out (assoc-ref outputs "out"))
378 (chez-site (string-append out "/lib/csv"
379 ,(package-version chez-scheme)
380 "-site/arcfide")))
381 ;; make sure Chez Scheme can find the shared libraries.
382 (substitute* "sockets.ss"
383 (("(load-shared-object) \"(socket-ffi-values\\.[sd][oy].*)\""
384 all cmd so)
385 (string-append cmd " \"" chez-site "/" so "\""))
386 (("sockets-stub\\.[sd][oy].*" all)
387 (string-append chez-site "/" all)))
388 ;; to compile chez-sockets, the .so files must be
389 ;; installed (because of the absolute path we
390 ;; inserted above).
391 (for-each (lambda (f d) (install-file f d))
392 '("socket-ffi-values.so" "sockets-stub.so")
393 (list chez-site chez-site))
394 (zero? (system "echo '(compile-file \"sockets.sls\")' | scheme -q")))))
395 (replace 'install
396 (lambda* (#:key outputs inputs #:allow-other-keys)
397 (let* ((out (assoc-ref outputs "out"))
398 (lib (string-append out "/lib/chez-sockets"))
399 (doc (string-append out "/share/doc/" ,name "-" ,version))
400 (chez-site (string-append out "/lib/csv"
401 ,(package-version chez-scheme)
402 "-site/arcfide")))
403 (for-each (lambda (f d) (install-file f d))
404 '("sockets.pdf" "sockets.so")
405 (list doc chez-site))
406 #t))))))
407 (home-page "https://github.com/arcfide/chez-sockets")
408 (synopsis "Extensible sockets library for Chez Scheme")
409 (description "Chez-sockets is an extensible sockets library for
410Chez Scheme.")
411 (license expat))))
38754190
FB
412
413;; Help function for Chez Scheme to add the current path to
414;; CHEZSCHEMELIBDIRS.
415(define chez-configure
416 '(lambda _
417 (let ((chez-env (getenv "CHEZSCHEMELIBDIRS")))
418 (setenv "CHEZSCHEMELIBDIRS"
419 (if chez-env
420 (string-append ".:" chez-env)
421 "."))
422 #t)))
423
424;; Help function to define make flags for some Chez Scheme custom make
425;; files.
426(define (chez-make-flags name version)
427 `(let ((out (assoc-ref %outputs "out")))
428 (list (string-append "PREFIX=" out)
429 (string-append "DOCDIR=" out "/share/doc/"
430 ,name "-" ,version))))
431
432(define-public chez-matchable
433 (package
434 (name "chez-matchable")
435 (version "20160306")
436 (home-page "https://github.com/fedeinthemix/chez-matchable")
437 (source
438 (origin
439 (method url-fetch)
440 (uri (string-append home-page "/archive" "/v" version ".tar.gz"))
441 (sha256
442 (base32 "0cl4vc6487pikjq159pj4n5ghyaax31nywb5n4yn1682h3ir1hs0"))
443 (file-name (string-append name "-" version ".tar.gz"))))
444 (build-system gnu-build-system)
445 (inputs
446 `(("chez-srfi" ,chez-srfi))) ; for tests
447 (native-inputs
448 `(("chez-scheme" ,chez-scheme)))
449 (arguments
450 `(#:make-flags ,(chez-make-flags name version)
451 #:test-target "test"
452 #:phases (modify-phases %standard-phases
453 (replace 'configure ,chez-configure))))
454 (synopsis "Portable hygienic pattern matcher for Scheme")
455 (description "This package provides a superset of the popular Scheme
456@code{match} package by Andrew Wright, written in fully portable
457@code{syntax-rules} and thus preserving hygiene.")
458 (license public-domain)))
87d6c9ef
FB
459
460(define-public chez-irregex
461 (package
462 (name "chez-irregex")
463 (version "0.9.4")
464 (source
465 (origin
466 (method url-fetch)
467 (uri (string-append
468 "https://github.com/fedeinthemix/chez-irregex/archive"
469 "/v" version ".tar.gz"))
470 (sha256
471 (base32 "0ywy5syaw549a58viz68dmgnv756ic705rcnlqxgjq27lnaim53b"))
472 (file-name (string-append name "-" version ".tar.gz"))))
473 (build-system gnu-build-system)
474 (inputs
475 `(("chez-matchable" ,chez-matchable))) ; for tests
476 (propagated-inputs
477 `(("chez-srfi" ,chez-srfi))) ; for irregex-utils
478 (native-inputs
479 `(("chez-scheme" ,chez-scheme)))
480 (arguments
481 `(#:make-flags ,(chez-make-flags name version)
482 #:test-target "test"
483 #:phases (modify-phases %standard-phases
484 (replace 'configure ,chez-configure))))
485 (home-page "https://github.com/fedeinthemix/chez-irregex")
486 (synopsis "Portable regular expression library for Scheme")
487 (description "This package provides a portable and efficient
488R[4567]RS implementation of regular expressions, supporting both POSIX
489syntax with various (irregular) PCRE extensions, as well as SCSH's SRE
490syntax, with various aliases for commonly used patterns.")
491 (license bsd-3)))
fb6d2d75
FB
492
493(define-public chez-fmt
494 (package
495 (name "chez-fmt")
496 (version "0.8.11")
497 (source
498 (origin
499 (method url-fetch)
500 (uri (string-append
501 "http://synthcode.com/scheme/fmt/fmt-" version ".tar.gz"))
502 (sha256
503 (base32 "1zxqlw1jyg85yzclylh8bp2b3fwcy3l3xal68jw837n5illvsjcl"))
504 (file-name (string-append name "-" version ".tar.gz"))))
505 (build-system gnu-build-system)
506 (propagated-inputs
507 `(("chez-srfi" ,chez-srfi))) ; for irregex-utils
508 (native-inputs
509 `(("chez-scheme" ,chez-scheme)))
510 (arguments
511 `(#:make-flags ,(chez-make-flags name version)
512 #:test-target "chez-check"
513 #:phases
514 (modify-phases %standard-phases
515 (replace 'configure ,chez-configure)
516 (replace 'build
517 (lambda* (#:key (make-flags '()) #:allow-other-keys)
518 (zero? (apply system* "make" "chez-build" make-flags))))
519 (replace 'install
520 (lambda* (#:key (make-flags '()) #:allow-other-keys)
521 (zero? (apply system* "make" "chez-install" make-flags)))))))
522 (home-page "http://synthcode.com/scheme/fmt")
523 (synopsis "Combinator formatting library for Chez Scheme")
524 (description "This package provides a library of procedures for
525formatting Scheme objects to text in various ways, and for easily
526concatenating, composing and extending these formatters efficiently
527without resorting to capturing and manipulating intermediate
528strings.")
529 (license bsd-3)))
53b9684e
FB
530
531(define-public chez-mit
532 (package
533 (name "chez-mit")
534 (version "0.1")
535 (home-page "https://github.com/fedeinthemix/chez-mit")
536 (source
537 (origin
538 (method url-fetch)
539 (uri (string-append home-page "/archive/v" version ".tar.gz"))
540 (sha256
541 (base32 "1p11q061znwxzxrxg3vw4dbsnpv1dav12hjhnkrjnzyyjvvdm2kn"))
542 (file-name (string-append name "-" version ".tar.gz"))))
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
555libraries for Chez Scheme. The main goal was to provide the functionality
556required to port the program 'Scmutils' to Chez Scheme.")
557 (license gpl3+)))
149c6523
FB
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 url-fetch)
567 (uri (string-append home-page "/archive/v" version ".tar.gz"))
568 (sha256
569 (base32 "1a5j61pggaiwl1gl6m038rcy5n8r2sj5nyjmz86jydx97mm5i8hj"))
570 (file-name (string-append name "-" version ".tar.gz"))))
571 (build-system gnu-build-system)
572 (inputs
573 `(("chez-srfi" ,chez-srfi))) ; for tests
574 (native-inputs
575 `(("chez-scheme" ,chez-scheme)))
576 (propagated-inputs
577 `(("chez-mit" ,chez-mit)
578 ("chez-srfi" ,chez-srfi)))
579 (arguments
580 `(#:make-flags ,(chez-make-flags name version)
581 #:tests? #f ; no test suite
582 #:phases
583 (modify-phases %standard-phases
584 (replace 'configure ,chez-configure)
585 ;; Since the documentation is lacking, we install the source
586 ;; code. For things to work correctly we have to replace
587 ;; relative paths by absolute ones in 'include' forms. This
588 ;; in turn requires us to compile the files in the final
589 ;; destination.
590 (delete 'build)
591 (add-after 'install 'install-src
592 (lambda* (#:key (make-flags '()) #:allow-other-keys)
593 (zero? (apply system* "make" "install-src" make-flags))))
594 (add-after 'install-src 'absolute-path-in-scm-files
595 (lambda* (#:key outputs #:allow-other-keys)
596 (let ((out (assoc-ref outputs "out")))
597 (for-each (lambda (file)
598 (substitute* file
599 (("include +\"\\./scmutils")
600 (string-append "include \"" (dirname file)))))
601 (find-files out "\\.sls"))
602 (for-each (lambda (file)
603 (substitute* file
604 (("include +\"\\./scmutils/simplify")
605 (string-append "include \"" (dirname file)))))
606 (find-files out "fbe-syntax\\.scm"))
607 #t)))
608 (add-after 'absolute-path-in-scm-files 'build
609 (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
610 (let* ((out (assoc-ref outputs "out"))
611 (mk-file (car (find-files out "Makefile"))))
612 (with-directory-excursion (dirname mk-file)
613 (zero? (apply system* "make" "build" make-flags))))))
614 (add-after 'build 'clean-up
615 (lambda* (#:key outputs #:allow-other-keys)
616 (let* ((out (assoc-ref outputs "out")))
617 (for-each delete-file
618 (find-files out "Makefile|compile-all\\.ss"))))))))
619 (synopsis "Port of MIT/GNU Scheme Scmutils to Chez Scheme")
620 (description "This package provides a port of the MIT/GNU Scheme
621Scmutils program to Chez Scheme. The port consists of a set of
622libraries providing most of the functionality of the original.")
623 (license gpl3+)))