Source: qtltools
Version: 1.0+dfsg-1
Severity: wishlist
Tags: patch upstream
User: reproducible-bui...@lists.alioth.debian.org
Usertags: fileordering
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

Hi!

While working on the "reproducible builds" effort [1], we have noticed
that qtltools could not be built reproducibly.
It collects source files with find, which returns files in
undeterministic readdir() order, which causes object files to be linked
in the same undeterministic order.

The attached patch fixes this by sorting the files.

Regards,
 Reiner

[1]: https://wiki.debian.org/ReproducibleBuilds
diff --git a/debian/patches/reproducible_build.patch b/debian/patches/reproducible_build.patch
new file mode 100644
index 0000000..b38c78b
--- /dev/null
+++ b/debian/patches/reproducible_build.patch
@@ -0,0 +1,16 @@
+Author: Reiner Herrmann <rei...@reiner-h.de>
+Description: Sort source files for deterministic linking order
+
+--- a/Makefile
++++ b/Makefile
+@@ -27,8 +27,8 @@
+ BFILE=bin/QTLtools
+ HFILE=$(shell find src -name *.h)
+ TFILE=$(shell find lib -name *.h)
+-CFILE=$(shell find src -name *.cpp)
+-OFILE=$(shell for file in `find src -name *.cpp`; do echo obj/$$(basename $$file .cpp).o; done)
++CFILE=$(shell find src -name *.cpp | LC_ALL=C sort)
++OFILE=$(shell for file in `find src -name *.cpp | LC_ALL=C sort`; do echo obj/$$(basename $$file .cpp).o; done)
+ VPATH=$(shell for file in `find src -name *.cpp`; do echo $$(dirname $$file); done)
+ 
+ #DEFAULT VERSION (I.E. UNIGE DESKTOP RELEASE VERSION)
diff --git a/debian/patches/series b/debian/patches/series
index 825a79b..bc92ec2 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 Makefile_config.patch
 Spelling_error.patch
+reproducible_build.patch

Reply via email to