gnu: Remove ".git" from "https://github/…/….git".
[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")))
243 (list (string-append "PREFIX=" out)))
244 #:test-target "test"
245 #:phases (modify-phases %standard-phases
246 (delete 'configure))))
247 (home-page "https://github.com/fedeinthemix/chez-srfi")
248 (synopsis "SRFI libraries for Chez Scheme")
249 (description
250 "This package provides a collection of SRFI libraries for Chez Scheme.")
251 (license expat)))
4dfe4eee
FB
252
253(define-public chez-web
254 (let ((commit "5fd177fe53f31f466bf88720d03c95a3711a8bea")
255 (revision "1"))
256 (package
257 (name "chez-web")
f01b17b3
TGR
258 ;; Release 2.0 is different and doesn't work.
259 (version (git-version "2.0" revision commit))
4dfe4eee
FB
260 (source
261 (origin
262 (method git-fetch)
263 (uri (git-reference
b0e7b699 264 (url "https://github.com/arcfide/ChezWEB")
4dfe4eee 265 (commit commit)))
f01b17b3 266 (file-name (git-file-name name version))
4dfe4eee
FB
267 (sha256
268 (base32 "1dq25qygyncbfq4kwwqqgyyakfqjwhp5q23vrf3bff1p66nyfl3b"))))
269 (build-system gnu-build-system)
270 (native-inputs
271 `(("chez-scheme" ,chez-scheme)
bc9319f4
PN
272 ("ghostscript" ,ghostscript)
273 ("texlive" ,(texlive-union (list texlive-latex-oberdiek
274 texlive-generic-epsf
275 texlive-metapost
276 texlive-fonts-charter
277 texlive-generic-pdftex
278 texlive-context-base
279 texlive-fonts-cm
280 texlive-tex-plain)))))
4dfe4eee
FB
281 (arguments
282 `(#:make-flags (list (string-append "PREFIX=" %output)
283 (string-append "DOCDIR=" %output "/share/doc/"
284 ,name "-" ,version)
285 (string-append "LIBDIR=" %output "/lib/chezweb")
286 (string-append "TEXDIR=" %output "/share/texmf-local"))
287 #:tests? #f ; no tests
288 #:phases
289 (modify-phases %standard-phases
bc9319f4
PN
290 (add-before 'build 'set-HOME
291 (lambda _
292 ;; FIXME: texlive-union does not find the built
293 ;; metafonts, so it tries to generate them in HOME.
294 (setenv "HOME" "/tmp")
295 #t))
13d37d84
PN
296 ;; This package has a custom "bootstrap" script that
297 ;; is meant to be run from the Makefile.
298 (delete 'bootstrap)
4dfe4eee
FB
299 (replace 'configure
300 (lambda* _
301 (copy-file "config.mk.template" "config.mk")
302 (substitute* "tangleit"
303 (("\\./cheztangle\\.ss" all)
304 (string-append "chez-scheme --program " all)))
305 (substitute* "weaveit"
306 (("mpost chezweb\\.mp")
307 "mpost --tex=tex chezweb.mp")
308 (("\\./chezweave" all)
309 (string-append "chez-scheme --program " all)))
310 (substitute* "installit"
a0bdbf8b
TGR
311 (("-g \\$GROUP -o \\$OWNER") ""))
312 #t)))))
4dfe4eee
FB
313 (home-page "https://github.com/arcfide/ChezWEB")
314 (synopsis "Hygienic Literate Programming for Chez Scheme")
315 (description "ChezWEB is a system for doing Knuthian style WEB
316programming in Scheme.")
317 (license expat))))
74f9c190
FB
318
319(define-public chez-sockets
320 (let ((commit "bce96881c06bd69a6757a6bff139744153924140")
321 (revision "1"))
322 (package
323 (name "chez-sockets")
dcc26267 324 (version (git-version "0.0.0" revision commit))
74f9c190
FB
325 (source
326 (origin
327 (method git-fetch)
328 (uri (git-reference
b0e7b699 329 (url "https://github.com/arcfide/chez-sockets")
74f9c190 330 (commit commit)))
dcc26267 331 (file-name (git-file-name name version))
74f9c190
FB
332 (sha256
333 (base32 "1n5fbwwz51fdzvjackgmnsgh363g9inyxv7kmzi0469cwavwcx5m"))))
334 (build-system gnu-build-system)
335 (native-inputs
336 `(("chez-scheme" ,chez-scheme)
337 ("chez-web" ,chez-web)
1e0f2ae0 338 ("texlive" ,(texlive-union (list texlive-generic-pdftex)))))
74f9c190
FB
339 (arguments
340 `(#:tests? #f ; no tests
341 #:phases
342 (modify-phases %standard-phases
343 (replace 'configure
344 (lambda* (#:key outputs inputs #:allow-other-keys)
345 (let* ((out (assoc-ref outputs "out"))
346 (chez-web (assoc-ref inputs "chez-web"))
347 (chez (assoc-ref inputs "chez-scheme"))
348 (chez-h (dirname (car (find-files chez "scheme\\.h")))))
349 (substitute* "Makefile"
350 (("(SCHEMEH=).*$" all var)
351 (string-append var chez-h)))
352 #t)))
353 (add-before 'build 'tangle
1e0f2ae0
PN
354 (lambda* (#:key inputs #:allow-other-keys)
355 (setenv "TEXINPUTS"
356 (string-append
357 (getcwd) ":"
358 (assoc-ref inputs "chez-web") "/share/texmf-local/tex/generic:"
359 ":"))
74f9c190
FB
360 ;; just using "make" tries to build the .c files before
361 ;; they are created.
1e0f2ae0
PN
362 (and (invoke "make" "sockets")
363 (invoke "make"))))
74f9c190
FB
364 (replace 'build
365 (lambda* (#:key outputs inputs #:allow-other-keys)
366 (let* ((out (assoc-ref outputs "out"))
367 (chez-site (string-append out "/lib/csv"
368 ,(package-version chez-scheme)
369 "-site/arcfide")))
370 ;; make sure Chez Scheme can find the shared libraries.
371 (substitute* "sockets.ss"
372 (("(load-shared-object) \"(socket-ffi-values\\.[sd][oy].*)\""
373 all cmd so)
374 (string-append cmd " \"" chez-site "/" so "\""))
375 (("sockets-stub\\.[sd][oy].*" all)
376 (string-append chez-site "/" all)))
377 ;; to compile chez-sockets, the .so files must be
378 ;; installed (because of the absolute path we
379 ;; inserted above).
380 (for-each (lambda (f d) (install-file f d))
381 '("socket-ffi-values.so" "sockets-stub.so")
382 (list chez-site chez-site))
383 (zero? (system "echo '(compile-file \"sockets.sls\")' | scheme -q")))))
384 (replace 'install
385 (lambda* (#:key outputs inputs #:allow-other-keys)
386 (let* ((out (assoc-ref outputs "out"))
387 (lib (string-append out "/lib/chez-sockets"))
388 (doc (string-append out "/share/doc/" ,name "-" ,version))
389 (chez-site (string-append out "/lib/csv"
390 ,(package-version chez-scheme)
391 "-site/arcfide")))
392 (for-each (lambda (f d) (install-file f d))
393 '("sockets.pdf" "sockets.so")
394 (list doc chez-site))
395 #t))))))
396 (home-page "https://github.com/arcfide/chez-sockets")
397 (synopsis "Extensible sockets library for Chez Scheme")
398 (description "Chez-sockets is an extensible sockets library for
399Chez Scheme.")
400 (license expat))))
38754190
FB
401
402;; Help function for Chez Scheme to add the current path to
403;; CHEZSCHEMELIBDIRS.
404(define chez-configure
405 '(lambda _
406 (let ((chez-env (getenv "CHEZSCHEMELIBDIRS")))
407 (setenv "CHEZSCHEMELIBDIRS"
408 (if chez-env
409 (string-append ".:" chez-env)
410 "."))
411 #t)))
412
413;; Help function to define make flags for some Chez Scheme custom make
414;; files.
415(define (chez-make-flags name version)
416 `(let ((out (assoc-ref %outputs "out")))
417 (list (string-append "PREFIX=" out)
418 (string-append "DOCDIR=" out "/share/doc/"
419 ,name "-" ,version))))
420
421(define-public chez-matchable
422 (package
423 (name "chez-matchable")
424 (version "20160306")
425 (home-page "https://github.com/fedeinthemix/chez-matchable")
426 (source
427 (origin
88c85a94
TGR
428 (method git-fetch)
429 (uri (git-reference
430 (url home-page)
431 (commit (string-append "v" version))))
38754190 432 (sha256
88c85a94
TGR
433 (base32 "02qn7x348p23z1x5lwhkyj7i8z6mgwpzpnwr8dyina0yzsdkr71s"))
434 (file-name (git-file-name name version))))
38754190
FB
435 (build-system gnu-build-system)
436 (inputs
437 `(("chez-srfi" ,chez-srfi))) ; for tests
438 (native-inputs
439 `(("chez-scheme" ,chez-scheme)))
440 (arguments
441 `(#:make-flags ,(chez-make-flags name version)
442 #:test-target "test"
443 #:phases (modify-phases %standard-phases
444 (replace 'configure ,chez-configure))))
445 (synopsis "Portable hygienic pattern matcher for Scheme")
446 (description "This package provides a superset of the popular Scheme
447@code{match} package by Andrew Wright, written in fully portable
448@code{syntax-rules} and thus preserving hygiene.")
449 (license public-domain)))
87d6c9ef
FB
450
451(define-public chez-irregex
452 (package
453 (name "chez-irregex")
454 (version "0.9.4")
455 (source
456 (origin
24a43551
TGR
457 (method git-fetch)
458 (uri (git-reference
b0e7b699 459 (url "https://github.com/fedeinthemix/chez-irregex")
24a43551 460 (commit (string-append "v" version))))
87d6c9ef 461 (sha256
24a43551
TGR
462 (base32 "0jh6piylw545j81llay9wfivgpv6lcnwd81gm4w17lkasslir50q"))
463 (file-name (git-file-name name version))))
87d6c9ef
FB
464 (build-system gnu-build-system)
465 (inputs
466 `(("chez-matchable" ,chez-matchable))) ; for tests
467 (propagated-inputs
468 `(("chez-srfi" ,chez-srfi))) ; for irregex-utils
469 (native-inputs
470 `(("chez-scheme" ,chez-scheme)))
471 (arguments
472 `(#:make-flags ,(chez-make-flags name version)
473 #:test-target "test"
474 #:phases (modify-phases %standard-phases
475 (replace 'configure ,chez-configure))))
476 (home-page "https://github.com/fedeinthemix/chez-irregex")
477 (synopsis "Portable regular expression library for Scheme")
478 (description "This package provides a portable and efficient
479R[4567]RS implementation of regular expressions, supporting both POSIX
480syntax with various (irregular) PCRE extensions, as well as SCSH's SRE
481syntax, with various aliases for commonly used patterns.")
482 (license bsd-3)))
fb6d2d75
FB
483
484(define-public chez-fmt
485 (package
486 (name "chez-fmt")
487 (version "0.8.11")
488 (source
489 (origin
490 (method url-fetch)
491 (uri (string-append
492 "http://synthcode.com/scheme/fmt/fmt-" version ".tar.gz"))
493 (sha256
494 (base32 "1zxqlw1jyg85yzclylh8bp2b3fwcy3l3xal68jw837n5illvsjcl"))
495 (file-name (string-append name "-" version ".tar.gz"))))
496 (build-system gnu-build-system)
497 (propagated-inputs
498 `(("chez-srfi" ,chez-srfi))) ; for irregex-utils
499 (native-inputs
500 `(("chez-scheme" ,chez-scheme)))
501 (arguments
502 `(#:make-flags ,(chez-make-flags name version)
503 #:test-target "chez-check"
504 #:phases
505 (modify-phases %standard-phases
506 (replace 'configure ,chez-configure)
507 (replace 'build
508 (lambda* (#:key (make-flags '()) #:allow-other-keys)
bd86f7db 509 (apply invoke "make" "chez-build" make-flags)))
fb6d2d75
FB
510 (replace 'install
511 (lambda* (#:key (make-flags '()) #:allow-other-keys)
bd86f7db 512 (apply invoke "make" "chez-install" make-flags))))))
fb6d2d75
FB
513 (home-page "http://synthcode.com/scheme/fmt")
514 (synopsis "Combinator formatting library for Chez Scheme")
515 (description "This package provides a library of procedures for
516formatting Scheme objects to text in various ways, and for easily
517concatenating, composing and extending these formatters efficiently
518without resorting to capturing and manipulating intermediate
519strings.")
520 (license bsd-3)))
53b9684e
FB
521
522(define-public chez-mit
523 (package
524 (name "chez-mit")
525 (version "0.1")
526 (home-page "https://github.com/fedeinthemix/chez-mit")
527 (source
528 (origin
c83bf1c6
TGR
529 (method git-fetch)
530 (uri (git-reference
531 (url home-page)
532 (commit (string-append "v" version))))
53b9684e 533 (sha256
c83bf1c6
TGR
534 (base32 "0c7i3b6i90xk96nmxn1pc9272a4yal4v40dm1a4ybdi87x53zkk0"))
535 (file-name (git-file-name name version))))
53b9684e
FB
536 (build-system gnu-build-system)
537 (inputs
c83bf1c6 538 `(("chez-srfi" ,chez-srfi))) ; for tests
53b9684e
FB
539 (native-inputs
540 `(("chez-scheme" ,chez-scheme)))
541 (arguments
542 `(#:make-flags ,(chez-make-flags name version)
543 #:test-target "test"
544 #:phases (modify-phases %standard-phases
545 (replace 'configure ,chez-configure))))
546 (synopsis "MIT/GNU Scheme compatibility library for Chez Scheme")
547 (description "This package provides a set of MIT/GNU Scheme compatibility
548libraries for Chez Scheme. The main goal was to provide the functionality
36a4366d 549required to port the program @code{Scmutils} to Chez Scheme.")
53b9684e 550 (license gpl3+)))
149c6523
FB
551
552(define-public chez-scmutils
553 (package
554 (name "chez-scmutils")
555 (version "0.1")
556 (home-page "https://github.com/fedeinthemix/chez-scmutils")
557 (source
558 (origin
9b469e2e
TGR
559 (method git-fetch)
560 (uri (git-reference
561 (url home-page)
562 (commit (string-append "v" version))))
149c6523 563 (sha256
9b469e2e
TGR
564 (base32 "0lb05wlf8qpgg8y0gdsyaxg1nbfx1qbaqdjvygrp64ndn8fnhq7l"))
565 (file-name (git-file-name name version))))
149c6523
FB
566 (build-system gnu-build-system)
567 (inputs
9b469e2e 568 `(("chez-srfi" ,chez-srfi))) ; for tests
149c6523
FB
569 (native-inputs
570 `(("chez-scheme" ,chez-scheme)))
571 (propagated-inputs
572 `(("chez-mit" ,chez-mit)
573 ("chez-srfi" ,chez-srfi)))
574 (arguments
575 `(#:make-flags ,(chez-make-flags name version)
9b469e2e 576 #:tests? #f ; no test suite
149c6523
FB
577 #:phases
578 (modify-phases %standard-phases
579 (replace 'configure ,chez-configure)
580 ;; Since the documentation is lacking, we install the source
581 ;; code. For things to work correctly we have to replace
582 ;; relative paths by absolute ones in 'include' forms. This
583 ;; in turn requires us to compile the files in the final
584 ;; destination.
585 (delete 'build)
586 (add-after 'install 'install-src
587 (lambda* (#:key (make-flags '()) #:allow-other-keys)
2245f210 588 (apply invoke "make" "install-src" make-flags)))
149c6523
FB
589 (add-after 'install-src 'absolute-path-in-scm-files
590 (lambda* (#:key outputs #:allow-other-keys)
591 (let ((out (assoc-ref outputs "out")))
592 (for-each (lambda (file)
593 (substitute* file
594 (("include +\"\\./scmutils")
595 (string-append "include \"" (dirname file)))))
596 (find-files out "\\.sls"))
597 (for-each (lambda (file)
598 (substitute* file
599 (("include +\"\\./scmutils/simplify")
600 (string-append "include \"" (dirname file)))))
601 (find-files out "fbe-syntax\\.scm"))
602 #t)))
603 (add-after 'absolute-path-in-scm-files 'build
604 (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
605 (let* ((out (assoc-ref outputs "out"))
606 (mk-file (car (find-files out "Makefile"))))
607 (with-directory-excursion (dirname mk-file)
2245f210 608 (apply invoke "make" "build" make-flags)))))
149c6523
FB
609 (add-after 'build 'clean-up
610 (lambda* (#:key outputs #:allow-other-keys)
611 (let* ((out (assoc-ref outputs "out")))
612 (for-each delete-file
2245f210
TGR
613 (find-files out "Makefile|compile-all\\.ss"))
614 #t))))))
149c6523
FB
615 (synopsis "Port of MIT/GNU Scheme Scmutils to Chez Scheme")
616 (description "This package provides a port of the MIT/GNU Scheme
617Scmutils program to Chez Scheme. The port consists of a set of
618libraries providing most of the functionality of the original.")
619 (license gpl3+)))