summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lamb <lamby@debian.org>2017-09-01 12:22:56 -0700
committerAdam Jackson <ajax@redhat.com>2017-09-13 11:14:46 -0400
commit937ed782ae5e4e0da739f0630d1681b3754f0281 (patch)
tree17fbaa54ddf6b8423e57e00ba18bdcff81715dcc
parenta49379b6045453c7b787cc638db6afd0d14dce9c (diff)
configure.ac: Make BUILD_{DATE, TIME} respect SOURCE_DATE_EPOCH if set
Whilst working on the Reproducible Builds effort [0], we noticed that xorg-server could not be built reproducibly. One reason is because it embeds a "current" build and date time. This should be compatible with both GNU and BSD date(1). [0] https://reproducible-builds.org/ v2: Fix change in Y-M-D format that broke the build. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Adam Jackson <ajax@redhat.com>
-rw-r--r--configure.ac10
1 files changed, 8 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index eee1257a9..f13a54ab9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2402,9 +2402,15 @@ AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])
AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [sysconfdir])
AC_SUBST([RELEASE_DATE])
-BUILD_DATE="`date +'%Y%m%d'`"
+DATE_FMT="%Y%m%d"
+TIME_FMT="1%H%M%S"
+BUILD_DATE="`date "+$DATE_FMT"`"
+BUILD_TIME="`date "+$TIME_FMT"`"
+if test "x$SOURCE_DATE_EPOCH" != "x"; then
+ BUILD_DATE="`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"`"
+ BUILD_TIME="`date -u -d "@$SOURCE_DATE_EPOCH" "+$TIME_FMT" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "+$TIME_FMT" 2>/dev/null || date -u "+$TIME_FMT"`"
+fi
AC_SUBST([BUILD_DATE])
-BUILD_TIME="`date +'1%H%M%S'`"
AC_SUBST([BUILD_TIME])
DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"