1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib/rubygems/ext/builder.rb
drbrain a5dfaca00a * lib/rubygems/ext/builder.rb: Fix incompatibilities when installing
extensions.  Patch by Nobu.
  [ruby-trunk - Bug #7968] [ruby-trunk - Bug #7971]
* lib/rubygems/ext/ext_conf_builder.rb:  ditto.
* lib/rubygems/installer.rb:  ditto.
* test/rubygems/test_gem_ext_ext_conf_builder.rb:  Test for the above.
* test/rubygems/test_gem_installer.rb:  ditto.

* lib/rubygems/commands/sources_command.rb:  Prefer HTTPS over HTTP.
* lib/rubygems/defaults.rb:  ditto
* lib/rubygems/dependency_resolver.rb:  Ditto.
* lib/rubygems/source.rb:  ditto.
* lib/rubygems/spec_fetcher.rb:  ditto.
* lib/rubygems/specification.rb:  ditto.
* lib/rubygems/test_utilities.rb:  ditto.
* test/rubygems/test_gem.rb:  Test for the above.
* test/rubygems/test_gem_commands_sources_command.rb:  ditto.
* test/rubygems/test_gem_dependency_resolver_api_set.rb:  ditto.
* test/rubygems/test_gem_remote_fetcher.rb:  ditto.
* test/rubygems/test_gem_source.rb:  ditto.
* test/rubygems/test_gem_spec_fetcher.rb:  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-28 22:25:55 +00:00

60 lines
1.6 KiB
Ruby

#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
class Gem::Ext::Builder
def self.class_name
name =~ /Ext::(.*)Builder/
$1.downcase
end
def self.make(dest_path, results)
unless File.exist? 'Makefile' then
raise Gem::InstallError, "Makefile not found:\n\n#{results.join "\n"}"
end
# try to find make program from Ruby configure arguments first
RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/
make_program = $1 || ENV['MAKE'] || ENV['make']
unless make_program then
make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
end
['', ' install'].each do |target|
cmd = "#{make_program}#{target}"
run(cmd, results, "make#{target}")
end
end
def self.redirector
'2>&1'
end
def self.run(command, results, command_name = nil)
verbose = Gem.configuration.really_verbose
begin
# TODO use Process.spawn when ruby 1.8 support is dropped.
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], nil
if verbose
puts(command)
system(command)
else
results << command
results << `#{command} #{redirector}`
end
ensure
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
end
unless $?.success? then
results << "Building has failed. See above output for more information on the failure." if verbose
raise Gem::InstallError, "#{command_name || class_name} failed:\n\n#{results.join "\n"}"
end
end
end