gnu: linux-libre: Make build reproducible.

Fixes <https://issues.guix.gnu.org/24028>.

* gnu/packages/linux.scm (make-linux-libre*): Remove trailing #t.
[phases]{configure}: Set KBUILD_BUILD_USER and KBUILD_BUILD_HOST environment
variables.
This commit is contained in:
Maxim Cournoyer 2021-11-21 00:07:08 -05:00
parent a0e5af4593
commit 01ea70a29c
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -818,15 +818,18 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
(add-after 'unpack 'patch-/bin/pwd
(lambda _
(substitute* (find-files "." "^Makefile(\\.include)?$")
(("/bin/pwd") "pwd"))
#t))
(("/bin/pwd") "pwd"))))
(replace 'configure
(lambda* (#:key inputs native-inputs target #:allow-other-keys)
;; Avoid introducing timestamps
;; Avoid introducing timestamps.
(setenv "KCONFIG_NOTIMESTAMP" "1")
(setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH"))
;; Set ARCH and CROSS_COMPILE
;; Other variables useful for reproducibility.
(setenv "KBUILD_BUILD_USER" "guix")
(setenv "KBUILD_BUILD_HOST" "guix")
;; Set ARCH and CROSS_COMPILE.
(let ((arch ,(system->linux-architecture
(or (%current-target-system)
(%current-system)))))
@ -897,8 +900,7 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
(false-if-file-not-found
(delete-file (string-append moddir "/" version "/build")))
(false-if-file-not-found
(delete-file (string-append moddir "/" version "/source"))))
#t))))
(delete-file (string-append moddir "/" version "/source"))))))))
#:tests? #f))
(home-page "https://www.gnu.org/software/linux-libre/")
(synopsis "100% free redistribution of a cleaned Linux kernel")