diff options
Diffstat (limited to 'lib/rubygems/ext')
-rw-r--r-- | lib/rubygems/ext/ext_conf_builder.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb index e11a1cdfbc..f3fc5d8e30 100644 --- a/lib/rubygems/ext/ext_conf_builder.rb +++ b/lib/rubygems/ext/ext_conf_builder.rb @@ -11,6 +11,18 @@ require 'tempfile' class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder + def self.hack_for_obsolete_sytle_gems(directory) + return unless directory and File.identical?(directory, ".") + mf = Gem.read_binary 'Makefile' + changed = false + changed |= mf.gsub!(/^(install-rb-default:)(.*)/) { + "#$1#{$2.gsub(/(?:^|\s+)\$\(RUBY(?:ARCH|LIB)DIR\)\/\S+(?=\s|$)/, '')}" + } + if changed + File.open('Makefile', 'wb') {|f| f.print mf} + end + end + def self.build(extension, directory, dest_path, results, args=[]) siteconf = Tempfile.open(%w"siteconf .rb", ".") do |f| f.puts "require 'rbconfig'" @@ -28,6 +40,8 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder run cmd, results + hack_for_obsolete_sytle_gems directory + make dest_path, results results |