File reproducible.patch of Package snobol4

Author: Bernhard M. Wiedemann <bwiedemann suse de>
To: Phil Budne <phil@regressive.org>
CC: <fred_weigel@hotmail.com>
Subject: [Patch] PoC reproducible builds

Allow for bit-identical binaries to be created
See https://reproducible-builds.org/ for why.

This patch was done while working on reproducible builds for openSUSE.

Index: snobol4-2.3.1/snolib/setuputil.sno
===================================================================
--- snobol4-2.3.1.orig/snolib/setuputil.sno
+++ snobol4-2.3.1/snolib/setuputil.sno
@@ -194,7 +194,7 @@ setup.makeinclude
 +	ou = IO_FINDUNIT()
 	of = setup.sno(t)
 	OUTPUT(.out, ou,, of)			:f(freturn)
-	out = "* Generated by setuputil.sno setup.makeinclude() " DATE()
+	out = "* Generated by setuputil.sno setup.makeinclude() "
 	modname = REPLACE(t['module'], &LCASE, &UCASE) '_DL'
 	out = setup.t modname ' = "' t['module'] '"'
 	iu = IO_FINDUNIT()
Index: snobol4-2.3.1/configure
===================================================================
--- snobol4-2.3.1.orig/configure
+++ snobol4-2.3.1/configure
@@ -45,6 +45,10 @@ DATE=`date`
 
 # run hostname from subshell to redirect shell "not found message"
 HOST=`(hostname) 2>/dev/null || uname -n`
+if [ -n "$SOURCE_DATE_EPOCH" ] ; then
+    DATE='reproducible'
+    HOST='reproducible'
+fi
 
 VERSION_H=version.h.tmp
 CONFIG_H=config.h.tmp
Index: snobol4-2.3.1/Makefile2.m4
===================================================================
--- snobol4-2.3.1.orig/Makefile2.m4
+++ snobol4-2.3.1/Makefile2.m4
@@ -260,8 +260,8 @@ build.o: always
 	echo '/* MACHINE GENERATED.  EDITING IS FUTILE */'	> build.c
 	echo '#include "h.h"'					>> build.c
 	echo 'const char build_files[] = "'$(SRCS)'";'		>> build.c
-	echo 'const char build_date[] = "'`date`'";'		>> build.c
-	echo 'const char build_dir[] = "'`pwd`'";'		>> build.c
+	echo 'const char build_date[] = "'nodate'";'		>> build.c
+	echo 'const char build_dir[] = "'reproducible'";'	>> build.c
 	$(CC) $(CFLAGS) -c build.c
 changequote([,])dnl
 
openSUSE Build Service is sponsored by