method
build_extension
v2_6_3 -
Show latest stable
- Class:
Gem::Ext::Builder
build_extension(extension, dest_path)public
No documentation available.
# File lib/rubygems/ext/builder.rb, line 156
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
# [email protected]+ 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))
lib_dir = File.join @spec.full_gem_path, @spec.raw_require_paths.first
builder = builder_for extension
begin
FileUtils.mkdir_p dest_path
CHDIR_MUTEX.synchronize do
pwd = Dir.getwd
Dir.chdir extension_dir
begin
results = builder.build(extension, dest_path,
results, @build_args, lib_dir)
verbose { results.join("\n") }
ensure
begin
Dir.chdir pwd
rescue SystemCallError
Dir.chdir dest_path
end
end
end
write_gem_make_out results.join "\n"
rescue => e
results << e.message
build_error extension_dir, results.join("\n"), $@
end
end