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