From 349be05ee5cbfd680955d19a9ec2df72966399b4 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Fri, 21 Jul 2017 15:18:40 +0200 Subject: 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. diff --git a/configure.ac b/configure.ac index 4f7d3d3..010c2e0 100644 --- a/configure.ac +++ b/configure.ac @@ -424,9 +424,13 @@ AC_SEARCH_LIBS( # Lastly, take care of crosstool-NG internal values #-------------------------------------------------------------------- # Hey! We need the date! :-) -AC_SUBST( - [DATE], - [$(date +%Y%m%d)]) +DATE_FMT="%Y%m%d" +if test "x$SOURCE_DATE_EPOCH" = "x"; then + 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 AS_IF( -- cgit v0.10.2-6-g49f6 From b8c5b2cf27e1933cc51d066afa83bc66529b5db6 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Fri, 21 Jul 2017 15:25:31 +0200 Subject: use gzip -n to not record timestamps in .gz file headers to make build reproducible diff --git a/Makefile.in b/Makefile.in index 0f32064..2b77d5d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -177,7 +177,7 @@ build-doc: build-man: docs/$(PROG_NAME).1.gz docs/$(PROG_NAME).1.gz: docs/$(PROG_NAME).1 - $(call __silent,GZIP)gzip -c9 $< >$@ + $(call __silent,GZIP)gzip -c9n $< >$@ define sed_it $(call __silent,SED,$@)$(sed) -r \ -- cgit v0.10.2-6-g49f6