ruby-changes:43191
From: nobu <ko1@a...>
Date: Fri, 3 Jun 2016 17:44:39 +0900 (JST)
Subject: [ruby-changes:43191] nobu:r55265 (trunk): mkmf.rb: sort lists of source and object files
nobu 2016-06-03 17:44:27 +0900 (Fri, 03 Jun 2016) New Revision: 55265 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55265 Log: mkmf.rb: sort lists of source and object files * lib/mkmf.rb (create_makefile): sort lists of source and object files in generated Makefile, unless given by extconf.rb. [Fix GH-1367] Without sorting the list of object files 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. Modified files: trunk/ChangeLog trunk/lib/mkmf.rb Index: lib/mkmf.rb =================================================================== --- lib/mkmf.rb (revision 55264) +++ lib/mkmf.rb (revision 55265) @@ -2205,11 +2205,15 @@ RULES https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L2205 RbConfig.expand(srcdir = srcprefix.dup) ext = ".#{$OBJEXT}" - orig_srcs = Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] + orig_srcs = Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")].sort if not $objs srcs = $srcs || orig_srcs - objs = srcs.inject(Hash.new {[]}) {|h, f| h[File.basename(f, ".*") << ext] <<= f; h} - $objs = objs.keys + $objs = [] + objs = srcs.inject(Hash.new {[]}) {|h, f| + h.key?(o = File.basename(f, ".*") << ext) or $objs << o + h[o] <<= f + h + } unless objs.delete_if {|b, f| f.size == 1}.empty? dups = objs.sort.map {|b, f| "#{b[/.*\./]}{#{f.collect {|n| n[/([^.]+)\z/]}.join(',')}}" Index: ChangeLog =================================================================== --- ChangeLog (revision 55264) +++ ChangeLog (revision 55265) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Jun 3 17:44:25 2016 Reiner Herrmann <reiner@r...> + + * lib/mkmf.rb (create_makefile): sort lists of source and object + files in generated Makefile, unless given by extconf.rb. + [Fix GH-1367] + Thu Jun 2 21:18:10 2016 Nobuyoshi Nakada <nobu@r...> * win32/win32.c (get_special_folder): use SHGetPathFromIDListEx if -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/