diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-17 14:20:09 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-17 14:20:09 +0000 |
commit | 5d6aa9ba8b0130ec6d6b5a81a03172e0db317fd8 (patch) | |
tree | 7e61ec199c72bf5dbbb42474c17d87170e4032f8 /lib | |
parent | 937cf089375724c60ab1ebcc96e88eea6e435e74 (diff) |
merge revision(s) 39558: [Backport #7991]
* lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build):
revert use of temporary directory for build, to work some buggy
extconf.rb which cannot build outside the source directory.
[ruby-core:53056] [Bug #7698]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rubygems/ext/ext_conf_builder.rb | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb index 3a439af502..eaf5e607a6 100644 --- a/lib/rubygems/ext/ext_conf_builder.rb +++ b/lib/rubygems/ext/ext_conf_builder.rb @@ -7,37 +7,30 @@ require 'rubygems/ext/builder' require 'rubygems/command' require 'fileutils' -require 'tmpdir' +require 'tempfile' class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder def self.build(extension, directory, dest_path, results, args=[]) - pwd = Dir.pwd - cmd = "#{Gem.ruby} -r./siteconf #{File.join pwd, File.basename(extension)}" - cmd << " #{args.join ' '}" unless args.empty? - - Dir.mktmpdir("gem-install.") do |tmpdir| - Dir.chdir(tmpdir) do - open("siteconf.rb", "w") do |f| - f.puts "require 'rbconfig'" - f.puts "dest_path = #{dest_path.dump}" - %w[sitearchdir sitelibdir].each do |dir| - f.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path" - f.puts "RbConfig::CONFIG['#{dir}'] = dest_path" - end - end - - begin - run cmd, results - - make dest_path, results - ensure - FileUtils.mv("mkmf.log", pwd) if $! and File.exist?("mkmf.log") - end + siteconf = Tempfile.open(%w"siteconf .rb", ".") do |f| + f.puts "require 'rbconfig'" + f.puts "dest_path = #{dest_path.dump}" + %w[sitearchdir sitelibdir].each do |dir| + f.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path" + f.puts "RbConfig::CONFIG['#{dir}'] = dest_path" end + f end + cmd = [Gem.ruby, "-r#{siteconf.path}", File.basename(extension), *args].join ' ' + + run cmd, results + + make dest_path, results + results + ensure + siteconf.close(true) if siteconf end end |