1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

gem extensions

* 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
parent 39e3db3510
commit 9839d82d1e
3 changed files with 33 additions and 1 deletions

View file

@ -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> Tue Aug 16 21:04:30 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* common.mk (UNICODE_HDR_DIR): separate unicode header files from * common.mk (UNICODE_HDR_DIR): separate unicode header files from

View file

@ -565,12 +565,24 @@ end
Dir.chdir('..') Dir.chdir('..')
FileUtils::makedirs('gems') FileUtils::makedirs('gems')
FileUtils::makedirs('.ext/gems') FileUtils::makedirs("#$extout/gems")
Dir.chdir('gems') Dir.chdir('gems')
extout = $extout extout = $extout
gems.each do |d| gems.each do |d|
$extout = extout.dup $extout = extout.dup
extmake(d, 'gems') 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 end
$extout = extout $extout = extout
Dir.chdir('../ext') Dir.chdir('../ext')

View file

@ -678,6 +678,9 @@ module RbInstall
def write_cache_file def write_cache_file
end end
def build_extensions
end
end end
end end
@ -750,11 +753,21 @@ install?(:ext, :comm, :gem) do
:wrappers => true, :wrappers => true,
:format_executable => 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| 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) ins = RbInstall::UnpackedInstaller.new(spec, options)
puts "#{" "*30}#{spec.name} #{spec.version}" puts "#{" "*30}#{spec.name} #{spec.version}"
ins.install ins.install
File.chmod($data_mode, File.join(install_dir, "specifications", "#{spec.full_name}.gemspec")) 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 installed_gems[spec.full_name] = true
end end
installed_gems, gems = Dir.glob(srcdir+'/gems/*.gem').partition {|gem| installed_gems.key?(File.basename(gem, '.gem'))} installed_gems, gems = Dir.glob(srcdir+'/gems/*.gem').partition {|gem| installed_gems.key?(File.basename(gem, '.gem'))}