lib/mkmf.rb: sort list of object files in generated Makefile
authorReiner Herrmann <reiner@reiner-h.de>
Tue, 10 Oct 2017 18:06:13 +0000 (15:06 -0300)
committerPeter Michael Green <plugwash@raspbian.org>
Tue, 20 Feb 2018 21:18:57 +0000 (21:18 +0000)
Without sorting the list explicitely, its order is indeterministic,
because readdir() is also not deterministic.
When the list of object files varies between builds, they are linked
in a different order, which results in an unreproducible build.

Signed-off-by: Antonio Terceiro <terceiro@debian.org>
Signed-off-by: Reiner Herrmann <reiner@reiner-h.de>
Gbp-Pq: Name 0002-lib-mkmf.rb-sort-list-of-object-files-in-generated-M.patch

lib/mkmf.rb

index 7f53bb4b97260fb0a6934fe897a3a0da86ee3a82..7219ab95e19bd00385f9a333f60944b6087a4afa 100644 (file)
@@ -2283,7 +2283,7 @@ LOCAL_LIBS = #{$LOCAL_LIBS}
 LIBS = #{$LIBRUBYARG} #{$libs} #{$LIBS}
 ORIG_SRCS = #{orig_srcs.collect(&File.method(:basename)).join(' ')}
 SRCS = $(ORIG_SRCS) #{(srcs - orig_srcs).collect(&File.method(:basename)).join(' ')}
-OBJS = #{$objs.join(" ")}
+OBJS = #{$objs.sort.join(" ")}
 HDRS = #{hdrs.map{|h| '$(srcdir)/' + File.basename(h)}.join(' ')}
 LOCAL_HDRS = #{$headers.join(' ')}
 TARGET = #{target}