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