[PATCH xserver 2/4] meson: Respect SOURCE_DATE_EPOCH for reproducible builds.

Eric Anholt eric at anholt.net
Fri Sep 1 19:22:57 UTC 2017


This just copies over Chris Lamb's code from autotools.

Signed-off-by: Eric Anholt <eric at anholt.net>
---
 hw/xfree86/common/xf86Build.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/common/xf86Build.sh b/hw/xfree86/common/xf86Build.sh
index ae4a5513248b..e1b14cec5a85 100755
--- a/hw/xfree86/common/xf86Build.sh
+++ b/hw/xfree86/common/xf86Build.sh
@@ -1,5 +1,12 @@
-BUILD_DATE=`date +'%Y%m%d'`
-BUILD_TIME=`date +'1%H%M%S'`
+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
 
 output=$1
 echo "#define BUILD_DATE $BUILD_DATE" > $output
-- 
2.14.1



More information about the xorg-devel mailing list