aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMorten Linderud <morten@linderud.pw>2019-06-20 23:14:18 +0200
committerMorten Linderud <morten@linderud.pw>2019-06-20 23:25:21 +0200
commit8f7255657a3e2df0d87f3112fd8d1e9718a0386c (patch)
tree59731be2bb794bfd7534ef905be12b771459587b /Makefile
parentf65ddc09914050275eb8ddc0b8f805d2cdd3be46 (diff)
downloadpodman-8f7255657a3e2df0d87f3112fd8d1e9718a0386c.tar.gz
podman-8f7255657a3e2df0d87f3112fd8d1e9718a0386c.tar.bz2
podman-8f7255657a3e2df0d87f3112fd8d1e9718a0386c.zip
Support SOURCE_DATE_EPOCH
Build artifacts embeds the current date of the build into the artifact. If anyone want to reproduce the software at a later date there is no way to pass a recorded date or fake it in the build system at a later point. https://reproducible-builds.org/docs/source-date-epoch/ Signed-off-by: Morten Linderud <morten@linderud.pw>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 8 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 881236452..fe90076d1 100644
--- a/Makefile
+++ b/Makefile
@@ -49,14 +49,20 @@ SELINUXOPT ?= $(shell test -x /usr/sbin/selinuxenabled && selinuxenabled && echo
COMMIT_NO ?= $(shell git rev-parse HEAD 2> /dev/null || true)
GIT_COMMIT ?= $(if $(shell git status --porcelain --untracked-files=no),${COMMIT_NO}-dirty,${COMMIT_NO})
-BUILD_INFO ?= $(shell date +%s)
+DATE_FMT = %s
+ifdef SOURCE_DATE_EPOCH
+ BUILD_INFO ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u "+$(DATE_FMT)")
+ ISODATE ?= $(shell date -d "@$(SOURCE_DATE_EPOCH)" --iso-8601)
+else
+ BUILD_INFO ?= $(shell date "+$(DATE_FMT)")
+ ISODATE ?= $(shell date --iso-8601)
+endif
LIBPOD := ${PROJECT}/libpod
LDFLAGS_PODMAN ?= $(LDFLAGS) \
-X $(LIBPOD).gitCommit=$(GIT_COMMIT) \
-X $(LIBPOD).buildInfo=$(BUILD_INFO) \
-X $(LIBPOD).installPrefix=$(PREFIX) \
-X $(LIBPOD).etcDir=$(ETCDIR)
-ISODATE ?= $(shell date --iso-8601)
#Update to LIBSECCOMP_COMMIT should reflect in Dockerfile too.
LIBSECCOMP_COMMIT := release-2.3