From: Hidetoshi NAGAI Date: 2009-07-15T23:09:44+09:00 Subject: [ruby-dev:38799] Re: [Bug:trunk] Re: [ruby-cvs:31281] Ruby:r24063 (trunk): * ext/tk/extconf.rb: New strategy for searching Tcl/Tk libraries. 永井@知能.九工大です. From: Hidetoshi NAGAI Subject: [ruby-dev:38796] Re: [Bug:trunk] Re: [ruby-cvs:31281] Ruby:r24063 (trunk): * ext/tk/extconf.rb: New strategy for searching Tcl/Tk libraries. Date: Wed, 15 Jul 2009 22:25:09 +0900 Message-ID: <20090715.222411.74735746.nagai@ai.kyutech.ac.jp> > では Windows 環境用にはTcl/Tk の検索先を増やす > (空白入りのパスは含めない) 以外には特別なことをせず, > 従来通りとするように方針を変更します. 以下のパッチではいかがでしょうか. Index: ext/tk/config_list.in =================================================================== --- ext/tk/config_list.in (revision 24110) +++ ext/tk/config_list.in (working copy) @@ -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 @@ enable pthread enable tcl-thread with tclConfig-file +enable space-on-tk-libpath Index: ext/tk/extconf.rb =================================================================== --- ext/tk/extconf.rb (revision 24111) +++ ext/tk/extconf.rb (working copy) @@ -1,6 +1,6 @@ ############################################################## # extconf.rb for tcltklib -# release date: 2009-07-12 +# release date: 2009-07-15 ############################################################## require 'mkmf' @@ -214,6 +214,11 @@ } 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 @@ 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 @@ 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 @@ "/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 @@ 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 @@ 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 @@ "/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 @@ $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 @@ 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 @@ "/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 @@ 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'] && -- 永井 秀利 (nagai@ai.kyutech.ac.jp) 九州工業大学 大学院情報工学研究院 知能情報工学研究系 知能情報メディア部門