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
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
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
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",
"/Network/Library/Frameworks", "/System/Library/Frameworks"
]
paths.reverse! unless TkLib_Config["ActiveTcl"]
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
|