guix: Make nsis reproducible by respecting SOURCE-DATE-EPOCH

When building nsis, if VERSION is not specified, it defaults to
cvs_version which is non-deterministic as it includes the current date.

This patches nsis to default to SOURCE_DATE_EPOCH if it exists so that
nsis is reproducible.

Upstream change: https://github.com/kichik/nsis/pull/13
This commit is contained in:
Carl Dong 2021-01-14 18:10:16 -05:00
parent 7acda55c4f
commit a91c46c57d
2 changed files with 29 additions and 1 deletions

View File

@ -25,6 +25,13 @@
(guix profiles) (guix profiles)
(guix utils)) (guix utils))
(define-syntax-rule (search-our-patches file-name ...)
"Return the list of absolute file names corresponding to each
FILE-NAME found in ./patches relative to the current file."
(parameterize
((%patch-path (list (string-append (dirname (current-filename)) "/patches"))))
(list (search-patch file-name) ...)))
(define (make-ssp-fixed-gcc xgcc) (define (make-ssp-fixed-gcc xgcc)
"Given a XGCC package, return a modified package that uses the SSP function "Given a XGCC package, return a modified package that uses the SSP function
from glibc instead of from libssp.so. Our `symbol-check' script will complain if from glibc instead of from libssp.so. Our `symbol-check' script will complain if
@ -150,6 +157,10 @@ chain for " target " development."))
(home-page (package-home-page pthreads-xgcc)) (home-page (package-home-page pthreads-xgcc))
(license (package-license pthreads-xgcc))))) (license (package-license pthreads-xgcc)))))
(define (make-nsis-with-sde-support base-nsis)
(package-with-extra-patches base-nsis
(search-our-patches "nsis-SConstruct-sde-support.patch")))
(packages->manifest (packages->manifest
(append (append
@ -189,7 +200,9 @@ chain for " target " development."))
(let ((target (getenv "HOST"))) (let ((target (getenv "HOST")))
(cond ((string-suffix? "-mingw32" target) (cond ((string-suffix? "-mingw32" target)
;; Windows ;; Windows
(list zip (make-mingw-pthreads-cross-toolchain "x86_64-w64-mingw32") nsis-x86_64)) (list zip
(make-mingw-pthreads-cross-toolchain "x86_64-w64-mingw32")
(make-nsis-with-sde-support nsis-x86_64)))
((string-contains target "riscv64-linux-") ((string-contains target "riscv64-linux-")
(list (make-bitcoin-cross-toolchain "riscv64-linux-gnu" (list (make-bitcoin-cross-toolchain "riscv64-linux-gnu"
#:base-gcc-for-libc gcc-7))) #:base-gcc-for-libc gcc-7)))

View File

@ -0,0 +1,15 @@
diff --git a/SConstruct b/SConstruct
index e8252c9..41786f2 100755
--- a/SConstruct
+++ b/SConstruct
@@ -95,8 +95,8 @@ default_doctype = 'html'
if defenv.WhereIs('hhc', os.environ['PATH']):
default_doctype = 'chm'
-from time import strftime, gmtime
-cvs_version = strftime('%d-%b-%Y.cvs', gmtime())
+import time
+cvs_version = time.strftime('%d-%b-%Y.cvs', time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))))
opts = Variables()