Browse Source

Allow reproducible builds

Christoph Biedl 8 years ago
parent
commit
7ec5c03096

+ 1 - 0
debian/control

@@ -9,6 +9,7 @@ Uploaders:
 Build-Depends: debhelper (>= 9~),
     autotools-dev,
     dh-systemd,
+    dpkg-dev (>> 1.17.0~),
     expect,
     libgnutls28-dev,
     libident-dev,

+ 24 - 0
debian/patches/introduce-birthdate-constant-for-reproducible-builds.patch

@@ -0,0 +1,24 @@
+Subject: Allow reproducible builds by introducing a BIRTHDATE constant
+Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
+Date: Tue Aug 25 18:03:23 2015 +0200
+Forwarded: http://arthur.barton.de/pipermail/ngircd-ml/2015-August/000819.html
+
+--- a/src/ngircd/irc-info.c
++++ b/src/ngircd/irc-info.c
+@@ -556,7 +556,15 @@
+ 				NGIRCd_Version))
+ 		return DISCONNECTED;
+ 
+-#if defined(__DATE__) && defined(__TIME__)
++#if defined(BIRTHDATE)
++	char t_str[60];
++	time_t t = BIRTHDATE;
++	(void)strftime(t_str, sizeof(t_str), "%a %b %d %Y at %H:%M:%S (%Z)",
++			localtime(&t));
++	snprintf(msg, sizeof(msg), "Birth Date: %s", t_str);
++	if (!IRC_WriteStrClient(Client, RPL_INFO_MSG, Client_ID(prefix), msg))
++		return DISCONNECTED;
++#elif defined(__DATE__) && defined(__TIME__)
+ 	snprintf(msg, sizeof(msg), "Birth Date: %s at %s", __DATE__, __TIME__);
+ 	if (!IRC_WriteStrClient(Client, RPL_INFO_MSG, Client_ID(prefix), msg))
+ 		return DISCONNECTED;

+ 1 - 0
debian/patches/series

@@ -0,0 +1 @@
+introduce-birthdate-constant-for-reproducible-builds.patch

+ 8 - 0
debian/rules

@@ -1,5 +1,13 @@
 #!/usr/bin/make -f
 
+ifeq ($(SOURCE_DATE_EPOCH),)
+    # workaround until SOURCE_DATE_EPOCH is available
+    $(info SOURCE_DATE_EPOCH is not set, using changelog date instead)
+    export CFLAGS += -DBIRTHDATE=$(shell date --date="$$(dpkg-parsechangelog --count 1 --show-field Date)" +%s)
+else
+    export CFLAGS += -DBIRTHDATE=$(SOURCE_DATE_EPOCH)
+endif
+
 override_dh_auto_configure:
 	dh_auto_configure -- \
 	    --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \