gnu: static-binaries: Use gexps.

This fixes "guix build static-binaries-tarball".

* gnu/packages/make-bootstrap.scm (%static-inputs): Use gexps.
This commit is contained in:
Ludovic Courtès 2023-02-28 17:09:00 +01:00
parent 476741c5bb
commit 4eda203420
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -159,57 +159,55 @@ (define (native-inputs)
(define %static-inputs (define %static-inputs
;; Packages that are to be used as %BOOTSTRAP-INPUTS. ;; Packages that are to be used as %BOOTSTRAP-INPUTS.
(let ((coreutils (package (inherit coreutils) (let ((coreutils (package
(arguments (inherit coreutils)
`(#:configure-flags (arguments
'("--disable-nls" (substitute-keyword-arguments
"--disable-silent-rules" (package-arguments coreutils)
"--enable-no-install-program=stdbuf,libstdbuf.so" ((#:configure-flags _ #~'())
"CFLAGS=-Os -g0" ; smaller, please #~'("--disable-nls"
"LDFLAGS=-static -pthread" "--disable-silent-rules"
"--enable-no-install-program=stdbuf,libstdbuf.so"
"CFLAGS=-Os -g0" ; smaller, please
"LDFLAGS=-static -pthread"
;; Work around a cross-compilation bug whereby libcoreutils.a ;; Work around a cross-compilation bug whereby libcoreutils.a
;; would provide '__mktime_internal', which conflicts with the ;; would provide '__mktime_internal', which conflicts with the
;; one in libc.a. ;; one in libc.a.
,@(if (%current-target-system) #$@(if (%current-target-system)
`("gl_cv_func_working_mktime=yes") #~("gl_cv_func_working_mktime=yes")
'())) #~())))
((#:tests? _ #t)
#f))) ;signal-related Gnulib tests fail
#:tests? #f ; signal-related Gnulib tests fail ;; Remove optional dependencies such as GMP.
,@(package-arguments coreutils))) (inputs '())
;; Remove optional dependencies such as GMP. Keep Perl
;; except if it's missing (which is the case when
;; cross-compiling).
(inputs (match (assoc "perl" (package-inputs coreutils))
(#f '())
(x (list x))))
;; Remove the 'debug' output (see above for the reason.) ;; Remove the 'debug' output (see above for the reason.)
(outputs '("out")))) (outputs '("out"))))
(bzip2 (package (inherit bzip2) (bzip2 (package
(inherit bzip2)
(arguments (arguments
(substitute-keyword-arguments (package-arguments bzip2) (substitute-keyword-arguments (package-arguments bzip2)
((#:phases phases) ((#:phases phases)
`(modify-phases ,phases #~(modify-phases #$phases
(add-before 'build 'dash-static (add-before 'build 'dash-static
(lambda _ (lambda _
(substitute* "Makefile" (substitute* "Makefile"
(("^LDFLAGS[[:blank:]]*=.*$") (("^LDFLAGS[[:blank:]]*=.*$")
"LDFLAGS = -static")) "LDFLAGS = -static"))))))))))
#t)))))))) (xz (package
(xz (package (inherit xz) (inherit xz)
(outputs '("out")) (outputs '("out"))
(arguments (arguments
`(#:strip-flags '("--strip-all") (list #:strip-flags #~'("--strip-all")
#:phases (modify-phases %standard-phases #:phases #~(modify-phases %standard-phases
(add-before 'configure 'static-executable (add-before 'configure 'static-executable
(lambda _ (lambda _
;; Ask Libtool for a static executable. ;; Ask Libtool for a static executable.
(substitute* "src/xz/Makefile.in" (substitute* "src/xz/Makefile.in"
(("^xz_LDADD =") (("^xz_LDADD =")
"xz_LDADD = -all-static")) "xz_LDADD = -all-static")))))))))
#t)))))))
(gawk (package (gawk (package
(inherit gawk) (inherit gawk)
(source (origin (source (origin
@ -225,45 +223,44 @@ (define %static-inputs
(origin-patches (origin-patches
(package-source gawk)))))) (package-source gawk))))))
(arguments (arguments
`(;; Starting from gawk 4.1.0, some of the tests for the (substitute-keyword-arguments (package-arguments gawk)
;; plug-in mechanism just fail on static builds: ((#:configure-flags _ #~'())
;; ;; Starting from gawk 4.1.0, some of the tests for the
;; ./fts.awk:1: error: can't open shared library `filefuncs' for reading (No such file or directory) ;; plug-in mechanism just fail on static builds:
;; ;;
;; Therefore disable extensions support. ;; ./fts.awk:1: error: can't open shared library `filefuncs' for reading (No such file or directory)
#:configure-flags (list "--disable-extensions") ;;
;; Therefore disable extensions support.
,@(substitute-keyword-arguments (package-arguments gawk) #~(list "--disable-extensions"))
((#:phases phases) ((#:phases phases)
`(modify-phases ,phases #~(modify-phases #$phases
(add-before 'configure 'no-export-dynamic (add-before 'configure 'no-export-dynamic
(lambda _ (lambda _
;; Since we use `-static', remove ;; Since we use `-static', remove
;; `-export-dynamic'. ;; `-export-dynamic'.
(substitute* "configure" (substitute* "configure"
(("-Wl,-export-dynamic") "")) (("-Wl,-export-dynamic") ""))))))))
#t)))))))
(inputs (if (%current-target-system) (inputs (if (%current-target-system)
`(("bash" ,static-bash)) (list static-bash)
'())))) '()))))
(tar (package (inherit tar) (tar (package
(inherit tar)
(arguments (arguments
`(;; Work around a cross-compilation bug whereby libgnu.a would provide `(;; Work around a cross-compilation bug whereby libgnu.a would provide
;; '__mktime_internal', which conflicts with the one in libc.a. ;; '__mktime_internal', which conflicts with the one in libc.a.
,@(if (%current-target-system) ;; ,@(if (%current-target-system)
`(#:configure-flags '("gl_cv_func_working_mktime=yes")) ;; `(#:configure-flags '("gl_cv_func_working_mktime=yes"))
'()) ;; '())
,@(substitute-keyword-arguments (package-arguments tar) ,@(substitute-keyword-arguments (package-arguments tar)
((#:phases phases) ((#:phases phases)
`(modify-phases ,phases #~(modify-phases #$phases
(replace 'set-shell-file-name (replace 'set-shell-file-name
(lambda _ (lambda _
;; Do not use "/bin/sh" to run programs; see ;; Do not use "/bin/sh" to run programs; see
;; <http://lists.gnu.org/archive/html/guix-devel/2016-09/msg02272.html>. ;; <http://lists.gnu.org/archive/html/guix-devel/2016-09/msg02272.html>.
(substitute* "src/system.c" (substitute* "src/system.c"
(("/bin/sh") "sh") (("/bin/sh") "sh")
(("execv ") "execvp ")) (("execv ") "execvp ")))))))))))
#t)))))))))
;; We don't want to retain a reference to /gnu/store in the bootstrap ;; We don't want to retain a reference to /gnu/store in the bootstrap
;; versions of egrep/fgrep, so we remove the custom phase added since ;; versions of egrep/fgrep, so we remove the custom phase added since
;; grep@2.25. The effect is 'egrep' and 'fgrep' look for 'grep' in ;; grep@2.25. The effect is 'egrep' and 'fgrep' look for 'grep' in