Package: hello
Version: 2.8-4
Severity: wishlist
Tags: patch

Hi!

In the quest to get deterministic/reproducible builds [1], I have
noticed that the result of building hello currently varies according to
its build path.

The attached patch use the debugedit tool to prevent such variation by
relocating the source associated with the debug data to a deterministic
path.

It also adds `-fno-merge-debug-strings` to the CFLAGS, because the
resulting .debug_str section will be different depending on the initial
input strings. This behaviour should eventually be fixed at the compiler
level.

[1] http://wiki.debian.org/ReproducibleBuilds

Thanks,
-- 
Lunar                                .''`. 
lu...@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
diff -Naur a/debian/control b/debian/control
--- a/debian/control	2011-08-04 13:07:58.000000000 +0200
+++ b/debian/control	2013-09-07 15:18:45.255559439 +0200
@@ -2,6 +2,7 @@
 Section: devel
 Priority: optional
 Maintainer: Santiago Vila <sanv...@debian.org>
+Build-Depends: debugedit | rpm (>= 4.7.0-3)
 Standards-Version: 3.9.2
 Homepage: http://www.gnu.org/software/hello/
 
diff -Naur a/debian/rules b/debian/rules
--- a/debian/rules	2013-08-16 09:36:35.000000000 +0200
+++ b/debian/rules	2013-09-07 15:09:36.755619230 +0200
@@ -10,7 +10,7 @@
 package = hello
 docdir = debian/tmp/usr/share/doc/$(package)
 
-CFLAGS := `dpkg-buildflags --get CFLAGS` -Wall
+CFLAGS := `dpkg-buildflags --get CFLAGS` -Wall -fno-merge-debug-strings
 LDFLAGS := `dpkg-buildflags --get LDFLAGS`
 CPPFLAGS := `dpkg-buildflags --get CPPFLAGS`
 
@@ -34,6 +34,8 @@
   STRIP = $(stripcmd) --remove-section=.comment --remove-section=.note
 endif
 
+DEBUGEDIT = /usr/lib/rpm/debugedit
+
 build:
 	./configure CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
 		LDFLAGS="$(LDFLAGS)" $(confflags) --prefix=/usr
@@ -54,6 +56,7 @@
 	rm -rf debian/tmp
 	install -d debian/tmp/DEBIAN $(docdir)
 	$(MAKE) prefix="$$(pwd)/debian/tmp/usr" install
+	$(DEBUGEDIT) -b $(dir $(realpath $(CURDIR))) -d /usr/src/debug -i debian/tmp/usr/bin/hello
 	$(STRIP) debian/tmp/usr/bin/hello
 	cp -a NEWS debian/copyright $(docdir)
 	cp -a debian/changelog $(docdir)/changelog.Debian

Attachment: signature.asc
Description: Digital signature

Reply via email to