aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/ext/builder.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/ext/builder.rb')
-rw-r--r--lib/rubygems/ext/builder.rb26
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb
index 5e518962ce..e0e7387d9c 100644
--- a/lib/rubygems/ext/builder.rb
+++ b/lib/rubygems/ext/builder.rb
@@ -16,7 +16,7 @@ class Gem::Ext::Builder
raise Gem::InstallError, "Makefile not found:\n\n#{results.join "\n"}"
end
- mf = File.read('Makefile')
+ mf = Gem.read_binary 'Makefile'
mf = mf.gsub(/^RUBYARCHDIR\s*=\s*\$[^$]*/, "RUBYARCHDIR = #{dest_path}")
mf = mf.gsub(/^RUBYLIBDIR\s*=\s*\$[^$]*/, "RUBYLIBDIR = #{dest_path}")
@@ -24,18 +24,14 @@ class Gem::Ext::Builder
# try to find make program from Ruby configure arguments first
RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/
- make_program = $1 || ENV['make']
+ 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}"
- results << cmd
- results << `#{cmd} #{redirector}`
-
- raise Gem::InstallError, "make#{target} failed:\n\n#{results}" unless
- $?.success?
+ run(cmd, results, "make#{target}")
end
end
@@ -43,12 +39,20 @@ class Gem::Ext::Builder
'2>&1'
end
- def self.run(command, results)
- results << command
- results << `#{command} #{redirector}`
+ def self.run(command, results, command_name = nil)
+ verbose = Gem.configuration.really_verbose
+
+ if verbose
+ puts(command)
+ system(command)
+ else
+ results << command
+ results << `#{command} #{redirector}`
+ end
unless $?.success? then
- raise Gem::InstallError, "#{class_name} failed:\n\n#{results.join "\n"}"
+ 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