Top Level Namespace
Defined Under Namespace
Modules: MultiTkIp_PseudoToplevel_Evaluable, TclTk, TclTkLib, Tk, TkBgError, TkBindCore, TkCanvasItemConfig, TkClipboard, TkComm, TkComposite, TkConfigMethod, TkConsole, TkCore, TkEvent, TkGrid, TkItemConfigMethod, TkItemConfigOptkeys, TkItemFontOptkeys, TkKinput, TkListItemConfig, TkManageFocus, TkMenuEntryConfig, TkMenuSpec, TkOptionDB, TkPack, TkPackage, TkPalette, TkPlace, TkSelection, TkTextTagConfig, TkTreatFont, TkTreatItemFont, TkTreatTagFont, TkUtil, TkValidation, TkWinfo, TkXIM, TkcTagAccess Classes: MultiTkIp, MultiTkIp_OK, Object, RemoteTkIp, TclTkCallback, TclTkCommand, TclTkImage, TclTkInterpreter, TclTkIp, TclTkLibCommand, TclTkObject, TclTkVariable, TclTkWidget, TkBindTag, TkBindTagAll, TkBitmapImage, TkCallbackBreak, TkCallbackContinue, TkCallbackEntry, TkCallbackRedo, TkCallbackRetry, TkCallbackReturn, TkCallbackThrow, TkDatabaseClass, TkDialog, TkDialogObj, TkFont, TkImage, TkKernel, TkLocalJumpError, TkMenubar, TkMsgCatalog, TkNamedFont, TkNamespace, TkObject, TkPhotoImage, TkPixmapImage, TkRTTimer, TkScrollbox, TkTextImage, TkTextMark, TkTextMarkAnchor, TkTextMarkCurrent, TkTextMarkInsert, TkTextNamedMark, TkTextNamedTag, TkTextTag, TkTextTagSel, TkTextWin, TkTextWindow, TkTimer, TkValidateCommand, TkVarAccess, TkVariable, TkVirtualEvent, TkWarning, TkWarningObj, TkWindow, TkcArc, TkcBitmap, TkcGroup, TkcImage, TkcItem, TkcLine, TkcOval, TkcPolygon, TkcRectangle, TkcTag, TkcTagAll, TkcTagCurrent, TkcTagString, TkcText, TkcWindow
Constant Summary collapse
- TkSystemMenu =
Tk::SystemMenu
- TkRoot =
Tk::Root
- TopLevel =
TkToplevel
- Frame =
TkFrame
- Label =
TkLabel
- Button =
TkButton
TkRadioButton
TkCheckButton
- Message =
TkMessage
- Entry =
TkEntry
- Spinbox =
TkSpinbox
- Text =
TkText
- Scale =
TkScale
- Scrollbar =
TkScrollbar
- Listbox =
TkListbox
- Menu =
TkMenu
TkMenubutton
- Canvas =
TkCanvas
- Arc =
TkcArc
- Bitmap =
TkcBitmap
- Line =
TkcLine
- Oval =
TkcOval
- Polygon =
TkcPolygon
- Rectangle =
TkcRectangle
- TextItem =
TkcText
- WindowItem =
TkcWindow
- BitmapImage =
TkBitmapImage
- PhotoImage =
TkPhotoImage
- Selection =
TkSelection
- Winfo =
TkWinfo
- Pack =
TkPack
- Grid =
TkGrid
- Place =
TkPlace
- Variable =
TkVariable
- Font =
TkFont
- VirtualEvent =
TkVirtualEvent
- TkAfter =
TkTimer
- TkDialog2 =
TkDialogObj
- TkWarning2 =
TkWarningObj
- TkMsgCat =
TkMsgCatalog
- TktTag =
TkTextTag
- TktNamedTag =
TkTextNamedTag
- TktTagSel =
TkTextTagSel
- TkOption =
TkOptionDB
- TkResourceDB =
TkOptionDB
- TktMark =
TkTextMark
- TktNamedMark =
TkTextNamedMark
- TktMarkInsert =
TkTextMarkInsert
- TktMarkCurrent =
TkTextMarkCurrent
- TktMarkAnchor =
TkTextMarkAnchor
- TkcNamedTag =
TkcTagString
- TktImage =
TkTextImage
- TkNamedVirtualEvent =
TkVirtualEvent::PreDefVirtEvent
- TktWindow =
TkTextWindow
- Ttk =
Tk::Tile
- TkLib_Config =
{}
- TclConfig_Info =
{}
- TkConfig_Info =
{}
- TkWidget =
TkWindow
Class Method Summary collapse
- .__getip ⇒ Object
- .add_tk_procs(name, args = nil, body = nil) ⇒ Object
- .cb_entry_class ⇒ Object
- .cb_eval(cmd, *args) ⇒ Object
- .create_table ⇒ Object
- .default_master? ⇒ Boolean
- .get_cb_entry(cmd) ⇒ Object
- .init_ip_env(script = (use_block = true), &block) ⇒ Object
- .init_ip_internal ⇒ Object
- .remove_tk_procs(*names) ⇒ Object
- .tk_cmd_tbl ⇒ Object
- .tk_object_table(id) ⇒ Object
- .tk_windows ⇒ Object
Instance Method Summary collapse
- #check_NG_path(path_list) ⇒ Object
- #check_pkg(file, verbose = false) ⇒ Object
- #check_shlib_search_path(paths) ⇒ Object
- #check_tcl_NG_path(path_list) ⇒ Object
- #check_tcltk_version(version) ⇒ Object
- #check_tk_NG_path(path_list) ⇒ Object
- #collect_tcltk_defs(tcl_defs_str, tk_defs_str) ⇒ Object
- #find_framework(tcl_hdr, tk_hdr) ⇒ Object
- #find_macosx_framework ⇒ Object
- #find_tcl(tcllib, stubs, version, *opt_paths) ⇒ Object
- #find_tcltk_header(tclver, tkver) ⇒ Object
- #find_tcltk_library(tcllib, tklib, stubs, tclversion, tkversion, tcl_opt_paths, tk_opt_paths) ⇒ Object
- #find_tk(tklib, stubs, version, *opt_paths) ⇒ Object
- #find_X11(*opt_paths) ⇒ Object
- #get_ext_list ⇒ Object
- #get_libpath(lib_flag, lib_spec) ⇒ Object
- #get_pkg_list(file) ⇒ Object
- #get_shlib_path_head ⇒ Object
- #get_shlib_versions(major = 8, minor_max = 9, minor_min = 0, ext = "") ⇒ Object
- #get_tclConfig(tclConfig_file, tkConfig_file, tclConfig_dir, tkConfig_dir) ⇒ Object
- #get_tclConfig_dirs ⇒ Object
- #help_msg ⇒ Object
- #is_macosx? ⇒ Boolean
-
#is_win32? ⇒ Boolean
functions.
- #libcheck_for_tclConfig(tcldir, tkdir, tclconf, tkconf) ⇒ Object
- #Mainloop ⇒ Object
- #maybe_64bit? ⇒ Boolean
- #newline ⇒ Object
- #parse_tclConfig(file) ⇒ Object
- #parse_TK_LIBS(tklibs) ⇒ Object
- #progress(s) ⇒ Object
- #pthread_check ⇒ Object
-
#search_tclConfig(*paths) ⇒ Object
libdir list or [tcl-libdir|file, tk-libdir|file].
- #search_vers_on_path(vers, path, *heads) ⇒ Object
- #search_X_libraries ⇒ Object
- #setup_for_macosx_framework(tclver, tkver) ⇒ Object
- #subdir_check(dir, verbose = false) ⇒ Object
- #TkGrid(*args) ⇒ Object
- #TkPack(*args) ⇒ Object
- #TkPlace(*args) ⇒ Object
Class Method Details
.__getip ⇒ Object
1293 1294 1295 |
# File 'lib/tk.rb', line 1293 def INTERP.__getip self end |
.add_tk_procs(name, args = nil, body = nil) ⇒ Object
1390 1391 1392 1393 1394 1395 1396 1397 1398 |
# File 'lib/tk.rb', line 1390 def INTERP.add_tk_procs(name, args = nil, body = nil) if name.kind_of?(Array) name.each{|param| self.add_tk_procs(*param)} else name = name.to_s @add_tk_procs << [name, args, body] self._invoke('proc', name, args, body) if args && body end end |
.cb_entry_class ⇒ Object
1346 1347 1348 |
# File 'lib/tk.rb', line 1346 def INTERP.cb_entry_class @cb_entry_class end |
.cb_eval(cmd, *args) ⇒ Object
1381 1382 1383 |
# File 'lib/tk.rb', line 1381 def INTERP.cb_eval(cmd, *args) TkUtil._get_eval_string(TkUtil.eval_cmd(cmd, *args)) end |
.create_table ⇒ Object
1372 1373 1374 1375 1376 |
# File 'lib/tk.rb', line 1372 def INTERP.create_table id = @tk_table_list.size @tk_table_list << {} Tk_OBJECT_TABLE.new(id) end |
.default_master? ⇒ Boolean
1296 1297 1298 |
# File 'lib/tk.rb', line 1296 def INTERP.default_master? true end |
.get_cb_entry(cmd) ⇒ Object
1378 1379 1380 |
# File 'lib/tk.rb', line 1378 def INTERP.get_cb_entry(cmd) @cb_entry_class.new(__getip, cmd).freeze end |
.init_ip_env(script = (use_block = true), &block) ⇒ Object
1385 1386 1387 1388 1389 |
# File 'lib/tk.rb', line 1385 def INTERP.init_ip_env(script = (use_block = true), &block) script = block if use_block @init_ip_env << script script.call(self) end |
.init_ip_internal ⇒ Object
1409 1410 1411 1412 1413 |
# File 'lib/tk.rb', line 1409 def INTERP.init_ip_internal ip = self @init_ip_env.each{|script| script.call(ip)} @add_tk_procs.each{|name,args,body| ip._invoke('proc',name,args,body)} end |
.remove_tk_procs(*names) ⇒ Object
1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 |
# File 'lib/tk.rb', line 1399 def INTERP.remove_tk_procs(*names) names.each{|name| name = name.to_s @add_tk_procs.delete_if{|elem| elem.kind_of?(Array) && elem[0].to_s == name } #self._invoke('rename', name, '') self.__invoke__('rename', name, '') } end |
.tk_cmd_tbl ⇒ Object
1349 1350 1351 |
# File 'lib/tk.rb', line 1349 def INTERP.tk_cmd_tbl @tk_cmd_tbl end |
.tk_object_table(id) ⇒ Object
1369 1370 1371 |
# File 'lib/tk.rb', line 1369 def INTERP.tk_object_table(id) @tk_table_list[id] end |
.tk_windows ⇒ Object
1352 1353 1354 |
# File 'lib/tk.rb', line 1352 def INTERP.tk_windows @tk_windows end |
Instance Method Details
#check_NG_path(path_list) ⇒ Object
1001 1002 1003 1004 1005 1006 |
# File 'ext/tk/extconf.rb', line 1001 def check_NG_path(path_list) path_list.find_all{|path| not (TkLib_Config["tcl-NG-path"].include?(path) && TkLib_Config["tk-NG-path"].include?(path)) } end |
#check_pkg(file, verbose = false) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/tkextlib/pkg_checker.rb', line 92 def check_pkg(file, verbose=false) pkg_list = get_pkg_list(file) error_list = [] success_list = {} pkg_list.each{|name, type| next if success_list[name] begin case type when :package ver = TkPackage.require(name) success_list[name] = ver error_list.delete_if{|n, t| n == name} when :library Tk.load_tcllibrary(name) success_list[name] = :library error_list.delete_if{|n, t| n == name} when :script Tk.load_tclscript(name) success_list[name] = :script error_list.delete_if{|n, t| n == name} when :require_ruby_lib require name end rescue => e if verbose error_list << [name, type, e.] else error_list << [name, type] end end } success_list.dup.each{|name, ver| unless ver.kind_of?(String) begin ver = TkPackage.require(name) success_list[name] = ver rescue end end } [success_list, error_list] end |
#check_shlib_search_path(paths) ⇒ Object
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 |
# File 'ext/tk/extconf.rb', line 1008 def check_shlib_search_path(paths) if !paths || paths.empty? path_list = [] #if TkLib_Config["ActiveTcl"] # path_list.concat Dir.glob(TkLib_Config["ActiveTcl"], File::FNM_CASEFOLD).sort.reverse #end if TkLib_Config["ActiveTcl"].kind_of?(String) # glob path path_list.concat Dir.glob(TkLib_Config["ActiveTcl"], File::FNM_CASEFOLD).sort.reverse end vers = get_shlib_versions path_head, path_dirs = get_shlib_path_head path_list.concat vers.map{|ver| path_head.map{|head| if ver.empty? head + "/lib" else dirs = [] if Dir.glob(head, File::FNM_CASEFOLD).find{|dir| dir == head} dirs << head + "/lib" end if !Dir.glob(head + "-*", File::FNM_CASEFOLD).empty? dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*", File::FNM_CASEFOLD).empty? dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*", File::FNM_CASEFOLD).empty? end if !Dir.glob(head + "[_-]*", File::FNM_CASEFOLD).empty? dirs << head + "_#{ver}/lib" if !Dir.glob(head + "_[89].*", File::FNM_CASEFOLD).empty? dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*", File::FNM_CASEFOLD).empty? dirs << head + "_#{ver.delete('.')}/lib" if !Dir.glob(head + "_[89][0-9]*", File::FNM_CASEFOLD).empty? dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*", File::FNM_CASEFOLD).empty? end dirs end } }.flatten! path_list.concat path_dirs else # paths is a string with PATH environment style path_list = paths.split((is_win32?)? ';': ':') end path_list = check_NG_path(path_list) path_list.map!{|path| path.strip} if !CROSS_COMPILING and (is_win32? || is_macosx?) # exist-dir only path_list.delete_if{|path| Dir.glob(File.join(path, "*.{a,so,dll,lib}")).empty?} end # keep paths for searching dynamic libs #$LIBPATH |= path_list path_list.uniq end |
#check_tcl_NG_path(path_list) ⇒ Object
993 994 995 |
# File 'ext/tk/extconf.rb', line 993 def check_tcl_NG_path(path_list) path_list.find_all{|path| not TkLib_Config["tcl-NG-path"].include?(path) } end |
#check_tcltk_version(version) ⇒ Object
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'ext/tk/extconf.rb', line 146 def check_tcltk_version(version) return [nil, nil] unless version.kind_of? String tclver, tkver = version.split(',') tclver = tclver.strip return [tclver, tkver.strip] if tkver dot = major = minor_dot = minor = plvl_dot = plvl = ext = nil if tclver =~ /^(\d)(\.?)(\d)(\.?)(\d*)(.*)$/ major = $1; minor_dot = $2; minor = $3; plvl_dot = $4; plvl = $5; ext = $6 dot = ! minor_dot.empty? if plvl_dot.empty? && ! plvl.empty? minor << plvl end elsif tclver =~ /^(\d)(\.?)(\d?)(.*)$/ major = $1; minor_dot = $2; minor = $3; ext = $4 dot = ! minor_dot.empty? else # unknown -> believe user return [tclver, tkver] end # check Tcl7.6 / Tk4.2 ? if major == "7" # Tcl7.6 ( not support Tclversion < 7.6 ) # Tk4.2 tkver = "4" + ((dot)? ".": "") + ((minor.empty)? "": "2") + ext elsif major == "4" # Tk4.2 ( not support Tkversion < 4.2 ) # Tcl7.6 tkver = tclver tclver = "7" + ((dot)? ".": "") + ((minor.empty)? "": "6") + ext end tkver = tclver unless tkver [tclver, tkver] end |
#check_tk_NG_path(path_list) ⇒ Object
997 998 999 |
# File 'ext/tk/extconf.rb', line 997 def check_tk_NG_path(path_list) path_list.find_all{|path| not TkLib_Config["tk-NG-path"].include?(path) } end |
#collect_tcltk_defs(tcl_defs_str, tk_defs_str) ⇒ Object
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'ext/tk/extconf.rb', line 353 def collect_tcltk_defs(tcl_defs_str, tk_defs_str) conflicts = [ 'PACKAGE_NAME', 'PACKAGE_TARNAME', 'PACKAGE_VERSION', 'PACKAGE_STRING', 'PACKAGE_BUGREPORT' ] begin # Ruby 1.9.x or later arch_config_h = RbConfig.($arch_hdrdir + "/ruby/config.h") if File.exist?(arch_config_h) keys = [] IO.foreach(arch_config_h){|line| if line =~ /^#define +([^ ]+)/ keys << $1 end } conflicts = keys end rescue # ignore, use default end if tcl_defs_str tcl_defs = tcl_defs_str.split(/(?:\A|\s)\s*-D/).map{|s| s =~ /^([^=]+)(.*)$/ [$1, $2] } else tcl_defs = [] end if tk_defs_str tk_defs = tk_defs_str.split(/(?:\A|\s)\s*-D/).map{|s| s =~ /^([^=]+)(.*)$/ [$1, $2] } else tk_defs = [] end defs = tcl_defs | tk_defs defs.delete_if{|name,value| conflicts.include?(name) || ( (vtcl = tcl_defs.assoc(name)) && (vtk = tk_defs.assoc(name)) && vtcl != vtk ) } defs.map{|ary| /\S/ =~ (s = ary.join('')) and "-D" << s.strip}.compact end |
#find_framework(tcl_hdr, tk_hdr) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'ext/tk/old-extconf.rb', line 14 def find_framework(tcl_hdr, tk_hdr) if framework_dir = with_config("tcltk-framework") paths = [framework_dir] else unless tcl_hdr || tk_hdr || enable_config("tcltk-framework", false) || enable_config("mac-tcltk-framework", false) return false end paths = ["/Library/Frameworks", "/System/Library/Frameworks"] end checking_for('Tcl/Tk Framework') { paths.find{|dir| dir.strip! dir.chomp!('/') (tcl_hdr || FileTest.directory?(dir + "/Tcl.framework/") ) && (tk_hdr || FileTest.directory?(dir + "/Tk.framework/") ) } } end |
#find_macosx_framework ⇒ Object
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
# File 'ext/tk/extconf.rb', line 275 def find_macosx_framework use_framework = is_macosx? && TkLib_Config["ActiveTcl"] use_framework ||= (tcl_hdr = with_config("tcl-framework-header")) use_framework ||= (tk_hdr = with_config("tk-framework-header")) tcl_hdr = nil unless tcl_hdr.kind_of? String tk_hdr = nil unless tk_hdr.kind_of? String TkLib_Config["tcl-framework-header"] = tcl_hdr TkLib_Config["tk-framework-header"] = tk_hdr use_framework ||= (tcl_dir = with_config("tcl-framework-dir")) tcl_dir = nil unless tcl_dir.kind_of? String if !tcl_dir && tcl_hdr # e.g. /Library/Frameworks/Tcl.framework/Headers # ==> /Library/Frameworks/Tcl.framework tcl_dir = File.dirname(tcl_hdr.strip.chomp('/')) end TkLib_Config["tcl-framework-dir"] = tcl_dir use_framework ||= (tk_dir = with_config("tk-framework-dir")) tk_dir = nil unless tk_dir.kind_of? String if !tk_dir && tk_hdr # e.g. /Library/Frameworks/Tk.framework/Headers # ==> /Library/Frameworks/Tk.framework tk_dir = File.dirname(tk_hdr.strip.chomp('/')) end TkLib_Config["tk-framework-dir"] = tk_dir if tcl_dir && !tk_dir tk_dir = File.join(File.dirname(tcl_dir), 'Tk.framework') TkLib_Config["tk-framework-dir"] = tk_dir elsif !tcl_dir && tk_dir tcl_dir = File.join(File.dirname(tk_dir), 'Tcl.framework') TkLib_Config["tcl-framework-dir"] = tcl_dir end if tcl_dir && tk_dir TkLib_Config["tcltk-framework"] = File.dirname(tcl_dir) unless TkLib_Config["tcltk-framework"] return [tcl_dir, tk_dir] end # framework is disabled? if with_config("tcltk-framework") == false || enable_config("tcltk-framework") == false return false end use_framework ||= (framework_dir = with_config("tcltk-framework")) if framework_dir.kind_of? String TkLib_Config["tcltk-framework"] = framework_dir.strip.chomp('/') return [File.join(TkLib_Config["tcltk-framework"], 'Tcl.framework'), File.join(TkLib_Config["tcltk-framework"], 'Tk.framework')] end unless enable_config("tcltk-framework", use_framework) || enable_config("mac-tcltk-framework", use_framework) TkLib_Config["tcltk-framework"] = false return false end paths = [ #"~/Library/Frameworks", "/Library/Frameworks", "/Network/Library/Frameworks", "/System/Library/Frameworks" ] paths.reverse! unless TkLib_Config["ActiveTcl"] # system has higher priority paths.map{|dir| dir.strip.chomp('/')}.each{|dir| next unless File.exist?(File.join(dir, "Tcl.framework", "Headers")) next unless File.directory?(tcldir = File.join(dir, "Tcl.framework")) next unless File.exist?(File.join(dir, "Tk.framework", "Headers")) next unless File.directory?(tkdir = File.join(dir, "Tk.framework")) TkLib_Config["tcltk-framework"] = dir return [tcldir, tkdir] } nil end |
#find_tcl(tcllib, stubs, version, *opt_paths) ⇒ Object
1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 |
# File 'ext/tk/extconf.rb', line 1076 def find_tcl(tcllib, stubs, version, *opt_paths) if TclConfig_Info['MKMF_PARAMS'] # already checked existence of tcl library based on tclConfig.sh ($INCFLAGS ||= "") << " " << TclConfig_Info['MKMF_PARAMS']['INCFLAGS'] $LIBPATH ||= []; $LIBPATH |= TclConfig_Info['MKMF_PARAMS']['LIBPATH'] ($libs ||= "") << " " << TclConfig_Info['MKMF_PARAMS']['libs'] return [true, nil, nil, nil] end # else, no available tclConfig.sh on the system print "Search Tcl library" if stubs func = "Tcl_InitStubs" lib = "tclstub" else func = "Tcl_FindExecutable" lib = "tcl" end if version && ! version.empty? versions = [version] else versions = TkLib_Config['search_versions'] end default_paths = [] default_paths.concat [ RbConfig::CONFIG['libdir'], File.join(RbConfig::CONFIG['exec_prefix'], 'lib'), File.join(RbConfig::CONFIG['prefix'], 'lib'), "/usr/local/lib", "/usr/pkg/lib", "/usr/contrib/lib", "/usr/lib" ].find_all{|dir| File.directory?(dir)} unless CROSS_COMPILING if TkLib_Config["ActiveTcl"].kind_of?(String) # glob path default_paths.concat Dir.glob(TkLib_Config["ActiveTcl"]).sort.reverse.map{|d| d << "/lib"} end if !CROSS_COMPILING and is_win32? default_paths.concat [ "c:/Tcl/lib","c:/Program Files/Tcl/lib","c:/Program Files (x86)/Tcl/lib", "/Tcl/lib","/Program Files/Tcl/lib","/Program Files (x86)/Tcl/lib" ].find_all{|dir| File.directory?(dir)}.map{|dir| File.(dir)} # for MinGW ["/usr/local/lib64", "/usr/lib64", "/usr/local/lib", "/usr/lib"].each{|dir| default_paths << File.(dir) if File.directory? dir } default_paths |= ENV['LIBRARY_PATH'].split(';').find_all{|dir| File.directory? dir}.map{|dir| File.(dir)} if ENV['LIBRARY_PATH'] default_paths |= ENV['PATH'].split(';').find_all{|dir| File.directory? dir}.map{|dir| File.(dir)} if ENV['PATH'] end default_paths |= TkLib_Config["checked_shlib_dirs"] unless TkLib_Config["space-on-tk-libpath"] default_paths.delete_if{|path| path =~ / /} end if (paths = opt_paths.compact).empty? paths = check_tcl_NG_path(default_paths) end incflags = ($INCFLAGS ||= "").dup libpath = ($LIBPATH ||= []).dup libs_param = ($libs ||= "").dup tcllibs = nil exts = "(" + get_ext_list.join('|') + ")" paths.map{|path| lib_w_sufx = lib begin $LIBPATH |= [path] inc = [File.join(File.dirname(path),"include"), File.dirname(path)] inc.each{|f| $INCFLAGS << " -I" << f } if tcllib print(".") if have_library(tcllib, func, ["tcl.h"]) return [true, path, tcllib, nil, *inc] end else sufx_list = ['', 't', 'g', 's', 'x'] search_vers_on_path(versions, path, lib, 'tcl').find{|ver| dir_enum = Dir.foreach(path) no_dot_ver = ver.delete('.') libnames = ["#{lib}#{ver}", "#{lib}#{no_dot_ver}"] libnames << "tcl#{ver}" << "tcl#{no_dot_ver}" if lib != "tcl" libnames.find{|libname| sufx_list.find{|sufx| print(".") dir_enum.map{|fname| if fname =~ /^.*(#{libname}.*#{sufx})\.(#{exts}).*$/ [fname, $1, $2] end }.compact.find{|fname, lib_w_sufx, ext| ext.downcase! if (ext != CONFIG['DLEXT'] && ext == CONFIG['LIBEXT']) || ext == "a" # static link tcllibs = libs_param + " -DSTATIC_BUILD " + fname.quote else tcllibs = append_library($libs, lib_w_sufx) tcllibs = "#{libpathflag([path])} #{tcllibs}" end if try_func(func, tcllibs, ["tcl.h"]) return [true, path, nil, tcllibs, *inc] end } } } } if (!version && (print(".");try_func(func, libs_param, ["tcl.h"]))) return [true, path, lib_w_sufx, nil, *inc] end end ensure $LIBPATH = libpath.dup $libs = libs_param.dup $INCFLAGS = incflags.dup end } progress("\n") [false, nil, nil, nil] end |
#find_tcltk_header(tclver, tkver) ⇒ Object
1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 |
# File 'ext/tk/extconf.rb', line 1381 def find_tcltk_header(tclver, tkver) base_dir = [] base_dir.concat [ File.join(RbConfig::CONFIG['prefix'], 'include'), "/usr/local/include", "/usr/pkg/include", "/usr/contrib/include", "/usr/include" ].find_all{|dir| File.directory?(dir)}.map{|dir| File.(dir)} if !CROSS_COMPILING && is_win32? base_dir.concat [ "c:/Tcl/include","c:/Program Files/Tcl/include", "c:/Program Files (x86)/Tcl/include", "/Tcl/include","/Program Files/Tcl/include", "/Program Files (x86)/Tcl/include" ].find_all{|dir| File.directory?(dir)}.map{|dir| File.(dir)} if ENV['CPATH'] base_dir |= ENV['CPATH'].split(';').find_all{|dir| File.directory?(dir)}.map{|dir| File.(dir)} end end base_dir |= TkLib_Config["checked_shlib_dirs"] unless TkLib_Config["space-on-tk-libpath"] base_dir.delete_if{|path| path =~ / /} end # tcl.h if TclConfig_Info['MKMF_PARAMS'] # already checked existence of tcl headers based on tclConfig.sh have_tcl_h = true else print "Search tcl.h" newline if enable_config("tcl-h-ver-check", true) && tclver && tclver =~ /^\D*(\d)\.?(\d)/ major = $1; minor = $2 else major = minor = nil end progress(".") if major && minor # version check on tcl.h version_check = proc {|code| code << ("#if TCL_MAJOR_VERSION != #{major} || TCL_MINOR_VERSION != #{minor}\n" \ "#error VERSION does not match\n" \ "#endif") } else version_check = nil end have_tcl_h = have_header('tcl.h', &version_check) unless have_tcl_h if tclver && ! tclver.empty? versions = [tclver] else versions = TkLib_Config['search_versions'] end paths = base_dir.dup (versions + [""]).each{|ver| paths.concat(base_dir.map{|dir| [ dir + '/tcl' + ver, dir + '/tcl' + ver + '/include', dir + '/tcl' + ver.delete('.'), dir + '/tcl' + ver.delete('.') + '/include' ] }.flatten) } paths = paths.map{|dir| (File.directory?(dir))? File.(dir): nil }.compact.uniq if major || minor version_check = proc {|code| code << "#if TCL_MAJOR_VERSION != #{major}\n#error MAJOR_VERSION does not match\n#endif\n" if major code << "#if TCL_MINOR_VERSION != #{minor}\n#error MINOR_VERSION does not match\n#endif\n" if minor code } else version_check = nil end have_tcl_h = paths.find{|path| progress(".") inc_opt = " -I#{path.quote}" if try_header("tcl", inc_opt, &version_check) ($INCFLAGS ||= "") << inc_opt true else false end } end progress("\n") end # tk.h if TkConfig_Info['MKMF_PARAMS'] # already checked existence of tk headers based on tkConfig.sh have_tk_h = true else print "Search tk.h" newline if enable_config("tk-h-ver-check", true) && tkver && tkver =~ /^\D*(\d)\.?(\d)/ major = $1; minor = $2 else major = minor = nil end progress(".") if major && minor # version check on tk.h version_check = proc {|code| code << ("#if TK_MAJOR_VERSION != #{major} || TK_MINOR_VERSION != #{minor}\n" \ "#error VERSION does not match\n" \ "#endif") } else version_check = nil end have_tk_h = have_header('tk.h') unless have_tk_h if tkver && ! tkver.empty? versions = [tkver] else versions = TkLib_Config['search_versions'] end paths = base_dir.dup (versions + [""]).each{|ver| paths.concat(base_dir.map{|dir| [ dir + '/tk' + ver, dir + '/tk' + ver + '/include', dir + '/tk' + ver.delete('.'), dir + '/tk' + ver.delete('.') + '/include' ] }.flatten) } paths = paths.map{|dir| (File.directory?(dir))? File.(dir): nil }.compact.uniq if major || minor version_check = proc {|code| code << "#if TK_MAJOR_VERSION != #{major}\n#error MAJOR_VERSION does not match\n#endif\n" if major code << "#if TK_MINOR_VERSION != #{minor}\n#error MINOR_VERSION does not match\n#endif\n" if minor code } else version_check = nil end have_tk_h = paths.find{|path| progress(".") inc_opt = " -I#{path.quote}" if try_header(%w'tcl.h tk.h', inc_opt, &version_check) ($INCFLAGS ||= "") << inc_opt true else false end } end progress("\n") end puts "Can't find \"tcl.h\"." unless have_tcl_h puts "Can't find \"tk.h\"." unless have_tk_h have_tcl_h && have_tk_h end |
#find_tcltk_library(tcllib, tklib, stubs, tclversion, tkversion, tcl_opt_paths, tk_opt_paths) ⇒ Object
1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 |
# File 'ext/tk/extconf.rb', line 1344 def find_tcltk_library(tcllib, tklib, stubs, tclversion, tkversion, tcl_opt_paths, tk_opt_paths) st,path,lib,libs,*inc = find_tcl(tcllib, stubs, tclversion, *tcl_opt_paths) if !st && TkLib_Config['enable-shared'] == nil TkLib_Config['enable-shared'] = false st,path,lib,libs,*inc = find_tcl(tcllib, stubs, tclversion, *tcl_opt_paths) end unless st puts("\n""Warning:: cannot find Tcl library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options.") return false else ($LIBPATH ||= []; $LIBPATH |= [path]) if path $libs = append_library($libs, lib) if lib ($libs ||= "") << " " << libs if libs $INCFLAGS ||= "" inc.each{|f| $INCFLAGS << " -I" << f} end st,path,lib,libs,*inc = find_tk(tklib, stubs, tkversion, *tk_opt_paths) if !st && TkLib_Config['enable-shared'] == nil TkLib_Config['enable-shared'] = false st,path,lib,libs,*inc = find_tk(tklib, stubs, tkversion, *tk_opt_paths) end unless st puts("\n""Warning:: cannot find Tk library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options.") return false else ($LIBPATH ||= []; $LIBPATH |= [path]) if path $libs = append_library($libs, lib) if lib && !lib.empty? ($libs ||= "") << " " << libs if libs $INCFLAGS ||= "" inc.each{|f| $INCFLAGS << " -I" << f} end true end |
#find_tk(tklib, stubs, version, *opt_paths) ⇒ Object
1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 |
# File 'ext/tk/extconf.rb', line 1220 def find_tk(tklib, stubs, version, *opt_paths) if TkConfig_Info['MKMF_PARAMS'] # already checked existence of tcl library based on tkConfig.sh ($INCFLAGS ||= "") << " " << TkConfig_Info['MKMF_PARAMS']['INCFLAGS'] $LIBPATH ||= []; $LIBPATH |= TkConfig_Info['MKMF_PARAMS']['LIBPATH'] ($libs ||= "") << " " << TkConfig_Info['MKMF_PARAMS']['libs'] return [true, nil, nil, nil] end # else, no available tkConfig.sh on the system print "Search Tk library" if stubs func = "Tk_InitStubs" lib = "tkstub" else func = "Tk_Init" lib = "tk" end if version && ! version.empty? versions = [version] else versions = TkLib_Config['search_versions'] end default_paths = [] default_paths.concat [ RbConfig::CONFIG['libdir'], File.join(RbConfig::CONFIG['exec_prefix'], 'lib'), File.join(RbConfig::CONFIG['prefix'], 'lib'), "/usr/local/lib", "/usr/pkg/lib", "/usr/contrib/lib", "/usr/lib" ].find_all{|dir| File.directory?(dir)} unless CROSS_COMPILING if !CROSS_COMPILING and is_win32? default_paths.concat [ "c:/Tcl/lib","c:/Program Files/Tcl/lib","c:/Program Files (x86)/Tcl/lib", "/Tcl/lib","/Program Files/Tcl/lib","/Program Files (x86)/Tcl/lib" ].find_all{|dir| File.directory?(dir)} # for MinGW ["/usr/local/lib64", "/usr/lib64", "/usr/local/lib", "/usr/lib"].each{|dir| default_paths << File.(dir) if File.directory? dir } default_paths |= ENV['LIBRARY_PATH'].split(';').find_all{|dir| File.directory? dir}.map{|dir| File.(dir)} if ENV['LIBRARY_PATH'] default_paths |= ENV['PATH'].split(';').find_all{|dir| File.directory? dir}.map{|dir| File.(dir)} if ENV['PATH'] end default_paths |= TkLib_Config["checked_shlib_dirs"] unless TkLib_Config["space-on-tk-libpath"] default_paths.delete_if{|path| path =~ / /} end if (paths = opt_paths.compact).empty? paths = check_tk_NG_path(default_paths) end incflags = ($INCFLAGS ||= "").dup libpath = ($LIBPATH ||= []).dup libs_param = ($libs ||= "").dup tcllibs = nil exts = "(" + get_ext_list.join('|') + ")" paths.map{|path| lib_w_sufx = lib begin $LIBPATH |= [path] inc = [File.join(File.dirname(path),"include"), File.dirname(path)] inc.each{|f| $INCFLAGS << " -I" << f } if tklib print(".") if have_library(tklib, func, ["tcl.h", "tk.h"]) return [true, path, tklib, nil, *inc] end else sufx_list = ['', 't', 'g', 's', 'x'] search_vers_on_path(versions, path, lib, 'tk').find{|ver| dir_enum = Dir.foreach(path) no_dot_ver = ver.delete('.') libnames = ["#{lib}#{ver}", "#{lib}#{no_dot_ver}"] libnames << "tk#{ver}" << "tk#{no_dot_ver}" if lib != "tk" libnames.find{|libname| sufx_list.find{|sufx| print(".") dir_enum.map{|fname| if fname =~ /^.*(#{libname}.*#{sufx})\.(#{exts}).*$/ [fname, $1, $2] end }.compact.find{|fname, lib_w_sufx, ext| if (ext != CONFIG['DLEXT'] && ext == CONFIG['LIBEXT']) || ext == "a" # static link tklibs = libs_param + " -DSTATIC_BUILD " + fname.quote else tklibs = append_library($libs, lib_w_sufx) tklibs = "#{libpathflag([path])} #{tklibs}" end if try_func(func, tklibs, ["tcl.h", "tk.h"]) return [true, path, nil, tklibs, *inc] end } } } } if (!version && (print(".");try_func(func, libs_param, ["tcl.h", "tk.h"]))) return [true, path, lib_w_sufx, nil, *inc] end end ensure $LIBPATH = libpath $libs = libs_param $INCFLAGS = incflags.dup end } progress("\n") [false, nil, nil, nil] end |
#find_X11(*opt_paths) ⇒ Object
1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 |
# File 'ext/tk/extconf.rb', line 1597 def find_X11(*opt_paths) defaults = [ "/usr/X11*/lib", "/usr/lib/X11*", "/usr/local/X11*", "/usr/openwin/lib" ] paths = [] opt_paths.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNM_CASEFOLD))} defaults.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNM_CASEFOLD))} st = find_library("X11", "XOpenDisplay", *paths) unless st puts("\n""Warning:: cannot find X11 library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options. If your Tcl/Tk don't require X11, please try --without-X11.") end st end |
#get_ext_list ⇒ Object
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 |
# File 'ext/tk/extconf.rb', line 569 def get_ext_list() exts = [CONFIG['DLEXT']] exts.concat %w(dll) if is_win32? exts.concat %w(bundle dylib) if is_macosx? if TkLib_Config["tcltk-stubs"] || TkLib_Config['enable-shared'] == false exts.unshift "lib" if is_win32? exts.unshift "a" exts.unshift CONFIG['LIBEXT'] end if is_win32? exts.map!{|ext| [ext.downcase, ext.upcase]}.flatten! end exts end |
#get_libpath(lib_flag, lib_spec) ⇒ Object
420 421 422 423 |
# File 'ext/tk/extconf.rb', line 420 def get_libpath(lib_flag, lib_spec) # get libpath from {TCL,Tk}_LIB_FLAG and {TCL,Tk}_LIB_SPEC lib_spec.gsub(/(#{lib_flag}|-L)/, "").strip end |
#get_pkg_list(file) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/tkextlib/pkg_checker.rb', line 67 def get_pkg_list(file) pkg_list = [] File.foreach(file){|l| if l =~ /^(?:[^#]+\s|\s*)(?:|;\s*)TkPackage\s*\.\s*require\s*\(?\s*(["'])((\w|:)+)\1/ pkg = [$2, :package] pkg_list << pkg unless pkg_list.member?(pkg) end if l =~ /^(?:[^#]+\s|\s*)(?:|;\s*)Tk\s*\.\s*load_tcllibrary\s*\(?\s*(["'])((\w|:)+)\1/ pkg = [$2, :library] pkg_list << pkg unless pkg_list.member?(pkg) end if l =~ /^(?:[^#]+\s|\s*)(?:|;\s*)Tk\s*\.\s*load_tclscript\s*\(?\s*(["'])((\w|:)+)\1/ pkg = [$2, :script] pkg_list << pkg unless pkg_list.member?(pkg) end if l =~ /^(?:[^#]+\s|\s*)(?:|;\s*)require\s*\(?\s*(["'])((\w|\/|:)+)\1/ pkg = [$2, :require_ruby_lib] pkg_list << pkg unless pkg_list.member?(pkg) end } pkg_list end |
#get_shlib_path_head ⇒ Object
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'ext/tk/extconf.rb', line 210 def get_shlib_path_head path_head = [] path_dirs = [] if TkLib_Config["ActiveTcl"].kind_of?(String) # glob path # path_head << TkLib_Config["ActiveTcl"] path_head.concat Dir.glob(TkLib_Config["ActiveTcl"], File::FNM_CASEFOLD).sort.reverse # path_dirs.concat Dir.glob(File.join(TkLib_Config["ActiveTcl"], 'lib'), File::FNM_CASEFOLD).sort.reverse end if CROSS_COMPILING elsif is_win32? if TkLib_Config["ActiveTcl"] path_head.concat ["c:/ActiveTcl", "c:/Program Files/ActiveTcl", "c:/Program Files (x86)/ActiveTcl"] end path_head.concat [ "c:/Tcl", "c:/Program Files/Tcl", "c:/Program Files (x86)/Tcl", "/Tcl", "/Program Files/Tcl", "/Program Files (x86)/Tcl" ] path_head.uniq! #path_head.each{|dir| path_dirs << dir.dup if File.directory? dir} path_head.each{|dir| path_dirs << File.(dir) if File.directory? dir} # for MinGW ["/usr/local/lib64", "/usr/lib64", "/usr/local/lib", "/usr/lib"].each{|dir| #path_dirs << dir if File.directory? dir path_dirs << File.(dir) if File.directory? dir } path_dirs |= ENV['LIBRARY_PATH'].split(';').find_all{|dir| File.directory? dir}.map{|dir| File.(dir)} if ENV['LIBRARY_PATH'] path_dirs |= ENV['PATH'].split(';').find_all{|dir| File.directory? dir}.map{|dir| File.(dir)} if ENV['PATH'] else [ '/opt', '/pkg', '/share', '/usr/local/opt', '/usr/local/pkg', '/usr/local/share', '/usr/local', '/usr/opt', '/usr/pkg', '/usr/share', '/usr/contrib', '/usr' ].each{|dir| next unless File.directory?(dir) path_dirs << "#{dir}/lib64" if maybe_64bit? path_dirs << "#{dir}/lib" path_dirs << "#{dir}" unless Dir.glob("#{dir}/lib*.*", File::FNM_CASEFOLD).empty? dirnames = [] if TkLib_Config["ActiveTcl"] dirnames.concat ["ActiveTcl"] end dirnames.concat ["TclTk","Tcl_Tk","Tcl-Tk"] dirnames.each{|name| path_dirs << "#{dir}/#{name}" if File.directory?("#{dir}/#{name}") path_head << "#{dir}/#{name}" unless Dir.glob("#{dir}/#{name}[-89_]*", File::FNM_CASEFOLD).empty? } } 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 |
#get_shlib_versions(major = 8, minor_max = 9, minor_min = 0, ext = "") ⇒ Object
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'ext/tk/extconf.rb', line 182 def get_shlib_versions(major = 8, minor_max = 9, minor_min = 0, ext = "") if tclcfg = TkLib_Config["tclConfig_info"] major = tclcfg['TCL_MAJOR_VERSION'].to_i minor_min = tclcfg['TCL_MINOR_VERSION'].to_i elsif TkLib_Config["tcltkversion"] tclver, tkver = TkLib_Config["tcltkversion"] if tclver =~ /8\.?(\d)(.*)/ minor_min = $1.to_i ext = $2 else # unsupported version return [""] end end # if disable-stubs, version is fixed. minor_max = minor_min unless TkLib_Config["tcltk-stubs"] vers = [] minor_max.downto(minor_min){|minor| vers << "#{major}.#{minor}#{ext}" unless ext.empty? vers << "#{major}.#{minor}" } vers << "" end |
#get_tclConfig(tclConfig_file, tkConfig_file, tclConfig_dir, tkConfig_dir) ⇒ Object
909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 |
# File 'ext/tk/extconf.rb', line 909 def get_tclConfig(tclConfig_file, tkConfig_file, tclConfig_dir, tkConfig_dir) use_tclConfig = tclConfig_file != false && tclConfig_dir != false use_tkConfig = tkConfig_file != false && tkConfig_dir != false unless use_tclConfig || use_tkConfig puts("Don't use [tclConfig.sh, tkConfig.sh]") return [nil, nil] end tclConfig_file = nil unless tclConfig_file.kind_of? String tkConfig_file = nil unless tkConfig_file.kind_of? String tclConfig_dir = nil unless tclConfig_dir.kind_of? String tkConfig_dir = nil unless tkConfig_dir.kind_of? String if use_tclConfig && !tclConfig_dir if tclConfig_file tclConfig_dir = File.dirname(tclConfig_file) elsif tkConfig_dir tclConfig_dir = tkConfig_dir end end if use_tkConfig && !tkConfig_dir if tkConfig_file tkConfig_dir = File.dirname(tkConfig_file) elsif tclConfig_dir tkConfig_dir = tclConfig_dir end end tkConfig_dir ||= tclConfig_dir if use_tclConfig TkLib_Config["tclConfig-file"] = tclConfig_file TkLib_Config["tclConfig-dir"] = tclConfig_dir else tclConfig_file = false tclConfig_dir = false end if use_tkConfig TkLib_Config["tkConfig-file"] = tkConfig_file TkLib_Config["tkConfig-dir"] = tkConfig_dir else tkConfig_file = false tkConfig_dir = false end print ("Don't use tclConfig.sh (specified by configure option).\n") unless use_tclConfig print ("Don't use tkConfig.sh (specified by configure option).\n") unless use_tkConfig print("Search ") print("tclConfig.sh", (tclConfig_dir)? " (in #{tclConfig_dir})": "") if use_tclConfig print((use_tclConfig)? " and ": "", "tkConfig.sh", (tkConfig_dir)? " (in #{tkConfig_dir})": "") if use_tkConfig print(".") if tclConfig_dir || tkConfig_dir || !use_tclConfig || !use_tkConfig tclConfig, tkConfig = search_tclConfig([ ((tclConfig_file)? tclConfig_file: tclConfig_dir), ((tkConfig_file)? tkConfig_file: tkConfig_dir) ]) else tclConfig, tkConfig = search_tclConfig() end print("\n") # TclConfig_Info = TkLib_Config["tclConfig_info"] # TkConfig_Info = TkLib_Config["tkConfig_info"] if tclConfig || tkConfig dirs = TkLib_Config["tclConfig_paths"].map{|tclpath, tkpath| [ (tclpath)? File.dirname(tclpath): nil, (tkpath)? File.dirname(tkpath): nil ] } dirs |= dirs puts("Valid [tclConfig.sh, tkConfig.sh] are found in #{dirs.inspect}") puts("Use [tclConfig.sh, tkConfig.sh] == #{[tclConfig, tkConfig].inspect}") $LIBPATH ||= [] $LIBPATH |= [File.dirname(tclConfig)] if tclConfig $LIBPATH |= [File.dirname(tkConfig)] if tkConfig #TkLib_Config["tclConfig_paths"].each{|tclcfg, tkcfg| # $LIBPATH |= [File.dirname(tclcfg)] | [File.dirname(tkcfg)] #} else puts("Fail to find [tclConfig.sh, tkConfig.sh]") end [tclConfig, tkConfig] end |
#get_tclConfig_dirs ⇒ Object
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 |
# File 'ext/tk/extconf.rb', line 425 def get_tclConfig_dirs config_dir = [] if CROSS_COMPILING elsif is_win32? if TkLib_Config["ActiveTcl"] dirs = [] if TkLib_Config["ActiveTcl"].kind_of?(String) dirs << File.join(TkLib_Config["ActiveTcl"], 'lib') end dirs.concat [ "c:/ActiveTcl*/lib", "c:/Tcl*/lib", "c:/Program Files*/ActiveTcl*/lib", "c:/Program Files*/Tcl*/lib", "/ActiveTcl*/lib", "/Tcl*/lib", "/Program Files*/ActiveTcl*/lib", "/Program Files*/Tcl*/lib" ] else dirs = [ "c:/Tcl*/lib", "c:/Program Files*/Tcl*/lib", "/Tcl*/lib", "/Program Files*/Tcl*/lib" ] end dirs = dirs.collect{|d| Dir.glob(d, File::FNM_CASEFOLD)}.flatten.uniq dirs |= ENV['LIBRARY_PATH'].split(';') if ENV['LIBRARY_PATH'] dirs |= ENV['PATH'].split(';') if ENV['PATH'] exeext = RbConfig::CONFIG['EXEEXT'] ENV['PATH'].split(File::PATH_SEPARATOR).each{|dir| dir.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR next if Dir.glob(File.join(dir, "{tclsh,wish}*#{exeext}"), File::FNM_CASEFOLD).empty? dirs << File.(File.join(dir, '..', 'lib')) dirs << dir # 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)) else if framework = find_macosx_framework() config_dir.unshift(framework) end if activeTcl = TkLib_Config['ActiveTcl'] # check latest version at first if is_macosx? base = File.(activeTcl) config_dir << [ File.join(base, 'Tcl.framework'), File.join(base, 'Tk.framework') ] config_dir << [ File.join(base, 'Tcl.framework', 'Versions', 'Current'), File.join(base, 'Tk.framework', 'Versions', 'Current') ] Dir.glob(File.join(base, 'Tcl.framework', 'Versions', '*')).sort.reverse.each{|dir| next if dir =~ /Current/ config_dir << [dir, dir.gsub(/Tcl/, 'Tk')] } else config_dir.concat(Dir.glob(File.join(activeTcl, 'lib'), File::FNM_CASEFOLD).sort.reverse) end end config_dir << RbConfig::CONFIG['libdir'] ((maybe_64bit?)? ['lib64', 'lib']: ['lib']).each{|dir| config_dir.concat [ File.join(RbConfig::CONFIG['exec_prefix'], dir), File.join(RbConfig::CONFIG['prefix'], dir), "/usr/local/opt/#{dir}", "/usr/local/pkg/#{dir}", "/usr/local/share/#{dir}", "/usr/local/#{dir}", "/usr/opt/#{dir}", "/usr/pkg/#{dir}", "/usr/share/#{dir}", "/usr/contrib/#{dir}", "/usr/#{dir}" ] } config_dir.concat [ '/opt', '/pkg', '/share', '/usr/local/opt', '/usr/local/pkg', '/usr/local/share', '/usr/local', '/usr/opt', '/usr/pkg', '/usr/share', '/usr/contrib', '/usr' ].map{|dir| Dir.glob(dir + "/{tcltk,tcl,tk}[#{TkLib_Config['major_nums']}]*/lib", File::FNM_CASEFOLD) Dir.glob(dir + "/{tcltk,tcl,tk}[#{TkLib_Config['major_nums']}]*", File::FNM_CASEFOLD) Dir.glob(dir + '/{tcltk,tcl,tk}/lib', File::FNM_CASEFOLD) Dir.glob(dir + '/{tcltk,tcl,tk}', File::FNM_CASEFOLD) }.flatten! exeext = RbConfig::CONFIG['EXEEXT'] ENV['PATH'].split(File::PATH_SEPARATOR).each{|dir| dir.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR next if Dir.glob(File.join(dir, "{tclsh,wish}*#{exeext}"), File::FNM_CASEFOLD).empty? config_dir << File.(File.join(dir, '..', 'lib')) } # for MacOS X paths = [ #"~/Library/Tcl", "/Library/Tcl", "/Network/Library/Tcl", "/System/Library/Tcl" ] paths.reverse! unless TkLib_Config["ActiveTcl"] paths.each{|path| config_dir << path config_dir.concat(Dir.glob(File.join(path, '{tcl,tk}*'), File::FNM_CASEFOLD).sort.reverse.find_all{|d| File.directory?(d)}) } paths = [ #"~/Library/Frameworks", "/Library/Frameworks", "/Network/Library/Frameworks", "/System/Library/Frameworks" ] paths.reverse! unless TkLib_Config["ActiveTcl"] paths.each{|frmwk| base = File.(frmwk) config_dir << [ File.join(base, 'Tcl.framework'), File.join(base, 'Tk.framework') ] config_dir << [ File.join(base, 'Tcl.framework', 'Versions', 'Current'), File.join(base, 'Tk.framework', 'Versions', 'Current') ] Dir.glob(File.join(base, 'Tcl.framework', 'Versions', '*')).sort.reverse.each{|dir| next if dir =~ /Current/ config_dir << [dir, dir.gsub(/Tcl/, 'Tk')] } } end config_dir end |
#help_msg ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/tkextlib/pkg_checker.rb', line 17 def help_msg print "Usage: #{$0} [-l] [-v] [-h] [--] [dir]\n" print "\tIf dir is omitted, check the directory that this command exists.\n" print "\tAvailable options are \n" print "\t -l : Add dir to $LOAD_PATH\n" print "\t (If dir == '<parent>/tkextlib', add <parent> also.)\n" print "\t -v : Verbose mode (show reason of fail)\n" print "\t -h : Show this message\n" print "\t -- : End of options\n" end |
#is_macosx? ⇒ Boolean
124 125 126 |
# File 'ext/tk/extconf.rb', line 124 def is_macosx? /darwin/ =~ RUBY_PLATFORM end |
#is_win32? ⇒ Boolean
functions
120 121 122 |
# File 'ext/tk/extconf.rb', line 120 def is_win32? /mswin|mingw|cygwin|bccwin/ =~ RUBY_PLATFORM end |
#libcheck_for_tclConfig(tcldir, tkdir, tclconf, tkconf) ⇒ Object
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 |
# File 'ext/tk/extconf.rb', line 587 def libcheck_for_tclConfig(tcldir, tkdir, tclconf, tkconf) tcllib_ok = tklib_ok = false if TkLib_Config["tcltk-stubs"] stub = "stub" tclfunc = "Tcl_InitStubs" tkfunc = "Tk_InitStubs" else stub = "" tclfunc = "Tcl_FindExecutable" tkfunc = "Tk_Init" end incflags = ($INCFLAGS ||= "").dup libpath = ($LIBPATH ||= []).dup libs_param = ($libs ||= "").dup tcllibs = nil mkmf_param = nil tclver, tkver = TkLib_Config["tcltkversion"] exts = "(" + get_ext_list.join('|') + ")" if tclver tcl_glob = "*tcl#{stub}#{tclver}.*" tcl_regexp = /^.*(tcl#{stub}#{tclver}.*)\.(#{exts}).*$/ elsif tclconf tcl_glob = "*tcl#{stub}#{tclconf['TCL_MAJOR_VERSION']}{.,}#{tclconf['TCL_MINOR_VERSION']}*.*" tcl_regexp = /^.*(tcl#{stub}#{tclconf['TCL_MAJOR_VERSION']}(?:\.|)#{tclconf['TCL_MINOR_VERSION']}.*)\.(#{exts}).*$/ end if tkver tk_glob = "*tk#{stub}#{tkver}.*" tk_regexp = /^.*(tk#{stub}#{tkver}.*)\.(#{exts}).*$/ elsif tkconf tk_glob = "*tk#{stub}#{tkconf['TK_MAJOR_VERSION']}{.,}#{tkconf['TK_MINOR_VERSION']}*.*" tk_regexp = /^.*(tk#{stub}#{tkconf['TK_MAJOR_VERSION']}(?:\.|)#{tkconf['TK_MINOR_VERSION']}.*)\.#{exts}.*$/ end tcllib_ok ||= !tclconf || Dir.glob(File.join(tcldir, tcl_glob), File::FNM_CASEFOLD).find{|file| if file =~ tcl_regexp libname = $1 ext = $2.downcase begin $INCFLAGS = incflags.dup << " " << tclconf["TCL_INCLUDE_SPEC"] #puts "check #{file} #{$1} #{tclfunc} #{tcldir}" #find_library($1, tclfunc, tcldir) if (tclconf && tclconf["TCL_SHARED_BUILD"] == "0") || (ext != CONFIG['DLEXT'] && ext == CONFIG['LIBEXT']) || ext == "a" # static link tcllibs = $libs + " -DSTATIC_BUILD " + file.quote # FIX ME: avoid pathname trouble (fail to find) on MinGW. # e.g. TCL_INCLUDE_SPEC describes "-I/usr/local/include", # but compiler can find "-IC:/msys/1.0/local/include" only. $INCFLAGS << " -I" << File.join(File.dirname(File.dirname(file)),"include") if is_win32? else tcllibs = append_library($libs, libname) tcllibs = "#{libpathflag([tcldir])} #{tcllibs}" # FIX ME: avoid pathname trouble (fail to find) on MinGW. $INCFLAGS << " -I" << File.join(File.dirname(tcldir),"include") if is_win32? end $LIBPATH = libpath | [tcldir] try_func(tclfunc, tcllibs, ["tcl.h"]) || ( try_func(tclfunc, tcllibs << " " << tclconf['TCL_LIBS'], ["tcl.h"]) if tclconf['TCL_LIBS'] ) ensure mkmf_param = { 'PATH' => file, 'LIBNAME' => libname, 'libs' => tcllibs.dup, 'INCFLAGS' => $INCFLAGS.dup, 'LIBPATH' => $LIBPATH.dup, } $LIBPATH = libpath.dup $libs = libs_param.dup end end } tclconf['MKMF_PARAMS'] = mkmf_param if tclconf && tcllib_ok tklib_ok ||= !tkconf || Dir.glob(File.join(tkdir, tk_glob), File::FNM_CASEFOLD).find{|file| if file =~ tk_regexp libname = $1 ext = $2.downcase begin #puts "check #{file} #{$1} #{tkfunc} #{tkdir}" # find_library($1, tkfunc, tkdir) if (tkconf && tkconf["TCL_SHARED_BUILD"] == "0") || (ext != CONFIG['DLEXT'] && ext == CONFIG['LIBEXT']) || ext == "a" # static link tklibs = " -DSTATIC_BUILD " + file.quote # FIX ME: avoid pathname trouble (fail to find) on MinGW. $INCFLAGS << " -I" << File.join(File.dirname(File.dirname(file)),"include") if is_win32? else tklibs = append_library("", libname) #tklibs = append_library("", $1) tklibs = "#{libpathflag([tkdir])} #{tklibs}" # FIX ME: avoid pathname trouble (fail to find) on MinGW. $INCFLAGS << " -I" << File.join(File.dirname(tcldir),"include") if is_win32? end tklibs << " " << tcllibs if tcllibs tmp_tklibs = tklibs.dup $LIBPATH = libpath | [tkdir] try_func(tkfunc, tklibs, ["tcl.h", "tk.h"]) || ( try_func(tkfunc, tklibs << " " << tkconf['TK_LIBS'], ["tcl.h", "tk.h"]) if tkconf['TK_LIBS'] ) || ( try_func(tkfunc, (tklibs = tmp_tklibs.dup) << " " << tkconf['TK_XLIBSW'], ["tcl.h", "tk.h"]) if tkconf['TK_XLIBSW'] ) || ( try_func(tkfunc, tklibs << " " << tkconf['TK_LIBS'], ["tcl.h", "tk.h"]) if tkconf['TK_LIBS'] ) ensure mkmf_param = { 'PATH' => file, 'LIBNAME' => libname, 'libs' => tklibs.dup, 'INCFLAGS' => $INCFLAGS.dup, 'LIBPATH' => $LIBPATH.dup, } $LIBPATH = libpath.dup $libs = libs_param.dup end end } $INCFLAGS = incflags.dup tkconf['MKMF_PARAMS'] = mkmf_param if tkconf && tklib_ok [tcllib_ok, tklib_ok] end |
#maybe_64bit? ⇒ Boolean
128 129 130 |
# File 'ext/tk/extconf.rb', line 128 def maybe_64bit? /64|universal|s390x/ =~ RUBY_PLATFORM end |
#newline ⇒ Object
136 137 |
# File 'ext/tk/extconf.rb', line 136 def newline end |
#parse_tclConfig(file) ⇒ Object
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 |
# File 'ext/tk/extconf.rb', line 404 def parse_tclConfig(file) # check tclConfig.sh/tkConfig.sh tbl = Hash.new{|h,k| h[k] = ""} return tbl unless file IO.foreach(file){|line| line.strip! next if line !~ /^([^\#=][^=]*)=(['"]|)(.*)\2$/ key, val = $1, $3 tbl[key] = val.gsub(/\$\{([^}]+)\}/){|s| subst = $1 (tbl[subst])? tbl[subst]: s } rescue nil } tbl end |
#parse_TK_LIBS(tklibs) ⇒ Object
1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 |
# File 'ext/tk/extconf.rb', line 1205 def parse_TK_LIBS(tklibs) sfx = "lib|shlib|dll|so" re = /(("|')[^"']+\.(#{sfx})\2|[^"' ]+\.(#{sfx})|-l("|')[^"']+\5|-l[^" ]+)/#' tklibs.scan(re).map{|lib,| if lib =~ /^("|')([^"]+)\.(#{sfx})\1/ "\"-l#{$2}\"" elsif lib =~ /([^" ]+)\.(#{sfx})/ "-l#{$1}" else lib end }.join(' ') end |
#progress(s) ⇒ Object
133 134 135 |
# File 'ext/tk/extconf.rb', line 133 def progress(s) print(s) end |
#pthread_check ⇒ Object
1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 |
# File 'ext/tk/extconf.rb', line 1652 def pthread_check() tcl_major_ver = nil tcl_minor_ver = nil # Is tcl-thread given by user ? case enable_config("tcl-thread") when true tcl_enable_thread = true when false tcl_enable_thread = false else tcl_enable_thread = nil end if TclConfig_Info['config_file_path'] if tcl_enable_thread == true puts("\n""Warning: definition of tclConfig.sh is ignored, because --enable-tcl-thread option is given.") elsif tcl_enable_thread == false puts("\n""Warning: definition of tclConfig.sh is ignored, because --disable-tcl-thread option is given.") else # tcl-thread is unknown and tclConfig.sh is given if TclConfig_Info['TCL_THREADS'] tcl_enable_thread = (TclConfig_Info['TCL_THREADS'] == "1") else tcl_major_ver = TclConfig_Info['TCL_MAJOR_VERSION'].to_i tcl_minor_ver = TclConfig_Info['TCL_MINOR_VERSION'].to_i if tcl_major_ver < 8 || (tcl_major_ver == 8 && tcl_minor_ver == 0) tcl_enable_thread = false end end if tcl_enable_thread == nil # cannot find definition if tcl_major_ver puts("\n""Warning: '#{TclConfig_Info['config_file_path']}' doesn't include TCL_THREADS definition.") else puts("\n""Warning: '#{TclConfig_Info['config_file_path']}' may not be a tclConfig file.") end #tclConfig = false end end end if tcl_enable_thread == nil && !TclConfig_Info['config_file_path'] # tcl-thread is unknown and tclConfig is unavailable begin try_run("int main() { exit(0); }") rescue Exception # cannot try_run. Is CROSS-COMPILE environment? puts(%Q'\ ***************************************************************************** ** ** NATIVETHREAD SUPPORT CHECK WARNING: ** ** We cannot check the consistency of nativethread support between ** Ruby and the Tcl/Tk library in your environment (are you perhaps ** cross-compiling?). If nativethread support for these 2 packages ** is inconsistent you may find you get errors when running Ruby/Tk ** (e.g. hangs or segmentation faults). We strongly recommend ** you to check the consistency manually. ** ***************************************************************************** ') return true end end if tcl_enable_thread == nil # tcl-thread is unknown if try_run(<<EOF) #include <tcl.h> int main() { Tcl_Interp *ip; ip = Tcl_CreateInterp(); exit((Tcl_Eval(ip, "set tcl_platform(threaded)") == TCL_OK)? 0: 1); } EOF tcl_enable_thread = true elsif try_run(<<EOF) #include <tcl.h> static Tcl_ThreadDataKey dataKey; int main() { exit((Tcl_GetThreadData(&dataKey, 1) == dataKey)? 1: 0); } EOF tcl_enable_thread = true else tcl_enable_thread = false end end # check pthread mode if (TkLib_Config["ruby_with_thread"]) $CPPFLAGS ||= "" # ruby -> enable unless tcl_enable_thread # ruby -> enable && tcl -> disable puts(%Q'\ ***************************************************************************** ** ** NATIVETHREAD SUPPORT MODE WARNING: ** ** Ruby is compiled with --enable-pthread, but your Tcl/Tk library ** seems to be compiled without nativethread support. Although you can ** create the tcltklib library, this combination may cause errors (e.g. ** hangs or segmentation faults). If you have no reason to keep the ** current nativethread support status, we recommend you reconfigure and ** recompile the libraries so that both or neither support nativethreads. ** ** If you want change the status of nativethread support, please recompile ** Ruby without "--enable-pthread" configure option (If you use Ruby 1.9.x ** or later, you cannot remove this option, because it requires native- ** thread support.) or recompile Tcl/Tk with "--enable-threads" configure ** option (if your Tcl/Tk is later than or equal to Tcl/Tk 8.1). ** ***************************************************************************** ') end # ruby -> enable && tcl -> enable/disable if tcl_enable_thread $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1' else $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0' end return true else # ruby -> disable if tcl_enable_thread # ruby -> disable && tcl -> enable puts(%Q'\ ***************************************************************************** ** ** NATIVETHREAD SUPPORT MODE ERROR: ** ** Ruby is not compiled with --enable-pthread, but your Tcl/Tk ** library seems to be compiled with nativethread support. This ** combination may cause frequent hang or segmentation fault ** errors when Ruby/Tk is working. We recommend that you NEVER ** create the library with such a combination of nativethread support. ** ** Please recompile Ruby with the "--enable-pthread" configure option ** or recompile Tcl/Tk with the "--disable-threads" configure option. ** ***************************************************************************** ') $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1' return false else # ruby -> disable && tcl -> disable $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0' return true end end end |
#search_tclConfig(*paths) ⇒ Object
libdir list or [tcl-libdir|file, tk-libdir|file]
719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 |
# File 'ext/tk/extconf.rb', line 719 def search_tclConfig(*paths) # libdir list or [tcl-libdir|file, tk-libdir|file] TkLib_Config["tclConfig_paths"] = [] paths.compact! if paths.empty? config_dir = get_tclConfig_dirs elsif paths.length == 1 && !paths[0][0] && !paths[0][1] config_dir = get_tclConfig_dirs.map{|dir| if dir.kind_of? Array [ (paths[0][0] == false)? nil: dir[0], (paths[0][1] == false)? nil: dir[1] ] else [ (paths[0][0] == false)? nil: dir, (paths[0][1] == false)? nil: dir ] end } else # fixed tclConfig config_dir = [] paths.each{|path| if path.kind_of?(Array) config_dir << path else dirs = Dir.glob(path, File::FNM_CASEFOLD) config_dir.concat(dirs.zip(dirs)) end } end tclver, tkver = TkLib_Config['tcltkversion'] if tclver && tclver =~ /^\D*(\d)\.?(\d)?/ # ignore PATCH_LEVEL tclver_major = $1 tclver_minor = $2 else tclver_major = nil tclver_minor = nil end if tkver && tkver =~ /^\D*(\d)\.?(\d)?/ # ignore PATCH_LEVEL tkver_major = $1 tkver_minor = $2 else tkver_major = nil tkver_minor = nil end conf = nil progress_flag = false config_dir.uniq! config_dir.map{|dir| if dir.kind_of? Array [ (dir[0])? dir[0].strip.chomp('/'): nil, (dir[1])? dir[1].strip.chomp('/'): nil ] else dir.strip.chomp('/') end }.each{|dir| progress("."); progress_flag = true # print("check #{dir} ==>"); if dir.kind_of? Array tcldir, tkdir = dir else tcldir = tkdir = dir end tails = ['Config-shared.sh', 'config-shared.sh', 'Config.sh', 'config.sh'] if tcldir if File.file?(tcldir) tclcfg_files = [tcldir] * tails.length else tclcfg_files = tails.map{|f| File.join(tcldir, 'tcl' << f)} end else tclcfg_files = [nil] * tails.length end if tkdir if File.file?(tkdir) tkcfg_files = [tkdir] * tails.length else tkcfg_files = tails.map{|f| File.join(tkdir, 'tk' << f)} end else tkcfg_files = [nil] * tails.length end tclcfg_files.zip(tkcfg_files).map{|tclpath, tkpath| [ (tclpath && File.exist?(tclpath))? File.(tclpath): tclpath, (tkpath && File.exist?(tkpath))? File.(tkpath): tkpath ] }.uniq.each{|tclpath, tkpath| next if tclpath && !File.exist?(tclpath) next if tkpath && !File.exist?(tkpath) # parse tclConfig.sh/tkConfig.sh tclconf = (tclpath)? parse_tclConfig(tclpath): nil if tclconf if tclver && ((tclver_major && tclver_major != tclconf['TCL_MAJOR_VERSION']) || (tclver_minor && tclver_minor != tclconf['TCL_MINOR_VERSION'])) print("\n") if progress_flag puts "Ignore \"#{tclpath}\" (unmatch with configured version)." progress_flag = false next end if TkLib_Config['unsupported_versions'].find{|ver| ver == "#{tclconf['TCL_MAJOR_VERSION']}.#{tclconf['TCL_MINOR_VERSION']}"} print("\n") if progress_flag puts "Ignore \"#{tclpath}\" (unsupported version of Tcl/Tk)." progress_flag = false next end end tkconf = (tkpath)? parse_tclConfig(tkpath): nil if tkconf if tkver && ((tkver_major && tkver_major != tkconf['TK_MAJOR_VERSION']) || (tkver_minor && tkver_minor != tkconf['TK_MINOR_VERSION'])) print("\n") if progress_flag puts "Ignore \"#{tkpath}\" (unmatch with configured version)." progress_flag = false next end if TkLib_Config['unsupported_versions'].find{|ver| ver == "#{tkconf['TK_MAJOR_VERSION']}.#{tkconf['TK_MINOR_VERSION']}"} print("\n") if progress_flag puts "Ignore \"#{tkpath}\" (unsupported version of Tcl/Tk)." progress_flag = false next end end # nativethread check if !TkLib_Config["ruby_with_thread"] if tclconf if tclconf['TCL_THREADS'] == '1' puts "\nWARNING: found #{tclpath.inspect}, but it WITH nativethread-support under ruby WITHOUT nativethread-support. So, ignore it." TkLib_Config["tcl-NG-path"] << File.dirname(tclpath) next end else puts "\nWARNING: When not refer tclConfig.sh, cannot check native-thread support on Tcl/Tk libraries. Ruby, which is used now, does NOT support native-thread. So, if Tcl/Tk libraries support native-thread, it will NOT work properly." end end # find tclConfig.sh & tkConfig.sh conf = [tclconf, tkconf] unless conf # check Tcl library if is_macosx? && TkLib_Config["tcltk-framework"] # if use framework, not check (believe it is installed properly) tcllib_ok = tklib_ok = true else tcllib_ok, tklib_ok = libcheck_for_tclConfig((tclpath)? File.dirname(tclpath): nil, (tkpath)? File.dirname(tkpath): nil, tclconf, tkconf) end unless tcllib_ok && tklib_ok unless tcllib_ok puts "\nWARNING: found #{tclpath.inspect}, but cannot find valid Tcl library for the tclConfig.sh. So, ignore it." TkLib_Config["tcl-NG-path"] << File.dirname(tclpath) end unless tklib_ok puts "\nWARNING: found #{tkpath.inspect}, but cannot find valid Tk library for the tkConfig.sh. So, ignore it." TkLib_Config["tk-NG-path"] << File.dirname(tkpath) end next end #return [tclpath, tkpath] # print(" #{[tclpath, tkpath].inspect}"); TkLib_Config["tclConfig_paths"] << [tclpath, tkpath] } # print("\n"); } if is_macosx? && TkLib_Config["tcltk-stubs"] CONFIG['LDSHARED'] << " -Xlinker -bind_at_load" if config_string('LDSHAREDXX') config_string('LDSHAREDXX') << " -Xlinker -bind_at_load" end end if TkLib_Config["tclConfig_paths"].empty? [nil, nil] else # find tclConfig.sh and tkConfig.sh TkLib_Config["tclConfig_info"], TkLib_Config["tkConfig_info"] = conf TkLib_Config["tclConfig_paths"][0] end end |
#search_vers_on_path(vers, path, *heads) ⇒ Object
1070 1071 1072 1073 1074 |
# File 'ext/tk/extconf.rb', line 1070 def search_vers_on_path(vers, path, *heads) exts = get_ext_list.join(',') files = Dir.glob(File.join(path, "*{#{heads.join(',')}}*.{#{exts}}"), File::FNM_CASEFOLD) vers.find_all{|ver| files.find{|f| f =~ /(#{ver}|#{ver.delete('.')})/} } end |
#search_X_libraries ⇒ Object
1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 |
# File 'ext/tk/extconf.rb', line 1610 def search_X_libraries use_tkConfig = false if TkConfig_Info['config_file_path'] # use definitions on tkConfig.sh if (/\S/ =~ TkConfig_Info['TK_XINCLUDES'] || /\S/ =~ TkConfig_Info['TK_XLIBSW']) use_tkConfig = true #use_X = true && with_config("X11", ! is_win32?) use_X = with_config("X11", true) else #use_X = false || with_config("X11", false) use_X = with_config("X11", false) end else # depend on configure options use_X = with_config("X11", !(is_win32? || TkLib_Config["tcltk-framework"])) end if /\S/ =~ TkConfig_Info['TK_XINCLUDES'] ($INCFLAGS ||= "") << " " << TkConfig_Info['TK_XINCLUDES'].strip end if use_X puts("Use X11 libraries (or use TK_XINCLUDES/TK_XLIBSW information on tkConfig.sh).") x11_idir, x11_ldir = dir_config("X11") x11_ldir2 = with_config("X11-lib") unless find_X11(x11_ldir2, x11_ldir) puts("Can't find X11 libraries. ") if use_tkConfig && /\S/ =~ TkConfig_Info['TK_XLIBSW'] puts("But, try to use TK_XLIBSW information (believe tkConfig.sh).") ($libs ||= "") << " " << TkConfig_Info['TK_XLIBSW'] << " " else puts("So, can't make tcltklib.so which is required by Ruby/Tk.") exit end end end use_X end |
#setup_for_macosx_framework(tclver, tkver) ⇒ Object
1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 |
# File 'ext/tk/extconf.rb', line 1552 def setup_for_macosx_framework(tclver, tkver) # use framework, but no tclConfig.sh unless $LIBS && $LIBS.include?('-framework') ($LIBS ||= "") << ' -framework Tk -framework Tcl' end if TkLib_Config["tcl-framework-header"] TclConfig_Info['TCL_INCLUDE_SPEC'][0,0] = " -I#{TkLib_Config["tcl-framework-header"].quote} " else tcl_base = File.join(TkLib_Config["tcltk-framework"], 'Tcl.framework') if tclver TclConfig_Info['TCL_INCLUDE_SPEC'] << " -I#{File.join(tcl_base, 'Versions', tclver, 'Headers').quote} " end TclConfig_Info['TCL_INCLUDE_SPEC'] << File.join(tcl_base, 'Headers') unless tclver dir = Dir.glob(File.join(tcl_base, 'Versions', '*', 'Headers'), File::FNM_CASEFOLD).sort.reverse[0] TclConfig_Info['TCL_INCLUDE_SPEC'] << "-I#{dir.quote} " if dir end end if TkLib_Config["tk-framework-header"] TkConfig_Info['TK_INCLUDE_SPEC'][0,0] = " -I#{TkLib_Config["tk-framework-header"].quote} " else tk_base = File.join(TkLib_Config["tcltk-framework"], 'Tk.framework') if tkver TkConfig_Info['TK_INCLUDE_SPEC'] << " -I#{File.join(tk_base, 'Versions', tkver, 'Headers').quote} " end TkConfig_Info['TK_INCLUDE_SPEC'] << File.join(tk_base, 'Headers') unless tkver dir = Dir.glob(File.join(tk_base, 'Versions', '*', 'Headers'), File::FNM_CASEFOLD).sort.reverse[0] TkConfig_Info['TK_INCLUDE_SPEC'] << "-I#{dir.quote} " if dir end end end |
#subdir_check(dir, verbose = false) ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/tkextlib/pkg_checker.rb', line 144 def subdir_check(dir, verbose=false) Dir.foreach(dir){|f| next if f == '.' || f == '..' if File.directory?(f) subdir_check(File.join(dir, f)) elsif File.extname(f) == '.rb' path = File.join(dir, f) suc, err = check_pkg(path, verbose) if err.empty? print 'Ready : ', path, ' : require->', suc.inspect, "\n" else print '*LACK : ', path, ' : require->', suc.inspect, ' FAIL->', err.inspect, "\n" end end } end |
#TkGrid(*args) ⇒ Object
19 |
# File 'lib/tk/autoload.rb', line 19 def TkGrid(*args); TkGrid.configure(*args); end |