Bug#913021: carbon-c-relay: make the build reproducible

Nicholas M Gregory ngregory at nyu.edu
Tue Nov 6 03:51:22 GMT 2018


Source: carbon-c-relay
Version: 3.2-1
Severity: wishlist
Tags: patch
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org

Hi there,

While working on the reproducible builds project
(https://wiki.debian.org/ReproducibleBuilds), we noticed that
carbon-c-relay could not be built reproducibly.

The attached patch changes the build system to first attempt to use
the SOURCE_DATE_EPOCH envvar
(https://reproducible-builds.org/specs/source-date-epoch/) to
determine build date, then falls back to the git commit date, then the
current date.

Best,
-Nick Gregory

================ begin patch ================
--- Makefile.am.orig 2017-10-21 10:39:41.000000000 -0400
+++ Makefile.am 2018-11-05 22:45:30.772368908 -0500
@@ -16,7 +16,11 @@

 CFLAGS ?= -O2 -Wall -Wshadow -pipe

-GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always
2>/dev/null || date +%F)
+GIT_VERSION := $(shell \
+ date -u -d "@${SOURCE_DATE_EPOCH}" "+%F" 2>/dev/null || \
+ date -u -r "${SOURCE_DATE_EPOCH}" "+%F" 2>/dev/null || \
+ git describe --abbrev=6 --dirty --always 2>/dev/null || \
+ date +%F)
 GVCFLAGS = -DGIT_VERSION=\"$(GIT_VERSION)\"

 override CFLAGS += $(GVCFLAGS) -pthread



More information about the Reproducible-bugs mailing list