Skip to content

Commit 4d2e7bf

Browse files
committed
Fixing regex
1 parent af1d9fa commit 4d2e7bf

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

ext/tk/extconf.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ def libcheck_for_tclConfig(tcldir, tkdir, tclconf, tkconf)
618618
tk_regexp = /^.*(tk#{stub}#{tkver}.*)\.(#{exts}).*$/
619619
elsif tkconf
620620
tk_glob = "*tk#{stub}#{tkconf['TK_MAJOR_VERSION']}{.,}#{tkconf['TK_MINOR_VERSION']}*.*"
621-
tk_regexp = /^.*(tk#{stub}#{tkconf['TK_MAJOR_VERSION']}(?:\.|)#{tkconf['TK_MINOR_VERSION']}.*)\.#{exts}.*$/
621+
tk_regexp = /^(?:.*(tcl#{tclconf['TCL_MAJOR_VERSION']})|.*)(tk#{stub}#{tkconf['TK_MAJOR_VERSION']}(?:\.|)#{tkconf['TK_MINOR_VERSION']}.*)\.#{exts}.*$/
622622
end
623623

624624
tcllib_ok ||= !tclconf || Dir.glob(File.join(tcldir, tcl_glob), File::FNM_CASEFOLD).find{|file|
@@ -667,8 +667,8 @@ def libcheck_for_tclConfig(tcldir, tkdir, tclconf, tkconf)
667667

668668
tklib_ok ||= !tkconf || Dir.glob(File.join(tkdir, tk_glob), File::FNM_CASEFOLD).find{|file|
669669
if file =~ tk_regexp
670-
libname = $1
671-
ext = $2.downcase
670+
libname = ($1 || "") + $2
671+
ext = $3.downcase
672672
begin
673673
#puts "check #{file} #{$1} #{tkfunc} #{tkdir}"
674674
# find_library($1, tkfunc, tkdir)
@@ -680,9 +680,8 @@ def libcheck_for_tclConfig(tcldir, tkdir, tclconf, tkconf)
680680
# FIX ME: avoid pathname trouble (fail to find) on MinGW.
681681
$INCFLAGS << " -I" << File.join(File.dirname(File.dirname(file)),"include") if is_win32?
682682
else
683-
# tklibs = append_library("", libname)
683+
tklibs = append_library("", libname)
684684
# there is no tk9.0 in Mac OS after Tcl/Tk 9.0
685-
tklibs = append_library("", "tcl9tk9.0")
686685
#tklibs = append_library("", $1)
687686
tklibs = "#{libpathflag([tkdir])} #{tklibs}"
688687

0 commit comments

Comments
 (0)