mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
tk/extconf.rb: refactor
* ext/tk/extconf.rb (collect_tcltk_defs): split by -D at the beginning or preceded by a space. exclude empty strings from $defs. * ext/tk/extconf.rb: test if value is set and has non-blank by matching /\S/ at once. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e83922a3ce
commit
931581469f
1 changed files with 13 additions and 20 deletions
|
@ -371,7 +371,7 @@ def collect_tcltk_defs(tcl_defs_str, tk_defs_str)
|
||||||
end
|
end
|
||||||
|
|
||||||
if tcl_defs_str
|
if tcl_defs_str
|
||||||
tcl_defs = tcl_defs_str.split(/ ?-D/).map{|s|
|
tcl_defs = tcl_defs_str.split(/(?:\A|\s)\s*-D/).map{|s|
|
||||||
s =~ /^([^=]+)(.*)$/
|
s =~ /^([^=]+)(.*)$/
|
||||||
[$1, $2]
|
[$1, $2]
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ def collect_tcltk_defs(tcl_defs_str, tk_defs_str)
|
||||||
end
|
end
|
||||||
|
|
||||||
if tk_defs_str
|
if tk_defs_str
|
||||||
tk_defs = tk_defs_str.split(/ ?-D/).map{|s|
|
tk_defs = tk_defs_str.split(/(?:\A|\s)\s*-D/).map{|s|
|
||||||
s =~ /^([^=]+)(.*)$/
|
s =~ /^([^=]+)(.*)$/
|
||||||
[$1, $2]
|
[$1, $2]
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ def collect_tcltk_defs(tcl_defs_str, tk_defs_str)
|
||||||
vtcl != vtk )
|
vtcl != vtk )
|
||||||
}
|
}
|
||||||
|
|
||||||
defs.map{|ary| s = ary.join(''); (s.strip.empty?)? "": "-D" << s}
|
defs.map{|ary| /\S/ =~ (s = ary.join('')) and "-D" << s.strip}.compact
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_tclConfig(file)
|
def parse_tclConfig(file)
|
||||||
|
@ -1609,9 +1609,8 @@ def search_X_libraries
|
||||||
use_tkConfig = false
|
use_tkConfig = false
|
||||||
if TkConfig_Info['config_file_path']
|
if TkConfig_Info['config_file_path']
|
||||||
# use definitions on tkConfig.sh
|
# use definitions on tkConfig.sh
|
||||||
if (TkConfig_Info['TK_XINCLUDES'] &&
|
if (/\S/ =~ TkConfig_Info['TK_XINCLUDES'] ||
|
||||||
!TkConfig_Info['TK_XINCLUDES'].strip.empty?) ||
|
/\S/ =~ TkConfig_Info['TK_XLIBSW'])
|
||||||
(TkConfig_Info['TK_XLIBSW'] && !TkConfig_Info['TK_XLIBSW'].strip.empty?)
|
|
||||||
use_tkConfig = true
|
use_tkConfig = true
|
||||||
#use_X = true && with_config("X11", ! is_win32?)
|
#use_X = true && with_config("X11", ! is_win32?)
|
||||||
use_X = with_config("X11", true)
|
use_X = with_config("X11", true)
|
||||||
|
@ -1624,8 +1623,7 @@ def search_X_libraries
|
||||||
use_X = with_config("X11", !(is_win32? || TkLib_Config["tcltk-framework"]))
|
use_X = with_config("X11", !(is_win32? || TkLib_Config["tcltk-framework"]))
|
||||||
end
|
end
|
||||||
|
|
||||||
if TkConfig_Info['TK_XINCLUDES'] &&
|
if /\S/ =~ TkConfig_Info['TK_XINCLUDES']
|
||||||
!TkConfig_Info['TK_XINCLUDES'].strip.empty?
|
|
||||||
($INCFLAGS ||= "") << " " << TkConfig_Info['TK_XINCLUDES'].strip
|
($INCFLAGS ||= "") << " " << TkConfig_Info['TK_XINCLUDES'].strip
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1636,7 +1634,7 @@ def search_X_libraries
|
||||||
unless find_X11(x11_ldir2, x11_ldir)
|
unless find_X11(x11_ldir2, x11_ldir)
|
||||||
puts("Can't find X11 libraries. ")
|
puts("Can't find X11 libraries. ")
|
||||||
if use_tkConfig &&
|
if use_tkConfig &&
|
||||||
TkConfig_Info['TK_XLIBSW'] && !TkConfig_Info['TK_XLIBSW'].strip.empty?
|
/\S/ =~ TkConfig_Info['TK_XLIBSW']
|
||||||
puts("But, try to use TK_XLIBSW information (believe tkConfig.sh).")
|
puts("But, try to use TK_XLIBSW information (believe tkConfig.sh).")
|
||||||
($libs ||= "") << " " << TkConfig_Info['TK_XLIBSW'] << " "
|
($libs ||= "") << " " << TkConfig_Info['TK_XLIBSW'] << " "
|
||||||
else
|
else
|
||||||
|
@ -1919,9 +1917,8 @@ TkLib_Config["space-on-tk-libpath"] =
|
||||||
|
|
||||||
# enable Tcl/Tk stubs?
|
# enable Tcl/Tk stubs?
|
||||||
=begin
|
=begin
|
||||||
if TclConfig_Info['TCL_STUB_LIB_SPEC'] && TkConfig_Info['TK_STUB_LIB_SPEC'] &&
|
if /\S/ =~ TclConfig_Info['TCL_STUB_LIB_SPEC'] &&
|
||||||
!TclConfig_Info['TCL_STUB_LIB_SPEC'].strip.empty? &&
|
/\S/ =~ TkConfig_Info['TK_STUB_LIB_SPEC']
|
||||||
!TkConfig_Info['TK_STUB_LIB_SPEC'].strip.empty?
|
|
||||||
stubs = true
|
stubs = true
|
||||||
unless (st = enable_config("tcltk-stubs")).nil?
|
unless (st = enable_config("tcltk-stubs")).nil?
|
||||||
stubs &&= st
|
stubs &&= st
|
||||||
|
@ -2027,16 +2024,14 @@ if TkLib_Config["tcltk-framework"]
|
||||||
libs << ' ' << TclConfig_Info['TCL_LIBS']
|
libs << ' ' << TclConfig_Info['TCL_LIBS']
|
||||||
if stubs
|
if stubs
|
||||||
if TkLib_Config["tcl-build-dir"] &&
|
if TkLib_Config["tcl-build-dir"] &&
|
||||||
TclConfig_Info['TCL_BUILD_STUB_LIB_SPEC'] &&
|
/\S/ =~ TclConfig_Info['TCL_BUILD_STUB_LIB_SPEC']
|
||||||
!TclConfig_Info['TCL_BUILD_STUB_LIB_SPEC'].strip.empty?
|
|
||||||
libs << ' ' << TclConfig_Info['TCL_BUILD_STUB_LIB_SPEC']
|
libs << ' ' << TclConfig_Info['TCL_BUILD_STUB_LIB_SPEC']
|
||||||
else
|
else
|
||||||
libs << ' ' << TclConfig_Info['TCL_STUB_LIB_SPEC']
|
libs << ' ' << TclConfig_Info['TCL_STUB_LIB_SPEC']
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if TkLib_Config["tcl-build-dir"] &&
|
if TkLib_Config["tcl-build-dir"] &&
|
||||||
TclConfig_Info['TCL_BUILD_LIB_SPEC'] &&
|
/\S/ =~ TclConfig_Info['TCL_BUILD_LIB_SPEC']
|
||||||
!TclConfig_Info['TCL_BUILD_LIB_SPEC'].strip.empty?
|
|
||||||
libs << ' ' << TclConfig_Info['TCL_BUILD_LIB_SPEC']
|
libs << ' ' << TclConfig_Info['TCL_BUILD_LIB_SPEC']
|
||||||
else
|
else
|
||||||
libs << ' ' << TclConfig_Info['TCL_LIB_SPEC']
|
libs << ' ' << TclConfig_Info['TCL_LIB_SPEC']
|
||||||
|
@ -2052,16 +2047,14 @@ if TkLib_Config["tcltk-framework"]
|
||||||
libs << ' ' << TkConfig_Info['TK_LIBS']
|
libs << ' ' << TkConfig_Info['TK_LIBS']
|
||||||
if stubs
|
if stubs
|
||||||
if TkLib_Config["tk-build-dir"] &&
|
if TkLib_Config["tk-build-dir"] &&
|
||||||
TclConfig_Info['TK_BUILD_STUB_LIB_SPEC'] &&
|
/\S/ =~ TclConfig_Info['TK_BUILD_STUB_LIB_SPEC']
|
||||||
!TclConfig_Info['TK_BUILD_STUB_LIB_SPEC'].strip.empty?
|
|
||||||
libs << ' ' << TkConfig_Info['TK_BUILD_STUB_LIB_SPEC']
|
libs << ' ' << TkConfig_Info['TK_BUILD_STUB_LIB_SPEC']
|
||||||
else
|
else
|
||||||
libs << ' ' << TkConfig_Info['TK_STUB_LIB_SPEC']
|
libs << ' ' << TkConfig_Info['TK_STUB_LIB_SPEC']
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if TkLib_Config["tk-build-dir"] &&
|
if TkLib_Config["tk-build-dir"] &&
|
||||||
TclConfig_Info['TK_BUILD_LIB_SPEC'] &&
|
/\S/ =~ TclConfig_Info['TK_BUILD_LIB_SPEC']
|
||||||
!TclConfig_Info['TK_BUILD_LIB_SPEC'].strip.empty?
|
|
||||||
libs << ' ' << TkConfig_Info['TK_BUILD_LIB_SPEC']
|
libs << ' ' << TkConfig_Info['TK_BUILD_LIB_SPEC']
|
||||||
else
|
else
|
||||||
libs << ' ' << TkConfig_Info['TK_LIB_SPEC']
|
libs << ' ' << TkConfig_Info['TK_LIB_SPEC']
|
||||||
|
|
Loading…
Add table
Reference in a new issue