From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Mon, 27 Sep 2021 01:27:09 +0000
Subject: Makefile.am: Set date in man pages.
The build date is embedded in the man pages by default. Pass arguments
to sphinx to use the date defined in SOURCE_DATE_EPOCH.
https://reproducible-builds.org/docs/source-date-epoch/
---
Makefile.am | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Makefile.am b/Makefile.am
index 25694a8..c2a86fc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -180,6 +180,12 @@ GENERATED_RSTS =
SPHINX_OPTS = -d $(SPHINX_CACHE) -n -q
+# Pass date defined in SOURCE_DATE_EPOCH for reproducible builds:
+# https://reproducible-builds.org/docs/source-date-epoch/
+SOURCE_DATE_EPOCH ?= $(shell date -d "$$(dpkg-parsechangelog -S Date)" +%s)
+BUILD_DATE=$(shell LC_ALL=C date -u --iso-8601 -d "@$(SOURCE_DATE_EPOCH)")
+SPHINX_OPTS += -D today=$(BUILD_DATE)
+
## detect when source directory is not build directory (i.e. VPATH
## build), and clone the docsrc tree into the build directory, so
## that we have a single "source directory" for sphinx-build to use.