summaryrefslogtreecommitdiff
path: root/gnu/packages/chez.scm
diff options
context:
space:
mode:
authorPhilip McGrath <philip@philipmcgrath.com>2022-05-09 02:02:46 -0400
committerLudovic Courtès <ludo@gnu.org>2022-05-12 10:30:08 +0200
commit7ea79beda3aea0beba993285103f50b6d94cb14e (patch)
tree005238c18d61d36047373590504b619f2252e370 /gnu/packages/chez.scm
parentd35920daf0c2efe3b3da055a1468cb2f8d3616d4 (diff)
gnu: chez-scheme: Refactor configure phase and fix '--threads'.
Move Chez-specific logic into '#:configure-flags' and a new 'configure-environment-variables' phase, leaving the 'configure' phase as just a variant of the one from 'gnu-build-system' (including support for '#:out-of-source?') that doesn't add implicit Autoconf-style flags. In the process, do the right thing for "--threads", rather than assuming the only nonthreaded platform is broken. * gnu/packages/chez.scm (chez-scheme)[arguments]: Set configure flags in '#:configure-flags' and separate 'configure-environment-variables' from the residual 'configure' phase. More closely follow 'gnu-build-system'. Use 'chez-upstream-features-for-system' for "--threads". (chez-scheme-for-racket)[arguments]<#:configure-flags>: Add "--threads" unconditionally. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/packages/chez.scm')
-rw-r--r--gnu/packages/chez.scm63
1 files changed, 42 insertions, 21 deletions
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 49051abd17..785b6837c1 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -258,8 +258,18 @@ If native threads are supported, the returned list will include
(ice-9 ftw)
(ice-9 match))
#:test-target "test"
- ;; TODO when we fix armhf, it may not support --threads
- #:configure-flags #~'("--threads")
+ #:configure-flags
+ #~`(,(string-append "--installprefix=" #$output)
+ #$@(if (and=> (chez-upstream-features-for-system)
+ (cut memq 'threads <>))
+ #~("--threads")
+ #~())
+ "ZLIB=-lz"
+ "LZ4=-llz4"
+ "--libkernel"
+ ;; Guix will do 'compress-man-pages',
+ ;; and letting Chez try causes an error
+ "--nogzip-man-pages")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'unpack-nanopass+stex
@@ -273,26 +283,35 @@ If native threads are supported, the returned list will include
(search-input-directory (or native-inputs inputs)
"lib/chez-scheme-bootfiles")
"boot")))
- ;; NOTE: the custom Chez 'configure' script doesn't allow
+ ;; NOTE: The custom Chez 'configure' script doesn't allow
;; unrecognized flags, such as those automatically added
- ;; by `gnu-build-system`.
+ ;; by `gnu-build-system`. This replacement phase uses only
+ ;; the explicitly provided `#:configure-flags`.
(replace 'configure
- (lambda* (#:key inputs (configure-flags '()) #:allow-other-keys)
- ;; add flags which are always required:
- (let ((flags (cons* (string-append "--installprefix=" #$output)
- "ZLIB=-lz"
- "LZ4=-llz4"
- "--libkernel"
- ;; Guix will do compress-man-pages,
- ;; and letting Chez try causes an error
- "--nogzip-man-pages"
- configure-flags)))
- (format #t "configure flags: ~s~%" flags)
- ;; Some makefiles (for tests) don't seem to propagate CC
- ;; properly, so we take it out of their hands:
- (setenv "CC" #$(cc-for-target))
- (setenv "HOME" "/tmp")
- (apply invoke "./configure" flags))))
+ (lambda* (#:key inputs (configure-flags '()) out-of-source?
+ #:allow-other-keys)
+ (let* ((abs-srcdir (getcwd))
+ (srcdir (if out-of-source?
+ (string-append "../" (basename abs-srcdir))
+ ".")))
+ (format #t "source directory: ~s (relative from build: ~s)~%"
+ abs-srcdir srcdir)
+ (if out-of-source?
+ (begin
+ (mkdir "../build")
+ (chdir "../build")))
+ (format #t "build directory: ~s~%" (getcwd))
+ (format #t "configure flags: ~s~%" configure-flags)
+ (apply invoke
+ (string-append srcdir "/configure")
+ configure-flags))))
+ (add-after 'configure 'configure-environment-variables
+ (lambda args
+ ;; Some makefiles (for tests) don't seem to propagate CC
+ ;; properly, so we take it out of their hands:
+ (setenv "CC" #$(cc-for-target))
+ ;; Likewise, some tests have needed HOME to be set:
+ (setenv "HOME" "/tmp")))
;; The binary file name is called "scheme" as is the one from
;; MIT/GNU Scheme. We add a symlink to use in case both are
;; installed.
@@ -385,7 +404,9 @@ and 32-bit PowerPC architectures.")
(arguments
(substitute-keyword-arguments (package-arguments chez-scheme)
((#:configure-flags cfg-flags #~'())
- #~(cons "--disable-x11" #$cfg-flags))
+ #~(cons* "--disable-x11"
+ "--threads" ;; ok to potentially duplicate
+ #$cfg-flags))
((#:phases those-phases #~%standard-phases)
#~(let* ((those-phases #$those-phases)
(unpack (assoc-ref those-phases 'unpack)))