Archived
1
0
Fork 0

gnu: chez-scheme: Use new style for Chez packages.

* gnu/packages/chez.scm (chez-configure, chez-make-flags): Use
G-expressions.
(chez-srfi)[arguments]: Use G-expressions, 'chez-configure', and
'chez-make-flags'.
(chez-web, chez-sockets)[native-inputs]: Remove labels.
[arguments]: Use G-expressions.
(chez-matchable, chez-irregex, chez-fmt, chez-mit)
(chez-scmutils)[arguments]: Use G-expressions.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
This commit is contained in:
Philip McGrath 2022-02-27 16:29:10 -05:00 committed by Liliana Marie Prikler
parent 9b1bfc0ce9
commit 346d8b9a49
No known key found for this signature in database
GPG key ID: 442A84B8C70E2F87

View file

@ -443,6 +443,27 @@ Chez Scheme.")
;; Packages: ;; Packages:
;; ;;
;; Help function for Chez Scheme to add the current path to
;; CHEZSCHEMELIBDIRS.
(define chez-configure
#~(lambda _
(let ((chez-env (getenv "CHEZSCHEMELIBDIRS")))
(setenv "CHEZSCHEMELIBDIRS"
(if chez-env
(string-append ".:" chez-env)
".")))))
;; Help function to define make flags for some Chez Scheme custom make
;; files.
(define (chez-make-flags name version)
#~(let ((out #$output))
(list
;; Set 'chezversion' so that libraries are installed in
;; 'lib/csvX.Y.Z-site' like Chez's 'native-search-paths' expects.
(string-append "chezversion=" #$(package-version chez-scheme))
(string-append "PREFIX=" out)
(string-append "DOCDIR=" out "/share/doc/" #$name "-" #$version))))
(define-public chez-srfi (define-public chez-srfi
(package (package
(name "chez-srfi") (name "chez-srfi")
@ -460,13 +481,11 @@ Chez Scheme.")
(native-inputs (native-inputs
(list chez-scheme)) (list chez-scheme))
(arguments (arguments
`(#:make-flags (let ((out (assoc-ref %outputs "out"))) (list #:make-flags (chez-make-flags name version)
(list (string-append "PREFIX=" out)
"CHEZ=chez-scheme --libdirs ./"
(string-append "chezversion=" ,(package-version chez-scheme))))
#:test-target "test" #:test-target "test"
#:phases (modify-phases %standard-phases #:phases #~(modify-phases %standard-phases
(delete 'configure)))) (replace 'configure
#$chez-configure))))
(home-page "https://github.com/fedeinthemix/chez-srfi") (home-page "https://github.com/fedeinthemix/chez-srfi")
(synopsis "SRFI libraries for Chez Scheme") (synopsis "SRFI libraries for Chez Scheme")
(description (description
@ -491,25 +510,32 @@ Chez Scheme.")
(base32 "1dq25qygyncbfq4kwwqqgyyakfqjwhp5q23vrf3bff1p66nyfl3b")))) (base32 "1dq25qygyncbfq4kwwqqgyyakfqjwhp5q23vrf3bff1p66nyfl3b"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(native-inputs (native-inputs
`(("chez-scheme" ,chez-scheme) (list chez-scheme
("ghostscript" ,ghostscript) ghostscript
("texlive" ,(texlive-updmap.cfg (list texlive-oberdiek ;; FIXME: This package fails to build with the error:
;; mktexpk: don't know how to create bitmap font for bchr8r
;; Replacing the following with `texlive` fixes it.
;; What is missing?
(texlive-updmap.cfg (list texlive-oberdiek
texlive-epsf texlive-epsf
texlive-metapost texlive-metapost
texlive-charter texlive-charter
texlive-pdftex texlive-pdftex
texlive-context texlive-context
texlive-cm texlive-cm
texlive-tex-plain))))) texlive-tex-plain))))
(arguments (arguments
`(#:make-flags (list (string-append "PREFIX=" %output) (list
(string-append "DOCDIR=" %output "/share/doc/" #:make-flags
,name "-" ,version) #~(list (string-append "PREFIX=" #$output)
(string-append "LIBDIR=" %output "/lib/chezweb") (string-append "DOCDIR=" #$output "/share/doc/"
(string-append "TEXDIR=" %output "/share/texmf-local")) #$name "-" #$version)
;; lib/chez-scheme/chezweb ???
(string-append "LIBDIR=" #$output "/lib/chezweb")
(string-append "TEXDIR=" #$output "/share/texmf-local"))
#:tests? #f ; no tests #:tests? #f ; no tests
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
;; This package has a custom "bootstrap" script that ;; This package has a custom "bootstrap" script that
;; is meant to be run from the Makefile. ;; is meant to be run from the Makefile.
(delete 'bootstrap) (delete 'bootstrap)
@ -518,15 +544,14 @@ Chez Scheme.")
(copy-file "config.mk.template" "config.mk") (copy-file "config.mk.template" "config.mk")
(substitute* "tangleit" (substitute* "tangleit"
(("\\./cheztangle\\.ss" all) (("\\./cheztangle\\.ss" all)
(string-append "chez-scheme --program " all))) (string-append "scheme --program " all)))
(substitute* "weaveit" (substitute* "weaveit"
(("mpost chezweb\\.mp") (("mpost chezweb\\.mp")
"mpost --tex=tex chezweb.mp") "mpost --tex=tex chezweb.mp")
(("\\./chezweave" all) (("\\./chezweave" all)
(string-append "chez-scheme --program " all))) (string-append "scheme --program " all)))
(substitute* "installit" (substitute* "installit"
(("-g \\$GROUP -o \\$OWNER") "")) (("-g \\$GROUP -o \\$OWNER") "")))))))
#t)))))
(home-page "https://github.com/arcfide/ChezWEB") (home-page "https://github.com/arcfide/ChezWEB")
(synopsis "Hygienic Literate Programming for Chez Scheme") (synopsis "Hygienic Literate Programming for Chez Scheme")
(description "ChezWEB is a system for doing Knuthian style WEB (description "ChezWEB is a system for doing Knuthian style WEB
@ -550,95 +575,78 @@ programming in Scheme.")
(base32 "1n5fbwwz51fdzvjackgmnsgh363g9inyxv7kmzi0469cwavwcx5m")))) (base32 "1n5fbwwz51fdzvjackgmnsgh363g9inyxv7kmzi0469cwavwcx5m"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(native-inputs (native-inputs
`(("chez-scheme" ,chez-scheme) (list chez-scheme
("chez-web" ,chez-web) chez-web
("texlive" ,(texlive-updmap.cfg (list texlive-pdftex))))) (texlive-updmap.cfg (list texlive-pdftex))))
(arguments (arguments
`(#:tests? #f ; no tests (list
#:tests? #f ; no tests
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(replace 'configure (replace 'configure
(lambda* (#:key outputs inputs #:allow-other-keys) (lambda* (#:key native-inputs inputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((scheme (search-input-file (or native-inputs inputs)
(chez-web (assoc-ref inputs "chez-web")) "/bin/scheme"))
(chez (assoc-ref inputs "chez-scheme")) (lib (string-append (dirname scheme) "/../lib"))
(chez-h (dirname (car (find-files chez "scheme\\.h"))))) (header-file (car (find-files lib "scheme\\.h")))
(include-dir (dirname header-file)))
(substitute* "Makefile" (substitute* "Makefile"
(("(SCHEMEH=).*$" all var) (("(SCHEMEH=).*$" _ var)
(string-append var chez-h))) (string-append var include-dir))))))
#t)))
(add-before 'build 'tangle (add-before 'build 'tangle
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(setenv "TEXINPUTS" (setenv "TEXINPUTS"
(string-append (string-append
(getcwd) ":" (getcwd) ":"
(assoc-ref inputs "chez-web") "/share/texmf-local/tex/generic:" (assoc-ref inputs "chez-web")
"/share/texmf-local/tex/generic:"
":")) ":"))
;; just using "make" tries to build the .c files before ;; just using "make" tries to build the .c files before
;; they are created. ;; they are created.
(and (invoke "make" "sockets") (and (invoke "make" "sockets")
(invoke "make")))) (invoke "make"))))
(replace 'build (replace 'build
(lambda* (#:key outputs inputs #:allow-other-keys) (lambda args
(let* ((out (assoc-ref outputs "out")) (let ((chez-site (string-append #$output
(chez-site (string-append out "/lib/csv" "/lib/csv"
,(package-version chez-scheme) (package-version chez-scheme)
"-site/arcfide"))) "-site/arcfide")))
;; make sure Chez Scheme can find the shared libraries. ;; make sure Chez Scheme can find the shared libraries.
(substitute* "sockets.ss" (substitute* "sockets.ss"
(("(load-shared-object) \"(socket-ffi-values\\.[sd][oy].*)\"" (("(object \")(socket-ffi-values\\.[sd][oy][^\"]*)(\")"
all cmd so) _ pre file post)
(string-append cmd " \"" chez-site "/" so "\"")) (string-append pre chez-site "/" file post))
(("sockets-stub\\.[sd][oy].*" all) (("(\")(sockets-stub\\.[sd][oy][^\"]*)(\")"
(string-append chez-site "/" all))) _ pre file post)
(string-append pre chez-site "/" file post)))
;; to compile chez-sockets, the .so files must be ;; to compile chez-sockets, the .so files must be
;; installed (because of the absolute path we ;; installed (because of the absolute path we
;; inserted above). ;; inserted above).
(for-each (lambda (f d) (install-file f d)) (for-each (lambda (f)
'("socket-ffi-values.so" "sockets-stub.so") (install-file f chez-site))
(list chez-site chez-site)) '("socket-ffi-values.so"
(zero? (system "echo '(compile-file \"sockets.sls\")' | scheme -q"))))) "sockets-stub.so"))
(invoke "bash"
"-c"
(format #f "echo '~s' | scheme -q"
'(compile-file "sockets.sls"))))))
(replace 'install (replace 'install
(lambda* (#:key outputs inputs #:allow-other-keys) (lambda args
(let* ((out (assoc-ref outputs "out")) (install-file "sockets.so"
(lib (string-append out "/lib/chez-sockets")) (string-append #$output
(doc (string-append out "/share/doc/" ,name "-" ,version)) "/lib/csv"
(chez-site (string-append out "/lib/csv" #$(package-version chez-scheme)
,(package-version chez-scheme) "-site/arcfide"))
"-site/arcfide"))) (install-file "sockets.pdf"
(for-each (lambda (f d) (install-file f d)) (string-append #$output
'("sockets.pdf" "sockets.so") "/share/doc/"
(list doc chez-site)) #$name "-" #$version)))))))
#t))))))
(home-page "https://github.com/arcfide/chez-sockets") (home-page "https://github.com/arcfide/chez-sockets")
(synopsis "Extensible sockets library for Chez Scheme") (synopsis "Extensible sockets library for Chez Scheme")
(description "Chez-sockets is an extensible sockets library for (description "Chez-sockets is an extensible sockets library for
Chez Scheme.") Chez Scheme.")
(license expat)))) (license expat))))
;; Help function for Chez Scheme to add the current path to
;; CHEZSCHEMELIBDIRS.
(define chez-configure
'(lambda _
(let ((chez-env (getenv "CHEZSCHEMELIBDIRS")))
(setenv "CHEZSCHEMELIBDIRS"
(if chez-env
(string-append ".:" chez-env)
"."))
#t)))
;; Help function to define make flags for some Chez Scheme custom make
;; files.
(define (chez-make-flags name version)
`(let ((out (assoc-ref %outputs "out")))
(list
;; Set 'chezversion' so that libraries are installed in
;; 'lib/csvX.Y.Z-site' like Chez's 'native-search-paths' expects.
(string-append "chezversion=" ,(package-version chez-scheme))
(string-append "PREFIX=" out)
(string-append "DOCDIR=" out "/share/doc/"
,name "-" ,version))))
(define-public chez-matchable (define-public chez-matchable
(package (package
(name "chez-matchable") (name "chez-matchable")
@ -659,10 +667,11 @@ Chez Scheme.")
(native-inputs (native-inputs
(list chez-scheme)) (list chez-scheme))
(arguments (arguments
`(#:make-flags ,(chez-make-flags name version) (list #:make-flags (chez-make-flags name version)
#:test-target "test" #:test-target "test"
#:phases (modify-phases %standard-phases #:phases #~(modify-phases %standard-phases
(replace 'configure ,chez-configure)))) (replace 'configure
#$chez-configure))))
(synopsis "Portable hygienic pattern matcher for Scheme") (synopsis "Portable hygienic pattern matcher for Scheme")
(description "This package provides a superset of the popular Scheme (description "This package provides a superset of the popular Scheme
@code{match} package by Andrew Wright, written in fully portable @code{match} package by Andrew Wright, written in fully portable
@ -690,10 +699,11 @@ Chez Scheme.")
(native-inputs (native-inputs
(list chez-scheme)) (list chez-scheme))
(arguments (arguments
`(#:make-flags ,(chez-make-flags name version) (list #:make-flags (chez-make-flags name version)
#:test-target "test" #:test-target "test"
#:phases (modify-phases %standard-phases #:phases #~(modify-phases %standard-phases
(replace 'configure ,chez-configure)))) (replace 'configure
#$chez-configure))))
(home-page "https://github.com/fedeinthemix/chez-irregex") (home-page "https://github.com/fedeinthemix/chez-irregex")
(synopsis "Portable regular expression library for Scheme") (synopsis "Portable regular expression library for Scheme")
(description "This package provides a portable and efficient (description "This package provides a portable and efficient
@ -720,11 +730,12 @@ syntax, with various aliases for commonly used patterns.")
(native-inputs (native-inputs
(list chez-scheme)) (list chez-scheme))
(arguments (arguments
`(#:make-flags ,(chez-make-flags name version) (list #:make-flags (chez-make-flags name version)
#:test-target "chez-check" #:test-target "chez-check"
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(replace 'configure ,chez-configure) (replace 'configure
#$chez-configure)
(replace 'build (replace 'build
(lambda* (#:key (make-flags '()) #:allow-other-keys) (lambda* (#:key (make-flags '()) #:allow-other-keys)
(apply invoke "make" "chez-build" make-flags))) (apply invoke "make" "chez-build" make-flags)))
@ -760,10 +771,11 @@ strings.")
(native-inputs (native-inputs
(list chez-scheme)) (list chez-scheme))
(arguments (arguments
`(#:make-flags ,(chez-make-flags name version) (list #:make-flags (chez-make-flags name version)
#:test-target "test" #:test-target "test"
#:phases (modify-phases %standard-phases #:phases #~(modify-phases %standard-phases
(replace 'configure ,chez-configure)))) (replace 'configure
#$chez-configure))))
(synopsis "MIT/GNU Scheme compatibility library for Chez Scheme") (synopsis "MIT/GNU Scheme compatibility library for Chez Scheme")
(description "This package provides a set of MIT/GNU Scheme compatibility (description "This package provides a set of MIT/GNU Scheme compatibility
libraries for Chez Scheme. The main goal was to provide the functionality libraries for Chez Scheme. The main goal was to provide the functionality
@ -792,11 +804,13 @@ required to port the program @code{Scmutils} to Chez Scheme.")
(propagated-inputs (propagated-inputs
(list chez-mit chez-srfi)) (list chez-mit chez-srfi))
(arguments (arguments
`(#:make-flags ,(chez-make-flags name version) (list
#:make-flags (chez-make-flags name version)
#:tests? #f ; no test suite #:tests? #f ; no test suite
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(replace 'configure ,chez-configure) (replace 'configure
#$chez-configure)
;; Since the documentation is lacking, we install the source ;; Since the documentation is lacking, we install the source
;; code. For things to work correctly we have to replace ;; code. For things to work correctly we have to replace
;; relative paths by absolute ones in 'include' forms. This ;; relative paths by absolute ones in 'include' forms. This
@ -807,31 +821,27 @@ required to port the program @code{Scmutils} to Chez Scheme.")
(lambda* (#:key (make-flags '()) #:allow-other-keys) (lambda* (#:key (make-flags '()) #:allow-other-keys)
(apply invoke "make" "install-src" make-flags))) (apply invoke "make" "install-src" make-flags)))
(add-after 'install-src 'absolute-path-in-scm-files (add-after 'install-src 'absolute-path-in-scm-files
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(for-each (lambda (file) (for-each (lambda (file)
(substitute* file (substitute* file
(("include +\"\\./scmutils") (("include +\"\\./scmutils")
(string-append "include \"" (dirname file))))) (string-append "include \"" (dirname file)))))
(find-files out "\\.sls")) (find-files #$output "\\.sls"))
(for-each (lambda (file) (for-each (lambda (file)
(substitute* file (substitute* file
(("include +\"\\./scmutils/simplify") (("include +\"\\./scmutils/simplify")
(string-append "include \"" (dirname file))))) (string-append "include \"" (dirname file)))))
(find-files out "fbe-syntax\\.scm")) (find-files #$output "fbe-syntax\\.scm"))))
#t)))
(add-after 'absolute-path-in-scm-files 'build (add-after 'absolute-path-in-scm-files 'build
(lambda* (#:key outputs (make-flags '()) #:allow-other-keys) (lambda* (#:key (make-flags '()) #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let ((mk-file (car (find-files #$output "Makefile"))))
(mk-file (car (find-files out "Makefile"))))
(with-directory-excursion (dirname mk-file) (with-directory-excursion (dirname mk-file)
(apply invoke "make" "build" make-flags))))) (apply invoke "make" "build" make-flags)))))
(add-after 'build 'clean-up (add-after 'build 'clean-up
(lambda* (#:key outputs #:allow-other-keys) (lambda args
(let* ((out (assoc-ref outputs "out")))
(for-each delete-file (for-each delete-file
(find-files out "Makefile|compile-all\\.ss")) (find-files #$output
#t)))))) "Makefile|compile-all\\.ss")))))))
(synopsis "Port of MIT/GNU Scheme Scmutils to Chez Scheme") (synopsis "Port of MIT/GNU Scheme Scmutils to Chez Scheme")
(description "This package provides a port of the MIT/GNU Scheme (description "This package provides a port of the MIT/GNU Scheme
Scmutils program to Chez Scheme. The port consists of a set of Scmutils program to Chez Scheme. The port consists of a set of