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) #:test-target "test"
"CHEZ=chez-scheme --libdirs ./" #:phases #~(modify-phases %standard-phases
(string-append "chezversion=" ,(package-version chez-scheme)))) (replace 'configure
#:test-target "test" #$chez-configure))))
#:phases (modify-phases %standard-phases
(delete '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,42 +510,48 @@ 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:
texlive-epsf ;; mktexpk: don't know how to create bitmap font for bchr8r
texlive-metapost ;; Replacing the following with `texlive` fixes it.
texlive-charter ;; What is missing?
texlive-pdftex (texlive-updmap.cfg (list texlive-oberdiek
texlive-context texlive-epsf
texlive-cm texlive-metapost
texlive-tex-plain))))) texlive-charter
texlive-pdftex
texlive-context
texlive-cm
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)
#:tests? #f ; no tests ;; lib/chez-scheme/chezweb ???
#:phases (string-append "LIBDIR=" #$output "/lib/chezweb")
(modify-phases %standard-phases (string-append "TEXDIR=" #$output "/share/texmf-local"))
;; This package has a custom "bootstrap" script that #:tests? #f ; no tests
;; is meant to be run from the Makefile. #:phases
(delete 'bootstrap) #~(modify-phases %standard-phases
(replace 'configure ;; This package has a custom "bootstrap" script that
(lambda* _ ;; is meant to be run from the Makefile.
(copy-file "config.mk.template" "config.mk") (delete 'bootstrap)
(substitute* "tangleit" (replace 'configure
(("\\./cheztangle\\.ss" all) (lambda* _
(string-append "chez-scheme --program " all))) (copy-file "config.mk.template" "config.mk")
(substitute* "weaveit" (substitute* "tangleit"
(("mpost chezweb\\.mp") (("\\./cheztangle\\.ss" all)
"mpost --tex=tex chezweb.mp") (string-append "scheme --program " all)))
(("\\./chezweave" all) (substitute* "weaveit"
(string-append "chez-scheme --program " all))) (("mpost chezweb\\.mp")
(substitute* "installit" "mpost --tex=tex chezweb.mp")
(("-g \\$GROUP -o \\$OWNER") "")) (("\\./chezweave" all)
#t))))) (string-append "scheme --program " all)))
(substitute* "installit"
(("-g \\$GROUP -o \\$OWNER") "")))))))
(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
#:phases #:tests? #f ; no tests
(modify-phases %standard-phases #:phases
(replace 'configure #~(modify-phases %standard-phases
(lambda* (#:key outputs inputs #:allow-other-keys) (replace 'configure
(let* ((out (assoc-ref outputs "out")) (lambda* (#:key native-inputs inputs #:allow-other-keys)
(chez-web (assoc-ref inputs "chez-web")) (let* ((scheme (search-input-file (or native-inputs inputs)
(chez (assoc-ref inputs "chez-scheme")) "/bin/scheme"))
(chez-h (dirname (car (find-files chez "scheme\\.h"))))) (lib (string-append (dirname scheme) "/../lib"))
(substitute* "Makefile" (header-file (car (find-files lib "scheme\\.h")))
(("(SCHEMEH=).*$" all var) (include-dir (dirname header-file)))
(string-append var chez-h))) (substitute* "Makefile"
#t))) (("(SCHEMEH=).*$" _ var)
(add-before 'build 'tangle (string-append var include-dir))))))
(lambda* (#:key inputs #:allow-other-keys) (add-before 'build 'tangle
(setenv "TEXINPUTS" (lambda* (#:key inputs #:allow-other-keys)
(string-append (setenv "TEXINPUTS"
(getcwd) ":" (string-append
(assoc-ref inputs "chez-web") "/share/texmf-local/tex/generic:" (getcwd) ":"
":")) (assoc-ref inputs "chez-web")
;; just using "make" tries to build the .c files before "/share/texmf-local/tex/generic:"
;; they are created. ":"))
(and (invoke "make" "sockets") ;; just using "make" tries to build the .c files before
(invoke "make")))) ;; they are created.
(replace 'build (and (invoke "make" "sockets")
(lambda* (#:key outputs inputs #:allow-other-keys) (invoke "make"))))
(let* ((out (assoc-ref outputs "out")) (replace 'build
(chez-site (string-append out "/lib/csv" (lambda args
,(package-version chez-scheme) (let ((chez-site (string-append #$output
"/lib/csv"
(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)
;; to compile chez-sockets, the .so files must be (string-append pre chez-site "/" file post)))
;; installed (because of the absolute path we ;; to compile chez-sockets, the .so files must be
;; inserted above). ;; installed (because of the absolute path we
(for-each (lambda (f d) (install-file f d)) ;; inserted above).
'("socket-ffi-values.so" "sockets-stub.so") (for-each (lambda (f)
(list chez-site chez-site)) (install-file f chez-site))
(zero? (system "echo '(compile-file \"sockets.sls\")' | scheme -q"))))) '("socket-ffi-values.so"
(replace 'install "sockets-stub.so"))
(lambda* (#:key outputs inputs #:allow-other-keys) (invoke "bash"
(let* ((out (assoc-ref outputs "out")) "-c"
(lib (string-append out "/lib/chez-sockets")) (format #f "echo '~s' | scheme -q"
(doc (string-append out "/share/doc/" ,name "-" ,version)) '(compile-file "sockets.sls"))))))
(chez-site (string-append out "/lib/csv" (replace 'install
,(package-version chez-scheme) (lambda args
"-site/arcfide"))) (install-file "sockets.so"
(for-each (lambda (f d) (install-file f d)) (string-append #$output
'("sockets.pdf" "sockets.so") "/lib/csv"
(list doc chez-site)) #$(package-version chez-scheme)
#t)))))) "-site/arcfide"))
(install-file "sockets.pdf"
(string-append #$output
"/share/doc/"
#$name "-" #$version)))))))
(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,17 +730,18 @@ 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
(replace 'build #$chez-configure)
(lambda* (#:key (make-flags '()) #:allow-other-keys) (replace 'build
(apply invoke "make" "chez-build" make-flags))) (lambda* (#:key (make-flags '()) #:allow-other-keys)
(replace 'install (apply invoke "make" "chez-build" make-flags)))
(lambda* (#:key (make-flags '()) #:allow-other-keys) (replace 'install
(apply invoke "make" "chez-install" make-flags)))))) (lambda* (#:key (make-flags '()) #:allow-other-keys)
(apply invoke "make" "chez-install" make-flags))))))
(home-page "http://synthcode.com/scheme/fmt") (home-page "http://synthcode.com/scheme/fmt")
(synopsis "Combinator formatting library for Chez Scheme") (synopsis "Combinator formatting library for Chez Scheme")
(description "This package provides a library of procedures for (description "This package provides a library of procedures for
@ -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,46 +804,44 @@ 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
#:tests? #f ; no test suite #:make-flags (chez-make-flags name version)
#:phases #:tests? #f ; no test suite
(modify-phases %standard-phases #:phases
(replace 'configure ,chez-configure) #~(modify-phases %standard-phases
;; Since the documentation is lacking, we install the source (replace 'configure
;; code. For things to work correctly we have to replace #$chez-configure)
;; relative paths by absolute ones in 'include' forms. This ;; Since the documentation is lacking, we install the source
;; in turn requires us to compile the files in the final ;; code. For things to work correctly we have to replace
;; destination. ;; relative paths by absolute ones in 'include' forms. This
(delete 'build) ;; in turn requires us to compile the files in the final
(add-after 'install 'install-src ;; destination.
(lambda* (#:key (make-flags '()) #:allow-other-keys) (delete 'build)
(apply invoke "make" "install-src" make-flags))) (add-after 'install 'install-src
(add-after 'install-src 'absolute-path-in-scm-files (lambda* (#:key (make-flags '()) #:allow-other-keys)
(lambda* (#:key outputs #:allow-other-keys) (apply invoke "make" "install-src" make-flags)))
(let ((out (assoc-ref outputs "out"))) (add-after 'install-src 'absolute-path-in-scm-files
(for-each (lambda (file) (lambda* (#:key #:allow-other-keys)
(substitute* file (for-each (lambda (file)
(("include +\"\\./scmutils") (substitute* file
(string-append "include \"" (dirname file))))) (("include +\"\\./scmutils")
(find-files out "\\.sls")) (string-append "include \"" (dirname file)))))
(for-each (lambda (file) (find-files #$output "\\.sls"))
(substitute* file (for-each (lambda (file)
(("include +\"\\./scmutils/simplify") (substitute* file
(string-append "include \"" (dirname file))))) (("include +\"\\./scmutils/simplify")
(find-files out "fbe-syntax\\.scm")) (string-append "include \"" (dirname file)))))
#t))) (find-files #$output "fbe-syntax\\.scm"))))
(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 args
(lambda* (#:key outputs #:allow-other-keys) (for-each delete-file
(let* ((out (assoc-ref outputs "out"))) (find-files #$output
(for-each delete-file "Makefile|compile-all\\.ss")))))))
(find-files out "Makefile|compile-all\\.ss"))
#t))))))
(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