From: Elliott Hughes Date: 2003-08-08T18:44:55+09:00 Subject: tk out-of-box on Mac OS X [PATCH] This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C35D91.B515C610 Content-Type: text/plain In case Apple decides to go to Ruby 1.8.0 for Mac OS X 10.3, it might be nice to have tk "just work". There are three problems: 1. Mac OS X 10.2 doesn't come with tcl/tk, you have to download it from Apple. Hopefully they'll fix this. 2. Mac OS X doesn't keep tcl/tk where other Unixes do. Hopefully they won't fix this if they want to use this patch ;-) 3. Tk only works if started from a .app bundle. Hopefully they'll fix this. I've posted detailed copy-and-pasteable information about getting around point 3 here: http://www.rubygarden.com/ruby?RubyTkOnOSX where you can also see an earlier patch I don't think I like as much as the one here. What does the panel think? --elliott Index: ext/tcltklib/extconf.rb =================================================================== RCS file: /src/ruby/ext/tcltklib/extconf.rb,v retrieving revision 1.15 diff -u -r1.15 extconf.rb --- ext/tcltklib/extconf.rb 20 Mar 2003 06:27:16 -0000 1.15 +++ ext/tcltklib/extconf.rb 8 Aug 2003 09:36:26 -0000 @@ -47,11 +47,23 @@ end end -if have_header("tcl.h") && have_header("tk.h") && +mac_os_x_tcl_framework_headers = "/Library/Frameworks/Tcl.framework/headers" +mac_os_x_tk_framework_headers = "/Library/Frameworks/Tk.framework/headers" +use_mac_os_x_tk = false + +if RUBY_PLATFORM =~ /darwin/ && + File.exists?(mac_os_x_tcl_framework_headers) && + File.exists?(mac_os_x_tk_framework_headers) + $CPPFLAGS += " -I#{mac_os_x_tcl_framework_headers} -I#{mac_os_x_tk_framework_headers}" + $LDFLAGS += ' -framework Tk -framework Tcl' + use_mac_os_x_tk = true +end + +if (have_header("tcl.h") && have_header("tk.h") && (/mswin32|mingw|cygwin|bccwin32/ =~ RUBY_PLATFORM || find_library("X11", "XOpenDisplay", "/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", "/usr/openwin/lib")) && find_tcl(tcllib, stubs) && - find_tk(tklib, stubs) + find_tk(tklib, stubs)) || use_mac_os_x_tk $CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs $CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM create_makefile("tcltklib") ********************************************************************* This e-mail and any attachment is confidential. It may only be read, copied and used by the intended recipient(s). If you are not the intended recipient(s), you may not copy, use, distribute, forward, store or disclose this e-mail or any attachment. If you are not the intended recipient(s) or have otherwise received this e-mail in error, you should destroy it and any attachment and notify the sender by reply e-mail or send a message to sysadmin@bluearc.com ********************************************************************* ------_=_NextPart_000_01C35D91.B515C610 Content-Type: application/octet-stream; name="ruby-mac-os-tk-patch.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ruby-mac-os-tk-patch.txt" Index: ext/tcltklib/extconf.rb=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /src/ruby/ext/tcltklib/extconf.rb,v=0A= retrieving revision 1.15=0A= diff -u -r1.15 extconf.rb=0A= --- ext/tcltklib/extconf.rb 20 Mar 2003 06:27:16 -0000 1.15=0A= +++ ext/tcltklib/extconf.rb 8 Aug 2003 09:36:26 -0000=0A= @@ -47,11 +47,23 @@=0A= end=0A= end=0A= =0A= -if have_header("tcl.h") && have_header("tk.h") &&=0A= +mac_os_x_tcl_framework_headers =3D = "/Library/Frameworks/Tcl.framework/headers"=0A= +mac_os_x_tk_framework_headers =3D = "/Library/Frameworks/Tk.framework/headers"=0A= +use_mac_os_x_tk =3D false=0A= +=0A= +if RUBY_PLATFORM =3D~ /darwin/ &&=0A= + File.exists?(mac_os_x_tcl_framework_headers) &&=0A= + File.exists?(mac_os_x_tk_framework_headers)=0A= + $CPPFLAGS +=3D " -I#{mac_os_x_tcl_framework_headers} = -I#{mac_os_x_tk_framework_headers}"=0A= + $LDFLAGS +=3D ' -framework Tk -framework Tcl'=0A= + use_mac_os_x_tk =3D true=0A= +end=0A= +=0A= +if (have_header("tcl.h") && have_header("tk.h") &&=0A= (/mswin32|mingw|cygwin|bccwin32/ =3D~ RUBY_PLATFORM || = find_library("X11", "XOpenDisplay",=0A= "/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", = "/usr/openwin/lib")) &&=0A= find_tcl(tcllib, stubs) &&=0A= - find_tk(tklib, stubs)=0A= + find_tk(tklib, stubs)) || use_mac_os_x_tk=0A= $CPPFLAGS +=3D ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs=0A= $CPPFLAGS +=3D ' -D_WIN32' if /cygwin/ =3D~ RUBY_PLATFORM=0A= create_makefile("tcltklib")=0A= ------_=_NextPart_000_01C35D91.B515C610--