mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
mkmf.rb: fix splitting options with an argument
* ext/extmk.rb (extmake), lib/mkmf.rb (have_framework): fix splitting options with an argument, not using NUL as special character. [ruby-core:47447] [Bug #6987] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
977bec1236
commit
d0d68df7d0
5 changed files with 20 additions and 6 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Fri Sep 7 01:21:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/extmk.rb (extmake), lib/mkmf.rb (have_framework): fix splitting
|
||||||
|
options with an argument, not using NUL as special character.
|
||||||
|
[ruby-core:47447] [Bug #6987]
|
||||||
|
|
||||||
Thu Sep 6 14:49:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Sep 6 14:49:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* .gdbinit (rp): FLONUM support.
|
* .gdbinit (rp): FLONUM support.
|
||||||
|
|
|
@ -258,9 +258,9 @@ def extmake(target)
|
||||||
$extlibs ||= []
|
$extlibs ||= []
|
||||||
$extpath ||= []
|
$extpath ||= []
|
||||||
unless $mswin
|
unless $mswin
|
||||||
$extflags = ($extflags.split | $DLDFLAGS.split | $LDFLAGS.split).join(" ")
|
$extflags = split_libs($extflags, $DLDFLAGS, $LDFLAGS).uniq.join(" ")
|
||||||
end
|
end
|
||||||
$extlibs = merge_libs($extlibs, $libs.split(/\s+(?=-|\z)/), $LOCAL_LIBS.split(/\s+(?=-|\z)/))
|
$extlibs = merge_libs($extlibs, split_libs($libs), split_libs($LOCAL_LIBS))
|
||||||
$extpath |= $LIBPATH
|
$extpath |= $LIBPATH
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
|
|
|
@ -1995,7 +1995,7 @@ if TkLib_Config["tcltk-framework"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
$LDFLAGS << ' ' << libs.gsub(/((?:\A|\s)-framework)\s/, "\\1\0")
|
$LDFLAGS << ' ' << libs
|
||||||
$libs << ' -ltk -ltcl'
|
$libs << ' -ltk -ltcl'
|
||||||
setup_for_macosx_framework(tclver, tkver) if tcl_cfg_dir && tk_cfg_dir
|
setup_for_macosx_framework(tclver, tkver) if tcl_cfg_dir && tk_cfg_dir
|
||||||
end
|
end
|
||||||
|
|
|
@ -234,6 +234,10 @@ module MakeMakefile
|
||||||
t if times.all? {|n| n <= t}
|
t if times.all? {|n| n <= t}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def split_libs(*strs)
|
||||||
|
strs.map {|s| s.split(/\s+(?=-|\z)/)}.flatten
|
||||||
|
end
|
||||||
|
|
||||||
def merge_libs(*libs)
|
def merge_libs(*libs)
|
||||||
libs.inject([]) do |x, y|
|
libs.inject([]) do |x, y|
|
||||||
xy = x & y
|
xy = x & y
|
||||||
|
@ -1018,11 +1022,10 @@ SRC
|
||||||
def have_framework(fw, &b)
|
def have_framework(fw, &b)
|
||||||
checking_for fw do
|
checking_for fw do
|
||||||
src = cpp_include("#{fw}/#{fw}.h") << "\n" "int main(void){return 0;}"
|
src = cpp_include("#{fw}/#{fw}.h") << "\n" "int main(void){return 0;}"
|
||||||
if try_link(src, "-ObjC -framework #{fw}", &b)
|
if try_link(src, opt = "-ObjC -framework #{fw}", &b)
|
||||||
$defs.push(format("-DHAVE_FRAMEWORK_%s", fw.tr_cpp))
|
$defs.push(format("-DHAVE_FRAMEWORK_%s", fw.tr_cpp))
|
||||||
# TODO: non-worse way than this hack, to get rid of separating
|
# TODO: non-worse way than this hack, to get rid of separating
|
||||||
# option and its argument.
|
# option and its argument.
|
||||||
opt = " -ObjC -framework\0#{fw}"
|
|
||||||
$LDFLAGS << opt
|
$LDFLAGS << opt
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
|
@ -1804,7 +1807,7 @@ INCFLAGS = -I. #$INCFLAGS
|
||||||
DEFS = #{CONFIG['DEFS']}
|
DEFS = #{CONFIG['DEFS']}
|
||||||
CPPFLAGS = #{extconf_h}#{$CPPFLAGS}
|
CPPFLAGS = #{extconf_h}#{$CPPFLAGS}
|
||||||
CXXFLAGS = $(CFLAGS) #{CONFIG['CXXFLAGS']}
|
CXXFLAGS = $(CFLAGS) #{CONFIG['CXXFLAGS']}
|
||||||
ldflags = #{$LDFLAGS.tr("\0", " ")}
|
ldflags = #{$LDFLAGS}
|
||||||
dldflags = #{$DLDFLAGS} #{CONFIG['EXTDLDFLAGS']}
|
dldflags = #{$DLDFLAGS} #{CONFIG['EXTDLDFLAGS']}
|
||||||
ARCH_FLAG = #{$ARCH_FLAG}
|
ARCH_FLAG = #{$ARCH_FLAG}
|
||||||
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
||||||
|
|
|
@ -5,5 +5,10 @@ class TestMkmf
|
||||||
def test_core_foundation_framework
|
def test_core_foundation_framework
|
||||||
assert(have_framework("CoreFoundation"), mkmflog("try as Objective-C"))
|
assert(have_framework("CoreFoundation"), mkmflog("try as Objective-C"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_multi_frameworks
|
||||||
|
assert(have_framework("CoreFoundation"), mkmflog("try as Objective-C"))
|
||||||
|
assert(have_framework("Cocoa"), mkmflog("try as Objective-C"))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end if /darwin/ =~ RUBY_PLATFORM
|
end if /darwin/ =~ RUBY_PLATFORM
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue