use more fixed strings to build the hypervisor
authorOlaf Hering <olaf@aepfle.de>
Wed, 7 Jan 2015 10:09:50 +0000 (11:09 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 7 Jan 2015 10:09:50 +0000 (11:09 +0100)
It should be possible to repeatedly build identical sources and get
identical binaries, even on different hosts at different build times.
This fails for xen.gz and xen.efi because current time and buildhost
get included in the binaries.

Provide variables XEN_BUILD_DATE, XEN_BUILD_TIME and XEN_BUILD_HOST
which the build environment can set to fixed strings to get a
reproducible build.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen/Makefile

index 52643e8128acd8bdee28df93f6132bea9fb35e7a..98ae2d0cf8118e54e91c20942063c3778eb9443b 100644 (file)
@@ -8,6 +8,9 @@ export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 
 export XEN_WHOAMI      ?= $(USER)
 export XEN_DOMAIN      ?= $(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown]))
+export XEN_BUILD_DATE  ?= $(shell LC_ALL=C date)
+export XEN_BUILD_TIME  ?= $(shell LC_ALL=C date +%T)
+export XEN_BUILD_HOST  ?= $(shell hostname)
 
 export BASEDIR := $(CURDIR)
 export XEN_ROOT := $(BASEDIR)/..
@@ -126,11 +129,11 @@ delete-unfresh-files:
 
 # compile.h contains dynamic build info. Rebuilt on every 'make' invocation.
 include/xen/compile.h: include/xen/compile.h.in .banner
-       @sed -e 's/@@date@@/$(shell LC_ALL=C date)/g' \
-           -e 's/@@time@@/$(shell LC_ALL=C date +%T)/g' \
+       @sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \
+           -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \
            -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \
            -e 's/@@domain@@/$(XEN_DOMAIN)/g' \
-           -e 's/@@hostname@@/$(shell hostname)/g' \
+           -e 's/@@hostname@@/$(XEN_BUILD_HOST)/g' \
            -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) --version 2>&1 | head -1)!g' \
            -e 's/@@version@@/$(XEN_VERSION)/g' \
            -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \