aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/ext
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/ext')
-rw-r--r--lib/rubygems/ext/builder.rb15
-rw-r--r--lib/rubygems/ext/ext_conf_builder.rb2
-rw-r--r--lib/rubygems/ext/rake_builder.rb10
3 files changed, 19 insertions, 8 deletions
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb
index 6382a8f5c7..b3b9033962 100644
--- a/lib/rubygems/ext/builder.rb
+++ b/lib/rubygems/ext/builder.rb
@@ -148,9 +148,21 @@ EOF
def build_extension extension, dest_path # :nodoc:
results = []
+ # FIXME: Determine if this line is necessary and, if so, why.
+ # Notes:
+ # 1. As far as I can tell, this method is only called by +build_extensions+.
+ # 2. The existence of this line implies +extension+ is, or previously was,
+ # sometimes +false+ or +nil+.
+ # 3. #1 and #2 combined suggests, but does not confirm, that
+ # +@specs.extensions+ sometimes contained +false+ or +nil+ values.
+ # 4. Nothing seems to explicitly handle +extension+ being empty,
+ # which makes me wonder both what it should do and what it does.
+ #
+ # - @duckinator
extension ||= '' # I wish I knew why this line existed
+
extension_dir =
- File.expand_path File.join @gem_dir, File.dirname(extension)
+ File.expand_path File.join(@gem_dir, File.dirname(extension))
lib_dir = File.join @spec.full_gem_path, @spec.raw_require_paths.first
builder = builder_for extension
@@ -200,6 +212,7 @@ EOF
FileUtils.rm_f @spec.gem_build_complete_path
+ # FIXME: action at a distance: @ran_rake modified deep in build_extension(). - @duckinator
@ran_rake = false # only run rake once
@spec.extensions.each do |extension|
diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb
index a17881a890..18e300d8c2 100644
--- a/lib/rubygems/ext/ext_conf_builder.rb
+++ b/lib/rubygems/ext/ext_conf_builder.rb
@@ -38,7 +38,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
destdir = ENV["DESTDIR"]
begin
- cmd = [Gem.ruby, "-r", get_relative_path(siteconf.path), File.basename(extension), *args].join ' '
+ cmd = [Gem.ruby, "-I", File.expand_path("../../..", __FILE__), "-r", get_relative_path(siteconf.path), File.basename(extension), *args].join ' '
begin
run cmd, results
diff --git a/lib/rubygems/ext/rake_builder.rb b/lib/rubygems/ext/rake_builder.rb
index 7a5a48c6cc..890803aaef 100644
--- a/lib/rubygems/ext/rake_builder.rb
+++ b/lib/rubygems/ext/rake_builder.rb
@@ -5,6 +5,8 @@
# See LICENSE.txt for permissions.
#++
+require "shellwords"
+
class Gem::Ext::RakeBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil)
@@ -14,9 +16,6 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder
run cmd, results
end
- # Deal with possible spaces in the path, e.g. C:/Program Files
- dest_path = '"' + dest_path.to_s + '"' if dest_path.to_s.include?(' ')
-
rake = ENV['rake']
rake ||= begin
@@ -26,9 +25,8 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder
rake ||= Gem.default_exec_format % 'rake'
- cmd = "#{rake} RUBYARCHDIR=#{dest_path} RUBYLIBDIR=#{dest_path}" # ENV is frozen
-
- run cmd, results
+ rake_args = ["RUBYARCHDIR=#{dest_path}", "RUBYLIBDIR=#{dest_path}", *args]
+ run "#{rake} #{rake_args.shelljoin}", results
results
end