summaryrefslogtreecommitdiff
path: root/lib/rubygems/ext
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/ext')
-rw-r--r--lib/rubygems/ext/builder.rb14
-rw-r--r--lib/rubygems/ext/cmake_builder.rb3
-rw-r--r--lib/rubygems/ext/configure_builder.rb3
3 files changed, 10 insertions, 10 deletions
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb
index f6de6a50d7..e089b3d57a 100644
--- a/lib/rubygems/ext/builder.rb
+++ b/lib/rubygems/ext/builder.rb
@@ -29,7 +29,7 @@ class Gem::Ext::Builder
make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
end
- destdir = '"DESTDIR=%s"' % ENV['DESTDIR']
+ destdir = 'DESTDIR=%s' % ENV['DESTDIR']
['clean', '', 'install'].each do |target|
# Pass DESTDIR via command line to override what's in MAKEFLAGS
@@ -37,7 +37,7 @@ class Gem::Ext::Builder
make_program,
destdir,
target,
- ].join(' ').rstrip
+ ].reject(&:empty?)
begin
run(cmd, results, "make #{target}".rstrip, make_dir)
rescue Gem::InstallError
@@ -56,19 +56,21 @@ class Gem::Ext::Builder
p(command)
end
results << "current directory: #{dir}"
- results << (command.respond_to?(:shelljoin) ? command.shelljoin : command)
+ results << command.shelljoin
require "open3"
# Set $SOURCE_DATE_EPOCH for the subprocess.
env = {'SOURCE_DATE_EPOCH' => Gem.source_date_epoch_string}
- output, status = Open3.capture2e(env, *command, :chdir => dir)
+ output, status = begin
+ Open3.capture2e(env, *command, :chdir => dir)
+ rescue => error
+ raise Gem::InstallError, "#{command_name || class_name} failed#{error.message}"
+ end
if verbose
puts output
else
results << output
end
- rescue => error
- raise Gem::InstallError, "#{command_name || class_name} failed#{error.message}"
ensure
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
end
diff --git a/lib/rubygems/ext/cmake_builder.rb b/lib/rubygems/ext/cmake_builder.rb
index 2efec91f15..269e876cfa 100644
--- a/lib/rubygems/ext/cmake_builder.rb
+++ b/lib/rubygems/ext/cmake_builder.rb
@@ -4,8 +4,7 @@ require_relative '../command'
class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, cmake_dir=Dir.pwd)
unless File.exist?(File.join(cmake_dir, 'Makefile'))
- cmd = "cmake . -DCMAKE_INSTALL_PREFIX=#{dest_path}"
- cmd << " #{Gem::Command.build_args.join ' '}" unless Gem::Command.build_args.empty?
+ cmd = ["cmake", ".", "-DCMAKE_INSTALL_PREFIX=#{dest_path}", *Gem::Command.build_args]
run cmd, results, class_name, cmake_dir
end
diff --git a/lib/rubygems/ext/configure_builder.rb b/lib/rubygems/ext/configure_builder.rb
index 36a758989b..eb2f9fce61 100644
--- a/lib/rubygems/ext/configure_builder.rb
+++ b/lib/rubygems/ext/configure_builder.rb
@@ -8,8 +8,7 @@
class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, configure_dir=Dir.pwd)
unless File.exist?(File.join(configure_dir, 'Makefile'))
- cmd = "sh ./configure --prefix=#{dest_path}"
- cmd << " #{args.join ' '}" unless args.empty?
+ cmd = ["sh", "./configure", "--prefix=#{dest_path}", *args]
run cmd, results, class_name, configure_dir
end