Commit f123a096d3ec844bfb585657b6c104a587decb8e

Authored by Bernhard M. Wiedemann
Committed by Perry Werneck
1 parent b2b1a22c
Exists in develop

Allow to override build date with SOURCE_DATE_EPOCH

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 works with different implementations of date.

Also use UTC to be independent of timezone.

This patch was done while working on reproducible builds for openSUSE.
Showing 1 changed file with 3 additions and 1 deletions   Show diff stats
configure.ac
... ... @@ -119,7 +119,9 @@ case "$host" in
119 119  
120 120 esac
121 121  
122   -app_release_date=$(date +%Y-%m-%d)
  122 +DATE_FMT="+%Y-%m-%d"
  123 +SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}"
  124 +app_release_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")
123 125 AC_SUBST(RELEASE_DATE,$app_release_date)
124 126 AC_SUBST(OSNAME,$app_cv_osname)
125 127 AC_SUBST(RLS_LDFLAGS,$app_rls_ldflags)
... ...