From ea6cc29e83e6773cc9f5e00fd5b57be86d900e3f Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Mon, 2 Oct 2023 09:43:15 -0400 Subject: [PATCH] MT#55283 make the build reproducible Whilst working on the Reproducible Builds effort [0], we noticed that rtpengine could not be built reproducibly. This is because the manpages generated by pandoc contained the current build date. An (upstreamable) patch is attached that uses the value from the SOURCE_DATE_EPOCH environment variable if available. [0] https://reproducible-builds.org/ Change-Id: I2eb22dc5f57af69d217fb06c1c126e7e40dbd451 --- lib/common.Makefile | 2 +- lib/lib.Makefile | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/common.Makefile b/lib/common.Makefile index c6f7b427e..b62530dae 100644 --- a/lib/common.Makefile +++ b/lib/common.Makefile @@ -38,7 +38,7 @@ $(DAEMONSRCS) $(HASHSRCS): $(patsubst %,../daemon/%,$(DAEMONSRCS)) $(patsubst %, cat "$<" | sed '/^# /d; s/^##/#/' | \ pandoc -s -t man \ -M "footer:$(RTPENGINE_VERSION)" \ - -M "date:$(shell date -I)" \ + -M "date:$(BUILD_DATE)" \ -o "$@" resample.c codeclib.strhash.c mix.c packet.c: fix_frame_channel_layout.h diff --git a/lib/lib.Makefile b/lib/lib.Makefile index bd90aa5d8..f323ec245 100644 --- a/lib/lib.Makefile +++ b/lib/lib.Makefile @@ -64,3 +64,11 @@ ifneq ($(DBG),yes) endif endif endif + + +DATE_FMT = +%Y-%m-%d +ifdef SOURCE_DATE_EPOCH + 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)") +else + BUILD_DATE ?= $(shell date "$(DATE_FMT)") +endif