summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/ext/ext_conf_builder.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb
index e11a1cdfbc..7babf409a0 100644
--- a/lib/rubygems/ext/ext_conf_builder.rb
+++ b/lib/rubygems/ext/ext_conf_builder.rb
@@ -11,6 +11,21 @@ require 'tempfile'
class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
+ def self.hack_for_obsolete_style_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|$)/, '')}"
+ }
+ changed |= mf.gsub!(/^(install-so:.*DLLIB.*\n)((?:\t.*\n)+)/) {
+ "#$1#{$2.gsub(/.*INSTALL.*DLLIB.*\n/, '')}"
+ }
+ 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 +43,8 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
run cmd, results
+ hack_for_obsolete_style_gems directory
+
make dest_path, results
results