mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
build: Set DATE to SOURCE_DATE_EPOCH if available
Use the solution described in [1] to provide a wrapper to the 'date' command that uses SOURCE_DATE_EPOCH if available. This is needed for reproducible builds. The -d "@..." syntax was introduced in GNU date about 2005 (but only added to the docuemntation in 2011), so I assume a version supporting this syntax is available, if SOURCE_DATE_EPOCH is defined. If SOURCE_DATE_EPOCH is not defined, nothing changes with respect to the current behavior. Update all users of 'date' in the tree to use the new wrapper. [1] https://reproducible-builds.org/docs/source-date-epoch/ Signed-off-by: Maximilian Engelhardt <maxi@daemonizer.de> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
1 parent
5dd85073d1
commit
8aaf5dc2c9
5 files changed
+23
-9
No files matched your search
@@ -141,6 +141,14 @@ export XEN_HAS_BUILD_ID=y
|
||||
build_id_linker := --build-id=sha1
|
||||
endif
|
||||
|
||||
# Wrap date(1) to use SOURCE_DATE_EPOCH if set the environment.
|
||||
# See https://reproducible-builds.org/docs/source-date-epoch/
|
||||
ifdef SOURCE_DATE_EPOCH
|
||||
date = $(shell LC_ALL=C date -u -d "@$(SOURCE_DATE_EPOCH)" $(1) 2>/dev/null || LC_ALL=C date -u -r "$(SOURCE_DATE_EPOCH)" $(1) 2>/dev/null || LC_ALL=C date -u $(1))
|
||||
else
|
||||
date = $(shell LC_ALL=C date $(1))
|
||||
endif
|
||||
|
||||
define buildmakevars2shellvars
|
||||
export PREFIX="$(prefix)"; \
|
||||
export XEN_SCRIPT_DIR="$(XEN_SCRIPT_DIR)"; \
|
||||
|
||||