build: allow for reproducible builds
[vpp.git] / build / external / Makefile
index d648f4f..fb3cd94 100644 (file)
@@ -21,6 +21,7 @@ BUILD_DIR        ?= $(CURDIR)/_build
 INSTALL_DIR      ?= $(CURDIR)/_install
 PKG_VERSION ?= $(shell git describe --abbrev=0 --match 'v[0-9]*' | cut -d- -f1 | cut -dv -f2 | cut -d. -f1,2)
 PKG_SUFFIX ?= $(shell git log --oneline v$(PKG_VERSION)-rc0.. . | wc -l)
+SOURCE_DATE_EPOCH ?= $(shell git log -1 --pretty=%ct .)
 JOBS := $(if $(shell [ -f /proc/cpuinfo ] && head /proc/cpuinfo),\
        $(shell grep -c ^processor /proc/cpuinfo), 2)
 
@@ -68,7 +69,7 @@ deb/debian/changelog: Makefile
        @echo "" >> $@
        @echo "  * Version $(DEB_VER)" >> $@
        @echo "" >> $@
-       @echo " -- VPP Dev <vpp-dev@lists.fd.io>  $(shell date -R)" >> $@
+       @echo " -- VPP Dev <vpp-dev@lists.fd.io>  $(shell date -R --date=@${SOURCE_DATE_EPOCH})" >> $@
 
 $(DEV_DEB): deb/debian/changelog
        @cd deb && dpkg-buildpackage -b -uc -us