diff options
Diffstat (limited to 'lib/rubygems/ext')
-rw-r--r-- | lib/rubygems/ext/builder.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/ext/ext_conf_builder.rb | 22 |
2 files changed, 13 insertions, 11 deletions
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb index cbae8234a1..548f1262a8 100644 --- a/lib/rubygems/ext/builder.rb +++ b/lib/rubygems/ext/builder.rb @@ -161,7 +161,7 @@ EOF results = builder.build(extension, @gem_dir, dest_path, results, @build_args, lib_dir) - say results.join("\n") if Gem.configuration.really_verbose + verbose { results.join("\n") } end end diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb index 05506b265b..213bdcb002 100644 --- a/lib/rubygems/ext/ext_conf_builder.rb +++ b/lib/rubygems/ext/ext_conf_builder.rb @@ -11,13 +11,15 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder FileEntry = FileUtils::Entry_ # :nodoc: def self.build(extension, directory, dest_path, results, args=[], lib_dir=nil) - tmp_dest = Dir.mktmpdir(".gem.", ".") + # relative path required as some versions of mktmpdir return an absolute + # path which breaks make if it includes a space in the name + tmp_dest = get_relative_path(Dir.mktmpdir(".gem.", ".")) t = nil Tempfile.open %w"siteconf .rb", "." do |siteconf| t = siteconf siteconf.puts "require 'rbconfig'" - siteconf.puts "dest_path = #{(tmp_dest || dest_path).dump}" + siteconf.puts "dest_path = #{tmp_dest.dump}" %w[sitearchdir sitelibdir].each do |dir| siteconf.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path" siteconf.puts "RbConfig::CONFIG['#{dir}'] = dest_path" @@ -25,14 +27,10 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder siteconf.flush - siteconf_path = File.expand_path siteconf.path - - rubyopt = ENV["RUBYOPT"] destdir = ENV["DESTDIR"] begin - ENV["RUBYOPT"] = ["-r#{siteconf_path}", rubyopt].compact.join(' ') - cmd = [Gem.ruby, File.basename(extension), *args].join ' ' + cmd = [Gem.ruby, "-r", get_relative_path(siteconf.path), File.basename(extension), *args].join ' ' begin run cmd, results @@ -42,7 +40,6 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder end ENV["DESTDIR"] = nil - ENV["RUBYOPT"] = rubyopt make dest_path, results @@ -57,11 +54,10 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder FileEntry.new(tmp_dest).traverse do |ent| destent = ent.class.new(dest_path, ent.rel) - destent.exist? or File.rename(ent.path, destent.path) + destent.exist? or FileUtils.mv(ent.path, destent.path) end end ensure - ENV["RUBYOPT"] = rubyopt ENV["DESTDIR"] = destdir end end @@ -72,5 +68,11 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder FileUtils.rm_rf tmp_dest if tmp_dest end + private + def self.get_relative_path(path) + path[0..Dir.pwd.length-1] = '.' if path.start_with?(Dir.pwd) + path + end + end |