[前][次][番号順一覧][スレッド一覧]

ruby-changes:33806

From: nobu <ko1@a...>
Date: Fri, 9 May 2014 14:53:06 +0900 (JST)
Subject: [ruby-changes:33806] nobu:r45887 (trunk): extmk.rb: check if parent is build

nobu	2014-05-09 14:52:59 +0900 (Fri, 09 May 2014)

  New Revision: 45887

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45887

  Log:
    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.

  Modified files:
    trunk/ext/dl/callback/extconf.rb
    trunk/ext/extmk.rb
    trunk/ext/tk/tkutil/extconf.rb
Index: ext/dl/callback/extconf.rb
===================================================================
--- ext/dl/callback/extconf.rb	(revision 45886)
+++ ext/dl/callback/extconf.rb	(revision 45887)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ext/dl/callback/extconf.rb#L1
 require 'mkmf'
 
-if compiled?("dl")
+begin
   callbacks = (0..8).map{|i| "callback-#{i}"}.unshift("callback")
   callback_srcs = callbacks.map{|basename| "#{basename}.c"}
   callback_objs = callbacks.map{|basename| "#{basename}.o"}
Index: ext/tk/tkutil/extconf.rb
===================================================================
--- ext/tk/tkutil/extconf.rb	(revision 45886)
+++ ext/tk/tkutil/extconf.rb	(revision 45887)
@@ -1,11 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/extconf.rb#L1
 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'
 
   have_func("rb_obj_instance_exec", "ruby.h")
Index: ext/extmk.rb
===================================================================
--- ext/extmk.rb	(revision 45886)
+++ ext/extmk.rb	(revision 45887)
@@ -141,6 +141,16 @@ def extmake(target) https://github.com/ruby/ruby/blob/trunk/ext/extmk.rb#L141
 
   FileUtils.mkpath target unless File.directory?(target)
   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
     FileUtils.mkpath target unless File.directory?(target)
     Dir.chdir target
@@ -161,8 +171,8 @@ def extmake(target) https://github.com/ruby/ruby/blob/trunk/ext/extmk.rb#L171
     makefile = "./Makefile"
     static = $static
     $static = nil if noinstall = File.fnmatch?("-*", target)
-    ok = File.exist?(makefile)
-    unless $ignore
+    ok = parent && File.exist?(makefile)
+    if parent && !$ignore
       rbconfig0 = RbConfig::CONFIG
       mkconfig0 = CONFIG
       rbconfig = {
@@ -288,13 +298,15 @@ def extmake(target) https://github.com/ruby/ruby/blob/trunk/ext/extmk.rb#L298
     end
   ensure
     Logging::log_close
-    unless $ignore
+    if rbconfig0
       RbConfig.module_eval {
 	remove_const(:CONFIG)
 	const_set(:CONFIG, rbconfig0)
 	remove_const(:MAKEFILE_CONFIG)
 	const_set(:MAKEFILE_CONFIG, mkconfig0)
       }
+    end
+    if mkconfig0
       MakeMakefile.class_eval {
 	remove_const(:CONFIG)
 	const_set(:CONFIG, mkconfig0)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]