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>
This commit is contained in:
parent
d35920daf0
commit
7ea79beda3
1 changed files with 42 additions and 21 deletions
|
@ -258,8 +258,18 @@ If native threads are supported, the returned list will include
|
||||||
(ice-9 ftw)
|
(ice-9 ftw)
|
||||||
(ice-9 match))
|
(ice-9 match))
|
||||||
#:test-target "test"
|
#:test-target "test"
|
||||||
;; TODO when we fix armhf, it may not support --threads
|
#:configure-flags
|
||||||
#:configure-flags #~'("--threads")
|
#~`(,(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
|
#:phases
|
||||||
#~(modify-phases %standard-phases
|
#~(modify-phases %standard-phases
|
||||||
(add-after 'unpack 'unpack-nanopass+stex
|
(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)
|
(search-input-directory (or native-inputs inputs)
|
||||||
"lib/chez-scheme-bootfiles")
|
"lib/chez-scheme-bootfiles")
|
||||||
"boot")))
|
"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
|
;; 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
|
(replace 'configure
|
||||||
(lambda* (#:key inputs (configure-flags '()) #:allow-other-keys)
|
(lambda* (#:key inputs (configure-flags '()) out-of-source?
|
||||||
;; add flags which are always required:
|
#:allow-other-keys)
|
||||||
(let ((flags (cons* (string-append "--installprefix=" #$output)
|
(let* ((abs-srcdir (getcwd))
|
||||||
"ZLIB=-lz"
|
(srcdir (if out-of-source?
|
||||||
"LZ4=-llz4"
|
(string-append "../" (basename abs-srcdir))
|
||||||
"--libkernel"
|
".")))
|
||||||
;; Guix will do compress-man-pages,
|
(format #t "source directory: ~s (relative from build: ~s)~%"
|
||||||
;; and letting Chez try causes an error
|
abs-srcdir srcdir)
|
||||||
"--nogzip-man-pages"
|
(if out-of-source?
|
||||||
configure-flags)))
|
(begin
|
||||||
(format #t "configure flags: ~s~%" flags)
|
(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
|
;; Some makefiles (for tests) don't seem to propagate CC
|
||||||
;; properly, so we take it out of their hands:
|
;; properly, so we take it out of their hands:
|
||||||
(setenv "CC" #$(cc-for-target))
|
(setenv "CC" #$(cc-for-target))
|
||||||
(setenv "HOME" "/tmp")
|
;; Likewise, some tests have needed HOME to be set:
|
||||||
(apply invoke "./configure" flags))))
|
(setenv "HOME" "/tmp")))
|
||||||
;; The binary file name is called "scheme" as is the one from
|
;; 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
|
;; MIT/GNU Scheme. We add a symlink to use in case both are
|
||||||
;; installed.
|
;; installed.
|
||||||
|
@ -385,7 +404,9 @@ and 32-bit PowerPC architectures.")
|
||||||
(arguments
|
(arguments
|
||||||
(substitute-keyword-arguments (package-arguments chez-scheme)
|
(substitute-keyword-arguments (package-arguments chez-scheme)
|
||||||
((#:configure-flags cfg-flags #~'())
|
((#:configure-flags cfg-flags #~'())
|
||||||
#~(cons "--disable-x11" #$cfg-flags))
|
#~(cons* "--disable-x11"
|
||||||
|
"--threads" ;; ok to potentially duplicate
|
||||||
|
#$cfg-flags))
|
||||||
((#:phases those-phases #~%standard-phases)
|
((#:phases those-phases #~%standard-phases)
|
||||||
#~(let* ((those-phases #$those-phases)
|
#~(let* ((those-phases #$those-phases)
|
||||||
(unpack (assoc-ref those-phases 'unpack)))
|
(unpack (assoc-ref those-phases 'unpack)))
|
||||||
|
|
Reference in a new issue