extmk.rb: check if parent is build

* ext/extmk.rb (extmake): don't build nested libraries if parent
  library isn't build.

* ext/{dl/callback,tk/tkutil}/extconf.rb: no longer need to check
  if the parent is build.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-05-09 05:52:59 +00:00
parent ecb8b52f56
commit 77811031e5
3 changed files with 16 additions and 11 deletions

View File

@ -1,6 +1,6 @@
require 'mkmf' require 'mkmf'
if compiled?("dl") begin
callbacks = (0..8).map{|i| "callback-#{i}"}.unshift("callback") callbacks = (0..8).map{|i| "callback-#{i}"}.unshift("callback")
callback_srcs = callbacks.map{|basename| "#{basename}.c"} callback_srcs = callbacks.map{|basename| "#{basename}.c"}
callback_objs = callbacks.map{|basename| "#{basename}.o"} callback_objs = callbacks.map{|basename| "#{basename}.o"}

View File

@ -141,6 +141,16 @@ def extmake(target)
FileUtils.mkpath target unless File.directory?(target) FileUtils.mkpath target unless File.directory?(target)
begin begin
# don't build if parent library isn't build
parent = true
d = target
until (d = File.dirname(d)) == '.'
if File.exist?("#{$top_srcdir}/ext/#{d}/extconf.rb")
parent = (/^all:\s*install/ =~ IO.read("#{d}/Makefile") rescue false)
break
end
end
dir = Dir.pwd dir = Dir.pwd
FileUtils.mkpath target unless File.directory?(target) FileUtils.mkpath target unless File.directory?(target)
Dir.chdir target Dir.chdir target
@ -161,8 +171,8 @@ def extmake(target)
makefile = "./Makefile" makefile = "./Makefile"
static = $static static = $static
$static = nil if noinstall = File.fnmatch?("-*", target) $static = nil if noinstall = File.fnmatch?("-*", target)
ok = File.exist?(makefile) ok = parent && File.exist?(makefile)
unless $ignore if parent && !$ignore
rbconfig0 = RbConfig::CONFIG rbconfig0 = RbConfig::CONFIG
mkconfig0 = CONFIG mkconfig0 = CONFIG
rbconfig = { rbconfig = {
@ -288,13 +298,15 @@ def extmake(target)
end end
ensure ensure
Logging::log_close Logging::log_close
unless $ignore if rbconfig0
RbConfig.module_eval { RbConfig.module_eval {
remove_const(:CONFIG) remove_const(:CONFIG)
const_set(:CONFIG, rbconfig0) const_set(:CONFIG, rbconfig0)
remove_const(:MAKEFILE_CONFIG) remove_const(:MAKEFILE_CONFIG)
const_set(:MAKEFILE_CONFIG, mkconfig0) const_set(:MAKEFILE_CONFIG, mkconfig0)
} }
end
if mkconfig0
MakeMakefile.class_eval { MakeMakefile.class_eval {
remove_const(:CONFIG) remove_const(:CONFIG)
const_set(:CONFIG, mkconfig0) const_set(:CONFIG, mkconfig0)

View File

@ -1,11 +1,4 @@
begin begin
has_tk = compiled?('tk')
rescue NoMethodError
# Probably, called manually (NOT from 'extmk.rb'). Force to make Makefile.
has_tk = true
end
if has_tk
require 'mkmf' require 'mkmf'
have_func("rb_obj_instance_exec", "ruby.h") have_func("rb_obj_instance_exec", "ruby.h")