Commit 5f1a335ab66f1abcf6363bfe634913de09c665c8
1 parent
20286076
Exists in
v5.2
Allow to override build date with SOURCE_DATE_EPOCH
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. Also switch to UTC to be independent of timezone. Note: This date call is designed to work with different flavors of date (GNU, BSD and others). If only GNU (Linux) support is needed, the patch can be simplified. This PR was done while working on reproducible builds for openSUSE.
Showing
1 changed file
with
8 additions
and
1 deletions
Show diff stats
src/libpw3270cpp/Makefile.in
... | ... | @@ -61,6 +61,13 @@ VALGRIND=@VALGRIND@ |
61 | 61 | INSTALL_DATA=@INSTALL_DATA@ |
62 | 62 | INSTALL_PROGRAM=@INSTALL_PROGRAM@ |
63 | 63 | |
64 | +DATE_FMT = +%Y%m%d | |
65 | +ifdef SOURCE_DATE_EPOCH | |
66 | + BUILD_DATE ?= $(shell 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)") | |
67 | +else | |
68 | + BUILD_DATE ?= $(shell date "$(DATE_FMT)") | |
69 | +endif | |
70 | + | |
64 | 71 | CFLAGS= \ |
65 | 72 | @CFLAGS@ \ |
66 | 73 | -Wno-deprecated-declarations \ |
... | ... | @@ -102,7 +109,7 @@ $(OBJRLS)/%.o: \ |
102 | 109 | @$(MKDIR) `dirname $@` |
103 | 110 | @$(CC) $(CFLAGS) \ |
104 | 111 | @RLS_CFLAGS@ \ |
105 | - -DBUILD_DATE=`date +"%Y%m%d"` \ | |
112 | + -DBUILD_DATE=$(BUILD_DATE) \ | |
106 | 113 | -o $@ -c $< |
107 | 114 | |
108 | 115 | $(POTDIR)/%.pot: %.c | ... | ... |