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