diff options
author | Eric Anholt <eric@anholt.net> | 2017-09-01 12:22:57 -0700 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2017-09-13 11:14:50 -0400 |
commit | 2b080a14c87fc9e5f77fc3361297ac332aa04f02 (patch) | |
tree | 3f5cfa5b16256432aedaa0a06323b3e438427e65 /hw/xfree86/common | |
parent | 937ed782ae5e4e0da739f0630d1681b3754f0281 (diff) |
meson: Respect SOURCE_DATE_EPOCH for reproducible builds.
This just copies over Chris Lamb's code from autotools.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'hw/xfree86/common')
-rwxr-xr-x | hw/xfree86/common/xf86Build.sh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/hw/xfree86/common/xf86Build.sh b/hw/xfree86/common/xf86Build.sh index ae4a55132..e1b14cec5 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 |