]> granicus.if.org Git - re2c/commitdiff
Make the build reproducible 258/head
authorChris Lamb <lamby@debian.org>
Tue, 13 Aug 2019 20:52:26 +0000 (13:52 -0700)
committerChris Lamb <lamby@debian.org>
Tue, 13 Aug 2019 20:53:04 +0000 (13:53 -0700)
Whilst working on the Reproducible Builds effort [0] we noticed
that re2c could not be built reproducibly.

This is because it used the current build date in the manual page and was
originally filed in Debian as #934697 [1].

This patch uses the SOURCE_DATE_EPOCH [2] environment variable.

 [0] https://reproducible-builds.org/
 [1] https://bugs.debian.org/934697
 [2] https://reproducible-builds.org/specs/source-date-epoch/

Signed-off-by: Chris Lamb <lamby@debian.org>
configure.ac

index 0be3373d78e229ade1737cb46ceb1d43dec82138..7a59c30ecb0e2f6fbf7664d0c8638ba3b26ecd2f 100644 (file)
@@ -6,8 +6,12 @@ AM_SILENT_RULES([yes])
 AC_CONFIG_SRCDIR([src/main.cc])
 AC_CONFIG_HEADERS([config.h])
 
-
-AC_SUBST(PACKAGE_DATE, `date +'%d %b %Y'`)
+if test -n "$SOURCE_DATE_EPOCH"; then
+       PACKAGE_DATE=`LC_ALL=C date --utc --date="@$SOURCE_DATE_EPOCH" +'%b %d %Y'`
+else
+       PACKAGE_DATE=`date +'%d %b %Y'`
+fi
+AC_SUBST(PACKAGE_DATE, $PACKAGE_DATE)
 AC_SUBST(PACKAGE_VERSION)
 AC_SUBST(PACKAGE_NAME)
 AC_SUBST(PACKAGE_TARNAME)