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