Allow to override build date

in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

This date call is designed to work with both GNU date and BSD date.
This commit is contained in:
Bernhard M. Wiedemann 2017-07-21 15:18:40 +02:00
parent fae66ae34f
commit 349be05ee5

View File

@ -424,9 +424,13 @@ AC_SEARCH_LIBS(
# Lastly, take care of crosstool-NG internal values # Lastly, take care of crosstool-NG internal values
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Hey! We need the date! :-) # Hey! We need the date! :-)
AC_SUBST( DATE_FMT="%Y%m%d"
[DATE], if test "x$SOURCE_DATE_EPOCH" = "x"; then
[$(date +%Y%m%d)]) DATE=$(date "+$DATE_FMT")
else
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")"
fi
AC_SUBST([DATE])
# Decorate the version string if needed # Decorate the version string if needed
AS_IF( AS_IF(