about summary refs log tree commit diff
path: root/buildtools
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-03-18 02:12:42 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-03-18 02:12:42 +0000
commita0a2e113c59a01a599cbb91752a5ba344b6f92e8 (patch)
treec7acc253da2d62df6878906665207db366546f91 /buildtools
parent42f622dfcc42fb36828f2b6e9ba1127ca65739dd (diff)
downloadnetpbm-mirror-a0a2e113c59a01a599cbb91752a5ba344b6f92e8.tar.gz
netpbm-mirror-a0a2e113c59a01a599cbb91752a5ba344b6f92e8.tar.xz
netpbm-mirror-a0a2e113c59a01a599cbb91752a5ba344b6f92e8.zip
Use SOURCE_DATE_EPOCH
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2918 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'buildtools')
-rwxr-xr-xbuildtools/stamp-date19
1 files changed, 14 insertions, 5 deletions
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\""