File reproducible.patch of Package wyrd
Author: Bernhard M. Wiedemann <bwiedemann suse de>
Date: 2018-03-13
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 works with various variants of date
Index: wyrd-1.4.6/Makefile.in
===================================================================
--- wyrd-1.4.6.orig/Makefile.in
+++ wyrd-1.4.6/Makefile.in
@@ -86,10 +86,15 @@ $(NAME).opt: $(COBJS) $(CURSES_CMXA) $(C
VERSION=1.4.6
+ifdef SOURCE_DATE_EPOCH
+ BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" 2>/dev/null || date -u)
+else
+ BUILD_DATE ?= $(shell date)
+endif
version.ml: Makefile
echo "let version = \""$(VERSION)"\"" > version.ml
- echo "let date = \""`date`"\"" >> version.ml
+ echo "let date = \"$(BUILD_DATE)\"" >> version.ml
$(CURSES_CMA) $(CURSES_CMXA) .stamp_built_curses: