From 2c4153e78f408d3f70af771b5654179d0e7dcb4e Mon Sep 17 00:00:00 2001 From: nagai Date: Thu, 16 Jul 2009 14:34:09 +0000 Subject: * ext/tk/extconf.rb,ext/tk/config_list.in: ignore paths which includes white space characters on Windows.[ruby-dev:38794] * ext/tk/lib/tk.rb: works on Cygwin (limitation:: Tk.mainloop works on the main thread only). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/tk/config_list.in | 3 ++- ext/tk/extconf.rb | 70 ++++++++++++++++++++++++++++++++++++++++----------- ext/tk/lib/tk.rb | 7 ++++-- 3 files changed, 63 insertions(+), 17 deletions(-) (limited to 'ext/tk') diff --git a/ext/tk/config_list.in b/ext/tk/config_list.in index ba0a963bb..5ddd11c6b 100644 --- a/ext/tk/config_list.in +++ b/ext/tk/config_list.in @@ -1,6 +1,6 @@ ############################################## # configure options for Ruby/Tk -# release date: 2009-07-12 +# release date: 2009-07-15 ############################################## with tk-old-extconf with ActiveTcl @@ -33,3 +33,4 @@ with X11-lib enable pthread enable tcl-thread with tclConfig-file +enable space-on-tk-libpath diff --git a/ext/tk/extconf.rb b/ext/tk/extconf.rb index 193e41b2d..6a9befd12 100644 --- a/ext/tk/extconf.rb +++ b/ext/tk/extconf.rb @@ -1,6 +1,6 @@ ############################################################## # extconf.rb for tcltklib -# release date: 2009-07-12 +# release date: 2009-07-15 ############################################################## require 'mkmf' @@ -214,6 +214,11 @@ def get_shlib_path_head } end + unless TkLib_Config["space-on-tk-libpath"] + path_head.delete_if{|path| path =~ / /} + path_dirs.delete_if{|path| path =~ / /} + end + [path_head, path_dirs] end @@ -418,6 +423,10 @@ def search_tclConfig(*paths) # list of lib-dir or [tcl-libdir, tk-libdir] dirs << File.expand_path(File.join(dir, '..')) } + unless TkLib_Config["space-on-tk-libpath"] + dirs.delete_if{|path| path =~ / /} + end + config_dir.concat(dirs.zip(dirs)) elsif framework = find_macosx_framework() @@ -627,7 +636,14 @@ def check_shlib_search_path(paths) path_list = check_NG_path(path_list) - path_list.each{|path| $LIBPATH |= [path.strip] } + if is_win32? + # exist-dir only + path_list.each{|path| + path = path.strip; $LIBPATH |= [path] if File.directory?(path) + } + else + path_list.each{|path| $LIBPATH |= [path.strip] } + end end def find_tcl(tcllib, stubs, version, *opt_paths) @@ -646,6 +662,10 @@ def find_tcl(tcllib, stubs, version, *opt_paths) "/Tcl/lib", "/Program Files/Tcl/lib" ].find_all{|dir| File.directory?(dir)} + unless TkLib_Config["space-on-tk-libpath"] + default_paths.delete_if{|path| path =~ / /} + end + if (paths = opt_paths.compact).empty? if TclConfig_Info['config_file_path'] # use definisions on tclConfig.sh @@ -654,9 +674,11 @@ def find_tcl(tcllib, stubs, version, *opt_paths) unless stubs #*** Probably, TCL_LIBS is a subset of TK_LIBS. *** - # $LDFLAGS << ' ' << TclConfig_Info['TCL_LIBS'] - # $DLDFLAGS << ' ' << TclConfig_Info['TCL_LIBS'] - $LDFLAGS << ' ' << TclConfig_Info['TCL_LIB_SPEC'] + unless is_win32? # ignore tclConfig on Windows + # $LDFLAGS << ' ' << TclConfig_Info['TCL_LIBS'] + # $DLDFLAGS << ' ' << TclConfig_Info['TCL_LIBS'] + $LDFLAGS << ' ' << TclConfig_Info['TCL_LIB_SPEC'] + end return true end @@ -666,9 +688,11 @@ def find_tcl(tcllib, stubs, version, *opt_paths) return false else #*** Probably, TCL_LIBS is a subset of TK_LIBS. *** - # $LDFLAGS << ' ' << TclConfig_Info['TCL_LIBS'] - # $DLDFLAGS << ' ' << TclConfig_Info['TCL_LIBS'] - $LDFLAGS << ' ' << TclConfig_Info['TCL_STUB_LIB_SPEC'] + unless is_win32? # ignore tclConfig on Windows + # $LDFLAGS << ' ' << TclConfig_Info['TCL_LIBS'] + # $DLDFLAGS << ' ' << TclConfig_Info['TCL_LIBS'] + $LDFLAGS << ' ' << TclConfig_Info['TCL_STUB_LIB_SPEC'] + end return true end end @@ -742,6 +766,10 @@ def find_tk(tklib, stubs, version, *opt_paths) "/Tcl/lib", "/Program Files/Tcl/lib" ].find_all{|dir| File.directory?(dir)} + unless TkLib_Config["space-on-tk-libpath"] + default_paths.delete_if{|path| path =~ / /} + end + if (paths = opt_paths.compact).empty? if TkConfig_Info['config_file_path'] # use definisions on tkConfig.sh @@ -749,9 +777,12 @@ def find_tk(tklib, stubs, version, *opt_paths) $LIBPATH |= [$2] unless $2.empty? unless stubs - $LDFLAGS << ' ' << parse_TK_LIBS(TkConfig_Info['TK_LIBS']) - # $DLDFLAGS << ' ' << parse_TK_LIBS(TkConfig_Info['TK_LIBS']) - $LDFLAGS << ' ' << TkConfig_Info['TK_LIB_SPEC'] + unless is_win32? # ignore tclConfig on Windows + # $LDFLAGS << ' ' << parse_TK_LIBS(TkConfig_Info['TK_LIBS']) + $LDFLAGS << ' ' << TkConfig_Info['TK_LIBS'] unless is_win32? + # $DLDFLAGS << ' ' << parse_TK_LIBS(TkConfig_Info['TK_LIBS']) + $LDFLAGS << ' ' << TkConfig_Info['TK_LIB_SPEC'] unless is_win32? + end return true end @@ -759,9 +790,12 @@ def find_tk(tklib, stubs, version, *opt_paths) puts "#{TkConfig_Info['config_file_path']} tells us that your Tcl/Tk library doesn't support stub." return false else - $LDFLAGS << ' ' << parse_TK_LIBS(TkConfig_Info['TK_LIBS']) - # $DLDFLAGS << ' ' << parse_TK_LIBS(TkConfig_Info['TK_LIBS']) - $LDFLAGS << ' ' << TkConfig_Info['TK_STUB_LIB_SPEC'] + unless is_win32? # ignore tclConfig on Windows + # $LDFLAGS << ' ' << parse_TK_LIBS(TkConfig_Info['TK_LIBS']) + $LDFLAGS << ' ' << TkConfig_Info['TK_LIBS'] + # $DLDFLAGS << ' ' << parse_TK_LIBS(TkConfig_Info['TK_LIBS']) + $LDFLAGS << ' ' << TkConfig_Info['TK_STUB_LIB_SPEC'] + end return true end end @@ -818,6 +852,10 @@ def find_tcltk_header(tclver, tkver) "/Tcl/include", "/Program Files/Tcl/include" ].find_all{|dir| File.directory?(dir)} + unless TkLib_Config["space-on-tk-libpath"] + base_dir.delete_if{|path| path =~ / /} + end + if TclConfig_Info['TCL_INCLUDE_SPEC'] && have_tcl_h = try_cpp('tcl.h', TclConfig_Info['TCL_INCLUDE_SPEC']) $INCFLAGS << " " << TclConfig_Info['TCL_INCLUDE_SPEC'] @@ -1123,6 +1161,10 @@ if activeTcl = with_config("ActiveTcl", true) end TkLib_Config["ActiveTcl"] = activeTcl +# allow space chars on a libpath +TkLib_Config["space-on-tk-libpath"] = + enable_config("space-on-tk-libpath", ! is_win32?) + # enable Tcl/Tk stubs? =begin if TclConfig_Info['TCL_STUB_LIB_SPEC'] && TkConfig_Info['TK_STUB_LIB_SPEC'] && diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index b071bf5be..eddc9f0b4 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -1178,7 +1178,10 @@ module TkCore if WITH_RUBY_VM ### check Ruby 1.9 !!!!!!! # *** NEED TO FIX *** ip = TclTkIp.new(name, opts) - if ip._invoke_without_enc('tk', 'windowingsystem') == 'aqua' && + if RUBY_PLATFORM =~ /cygwin/ + RUN_EVENTLOOP_ON_MAIN_THREAD = true + INTERP = ip + elsif ip._invoke_without_enc('tk', 'windowingsystem') == 'aqua' && (TclTkLib.get_version<=>[8,4,TclTkLib::RELEASE_TYPE::FINAL,6]) > 0 # *** KNOWN BUG *** # Main event loop thread of TkAqua (> Tk8.4.9) must be the main @@ -5636,7 +5639,7 @@ TkWidget = TkWindow #Tk.freeze module Tk - RELEASE_DATE = '2009-07-12'.freeze + RELEASE_DATE = '2009-07-16'.freeze autoload :AUTO_PATH, 'tk/variable' autoload :TCL_PACKAGE_PATH, 'tk/variable' -- cgit