ruby-changes:30305
From: nagachika <ko1@a...>
Date: Sat, 3 Aug 2013 22:44:44 +0900 (JST)
Subject: [ruby-changes:30305] nagachika:r42357 (ruby_2_0_0): merge revision(s) 41777,41779: [Backport #8593]
nagachika 2013-08-03 22:44:30 +0900 (Sat, 03 Aug 2013) New Revision: 42357 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42357 Log: merge revision(s) 41777,41779: [Backport #8593] * lib/mkmf.rb (have_framework): allow header file to check. [ruby-core:55745] [Bug #8593] Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/lib/mkmf.rb branches/ruby_2_0_0/test/mkmf/test_framework.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 42356) +++ ruby_2_0_0/ChangeLog (revision 42357) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Sat Aug 3 22:40:57 2013 Nobuyoshi Nakada <nobu@r...> + + * lib/mkmf.rb (have_framework): allow header file to check. + [ruby-core:55745] [Bug #8593] + Sat Aug 3 22:24:44 2013 Shota Fukumori <her@s...> * lib/uri/common.rb (URI.decode_www_form_component): Index: ruby_2_0_0/lib/mkmf.rb =================================================================== --- ruby_2_0_0/lib/mkmf.rb (revision 42356) +++ ruby_2_0_0/lib/mkmf.rb (revision 42357) @@ -1054,9 +1054,17 @@ SRC https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/mkmf.rb#L1054 # the +HAVE_FRAMEWORK_RUBY+ preprocessor macro would be passed to the # compiler. # + # If +fw+ is a pair of the framework name and its header file name + # that header file is checked, instead of the normally used header + # file which is named same as the framework. def have_framework(fw, &b) + if Array === fw + fw, header = *fw + else + header = "#{fw}.h" + end checking_for fw do - src = cpp_include("#{fw}/#{fw}.h") << "\n" "int main(void){return 0;}" + src = cpp_include("#{fw}/#{header}") << "\n" "int main(void){return 0;}" opt = " -framework #{fw}" if try_link(src, "-ObjC#{opt}", &b) $defs.push(format("-DHAVE_FRAMEWORK_%s", fw.tr_cpp)) Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 42356) +++ ruby_2_0_0/version.h (revision 42357) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-08-03" -#define RUBY_PATCHLEVEL 285 +#define RUBY_PATCHLEVEL 286 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_0_0/test/mkmf/test_framework.rb =================================================================== --- ruby_2_0_0/test/mkmf/test_framework.rb (revision 42356) +++ ruby_2_0_0/test/mkmf/test_framework.rb (revision 42357) @@ -2,6 +2,24 @@ require_relative 'base' https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/mkmf/test_framework.rb#L2 class TestMkmf class TestHaveFramework < TestMkmf + def create_framework(fw, hdrname = "#{fw}.h") + Dir.mktmpdir("frameworks") do |dir| + fwdir = "#{dir}/#{fw}.framework" + hdrdir = "#{fwdir}/Headers" + FileUtils.mkdir_p(hdrdir) + File.write("#{hdrdir}/#{hdrname}", "") + src = "#{fwdir}/main.c" + File.write(src, "void #{fw}(void) {}") + cmd = LINK_SO.dup + RbConfig.expand(cmd, RbConfig::CONFIG.merge("OBJS"=>src)) + cmd.sub!("$@", "#{fwdir}/#{fw}") + cmd.sub!(/ -bundle /, ' -dynamiclib ') + assert(xsystem(cmd), MKMFLOG) + $INCFLAGS << " " << "-F#{dir}".quote + yield fw, hdrname + end + end + def test_core_foundation_framework assert(have_framework("CoreFoundation"), mkmflog("try as Objective-C")) end @@ -10,5 +28,19 @@ class TestMkmf https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/mkmf/test_framework.rb#L28 assert(have_framework("CoreFoundation"), mkmflog("try as Objective-C")) assert(have_framework("Cocoa"), mkmflog("try as Objective-C")) end + + def test_empty_framework + create_framework("MkmfTest") do |fw| + assert(have_framework(fw), MKMFLOG) + end + end + + def test_different_name_header + bug8593 = '[ruby-core:55745] [Bug #8593]' + create_framework("MkmfTest", "test_mkmf.h") do |fw, hdrname| + assert(!have_framework(fw), MKMFLOG) + assert(have_framework([fw, hdrname]), MKMFLOG) + end + end end end if /darwin/ =~ RUBY_PLATFORM Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r41777,41779 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/