mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
d57e043ab5
* test/mkmf/test_framework.rb (test_single_framework): use Ruby framework, as CoreFoundation framework uses Apple extensions unsupported by standard GCC other than Apple-patched clang. * test/mkmf/test_framework.rb (test_multi_frameworks): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
48 lines
1.4 KiB
Ruby
48 lines
1.4 KiB
Ruby
require_relative 'base'
|
|
|
|
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.gsub!("$@", "#{fwdir}/#{fw}")
|
|
cmd.gsub!(/ -bundle /, ' -dynamiclib ')
|
|
assert(xsystem(cmd), MKMFLOG)
|
|
$INCFLAGS << " " << "-F#{dir}".quote
|
|
yield fw, hdrname
|
|
end
|
|
end
|
|
|
|
def test_single_framework
|
|
assert(have_framework("Ruby"), mkmflog("try as Objective-C"))
|
|
end
|
|
|
|
def test_multi_frameworks
|
|
assert(have_framework("Ruby"), mkmflog("try as Objective-C"))
|
|
create_framework("MkmfTest") do |fw|
|
|
assert(have_framework(fw), MKMFLOG)
|
|
end
|
|
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
|