* ext/extmk.rb: build gem extensions into separate directories
* tool/rbinstall.rb: install pre-built gem extension files gem
  extension directories.  [ruby-core:76931] [Bug #12681]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-08-17 14:14:44 +00:00
Родитель 39e3db3510
Коммит 9839d82d1e
3 изменённых файлов: 33 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Wed Aug 17 23:14:42 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/extmk.rb: build gem extensions into separate directories
* tool/rbinstall.rb: install pre-built gem extension files gem
extension directories. [ruby-core:76931] [Bug #12681]
Tue Aug 16 21:04:30 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* common.mk (UNICODE_HDR_DIR): separate unicode header files from

Просмотреть файл

@ -565,12 +565,24 @@ end
Dir.chdir('..')
FileUtils::makedirs('gems')
FileUtils::makedirs('.ext/gems')
FileUtils::makedirs("#$extout/gems")
Dir.chdir('gems')
extout = $extout
gems.each do |d|
$extout = extout.dup
extmake(d, 'gems')
open("#{d}/Makefile", "r+b") do |f|
mf = f.read
f.rewind
mf.sub!(/^RUBYARCHDIR *= *(\$\(extout\))\/(\$\(arch\))(.*)/) {
"TARGET_SO_DIR = #$1/gems/#$2/#{d[%r{\A[^/]+}]}#$3\n" \
"TARGET_SO_TIME = .gems.-.arch.-.#{d[/\A[^\/]+/]}.time"
}
mf.gsub!(/\bRUBYARCHDIR\b/, 'TARGET_SO_DIR')
mf.gsub!(/\.TARGET_SO_DIR\.time/, '$(TARGET_SO_TIME)')
f.write(mf)
f.truncate(f.pos)
end
end
$extout = extout
Dir.chdir('../ext')

Просмотреть файл

@ -678,6 +678,9 @@ module RbInstall
def write_cache_file
end
def build_extensions
end
end
end
@ -750,11 +753,21 @@ install?(:ext, :comm, :gem) do
:wrappers => true,
:format_executable => true,
}
gem_ext_dir = "#$extout/gems/#{CONFIG['arch']}"
extensions_dir = Gem::StubSpecification.gemspec_stub("", gem_dir, gem_dir).extensions_dir
Gem::Specification.each_spec([srcdir+'/gems/*']) do |spec|
spec.extension_dir = "#{extensions_dir}/#{spec.full_name}"
if File.directory?(ext = "#{gem_ext_dir}/#{spec.full_name}")
spec.extensions[0] ||= "-"
end
ins = RbInstall::UnpackedInstaller.new(spec, options)
puts "#{" "*30}#{spec.name} #{spec.version}"
ins.install
File.chmod($data_mode, File.join(install_dir, "specifications", "#{spec.full_name}.gemspec"))
unless spec.extensions.empty?
install_recursive(ext, spec.extension_dir)
open_for_install(spec.gem_build_complete_path, $data_mode) {""}
end
installed_gems[spec.full_name] = true
end
installed_gems, gems = Dir.glob(srcdir+'/gems/*.gem').partition {|gem| installed_gems.key?(File.basename(gem, '.gem'))}