From 4eea36b1eb11f8b1a5629ee7a44c4e0b61ee643e Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Sun, 15 Mar 2015 19:37:54 +0000 Subject: Add support for reproducible builds --- debian/changelog | 10 ++++ ...configure.ac-to-allow-external-build_date.patch | 62 ++++++++++++++++++++++ debian/patches/series | 1 + debian/rules | 2 + 4 files changed, 75 insertions(+) create mode 100644 debian/patches/02-patch-configure.ac-to-allow-external-build_date.patch diff --git a/debian/changelog b/debian/changelog index 63df3c8..472cd04 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +wavemon (0.7.6-3) UNRELEASED; urgency=medium + + * Add support for reproducible builds + - d/patches: Added + 02-patch-configure.ac-to-allow-external-build_date.patch (sent and + accepted upstream) + - d/rules: parse and export BUILD_DATE from changelog entry + + -- Jonathan McCrohan Sun, 15 Mar 2015 18:21:23 +0000 + wavemon (0.7.6-2) unstable; urgency=medium * d/patches: Drop 01-remove-extra-copyright-file.patch; replace with diff --git a/debian/patches/02-patch-configure.ac-to-allow-external-build_date.patch b/debian/patches/02-patch-configure.ac-to-allow-external-build_date.patch new file mode 100644 index 0000000..6026187 --- /dev/null +++ b/debian/patches/02-patch-configure.ac-to-allow-external-build_date.patch @@ -0,0 +1,62 @@ +From b951f6292f74edd114a403b6be8752070c8d819f Mon Sep 17 00:00:00 2001 +From: Jonathan McCrohan +Date: Thu, 12 Mar 2015 15:21:58 -0700 +Subject: [PATCH] configure.ac: Support external BUILD_DATE values + +Support reproducible builds [1] by allowing build systems to pass in an +external value for BUILD_DATE. + +autoreconf has been run to resync configure with configure.ac changes. + +[1] https://wiki.debian.org/ReproducibleBuilds + +Signed-off-by: Jonathan McCrohan +Signed-off-by: Gerrit Renker +--- + configure | 8 ++++++++ + configure.ac | 7 ++++++- + 2 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/configure b/configure +index 082dd99..eeb8115 100755 +--- a/configure ++++ b/configure +@@ -2186,11 +2186,19 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + ac_config_files="$ac_config_files Makefile" + ++# allow BUILD_DATE to be externally set for build reproducibility ++if test "$BUILD_DATE"; then ++ cat >>confdefs.h <<_ACEOF ++#define BUILD_DATE "$BUILD_DATE" ++_ACEOF ++ ++else + + cat >>confdefs.h <<_ACEOF + #define BUILD_DATE "`/bin/date`" + _ACEOF + ++fi + + CFLAGS="-O2 -Wall" + +diff --git a/configure.ac b/configure.ac +index e50c986..7ae0db9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -7,8 +7,13 @@ AC_INIT([wavemon], [0.7.6], [gerrit@erg.abdn.ac.uk], [wavemon-current], + # Variables + AC_CONFIG_AUX_DIR([config]) + AC_CONFIG_FILES([Makefile]) +-AC_DEFINE_UNQUOTED([BUILD_DATE], ["`/bin/date`"], ++# allow BUILD_DATE to be externally set for build reproducibility ++if test "$BUILD_DATE"; then ++ AC_DEFINE_UNQUOTED(BUILD_DATE, ["$BUILD_DATE"]) ++else ++ AC_DEFINE_UNQUOTED([BUILD_DATE], ["`/bin/date`"], + [date wavemon was last configured and built]) ++fi + + CFLAGS="-O2 -Wall" + diff --git a/debian/patches/series b/debian/patches/series index 18ef635..3c4f399 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ 01-patch-makefile.in-to-not-install-docs.patch +02-patch-configure.ac-to-allow-external-build_date.patch diff --git a/debian/rules b/debian/rules index 14f6997..342fdcc 100755 --- a/debian/rules +++ b/debian/rules @@ -2,5 +2,7 @@ export DEB_CFLAGS_MAINT_APPEND=-pthread +export BUILD_DATE = $(shell LC_ALL=C date -u --date="`dpkg-parsechangelog -SDate`") + %: dh $@ --with autotools_dev -- cgit v1.2.3