]> git.tuebingen.mpg.de Git - lopsub.git/commitdiff
Don't embed compile-time timestamps into generated files.
authorChris Lamb <lamby@debian.org>
Fri, 31 May 2019 17:54:04 +0000 (19:54 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 5 Jun 2019 17:10:27 +0000 (19:10 +0200)
Currently the build is not reproducible because make(1) runs
date(1) to provide the month and the year for the man page. Fix
this by honouring SOURCE_DATE_EPOCH as described in

https://reproducible-builds.org/specs/source-date-epoch/

Signed-off-by: Andre Noll <maan@tuebingen.mpg.de>
Makefile

index 408e3a5ac123dff22cd744a1487e18de3ed53c64..3c7bde206f1e977188ab753a6b86f53331cde74c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,15 @@ INSTALL := install
 GZIP := gzip -f9
 ZCAT := zcat
 
-DATE := $(shell date '+%B %Y')
+DATE_FMT := +%B %Y
+# To get a reproducible build, we use $(SOURCE_DATE_EPOCH) instead of the
+# current time if this variable is set.
+ifdef SOURCE_DATE_EPOCH
+       DATE := $(shell LC_ALL=C date -u -d '@$(SOURCE_DATE_EPOCH)' \
+               '$(DATE_FMT)' 2>/dev/null || LC_ALL=C date -u '$(DATE_FMT)')
+else
+       DATE := $(shell date '+$(DATE_FMT)')
+endif
 GIT_VERSION := $(shell ./version-gen.sh)
 PLAIN_VERSION := $(firstword $(subst -, , $(GIT_VERSION)))
 MAJOR_VERSION := $(firstword $(subst ., , $(PLAIN_VERSION)))