From a0a2e113c59a01a599cbb91752a5ba344b6f92e8 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 18 Mar 2017 02:12:42 +0000 Subject: Use SOURCE_DATE_EPOCH git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2918 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- buildtools/stamp-date | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'buildtools') diff --git a/buildtools/stamp-date b/buildtools/stamp-date index 32839e94..902c82e4 100755 --- a/buildtools/stamp-date +++ b/buildtools/stamp-date @@ -8,16 +8,25 @@ # copyright notice and this permission notice appear in supporting # documentation. This software is provided "as is" without express or # implied warranty. -# -DATE=$(date) + +# SOURCE_DATE_EPOCH is an environment variable as described here: +# https://reproducible-builds.org/specs/source-date-epoch/ on 2017.03.16. + +SOURCE_DATE_OR_NONE=${SOURCE_DATE_EPOCH:-NONE} + +BUILD_DATETIME=$(date +%s) + LOGNAME_OR_UNKNOWN=${LOGNAME:-UNKNOWN} USER=${USER:-$LOGNAME_OR_UNKNOWN} if [ "$USER" = "UNKNOWN" ]; then - USER=`whoami` + USER=$(whoami) fi -echo "/* This file tells the package when it was compiled */" +echo "/* This file tells some facts about the building of the package */" echo "/* DO NOT EDIT - THIS FILE IS MAINTAINED AUTOMATICALLY */" echo "/* Created by the program 'stamp-date' */" -echo "#define COMPILE_TIME \"$DATE\"" +if [ "$SOURCE_DATE_OR_NONE" != "NONE" ]; then + echo "#define SOURCE_DATETIME $SOURCE_DATE_OR_NONE" +fi +echo "#define BUILD_DATETIME $BUILD_DATETIME" echo "#define COMPILED_BY \"$USER\"" -- cgit 1.4.1