Ruby/TK on Mac OS X Tiger?

That is correct. I used:

  $ ./configure --enable-mac-tcltk-framework

and I don't need X11 library to run RubyTk.

Goran

···

--- Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> wrote:

From: Mark Hubbart <discordantus@gmail.com>
Subject: Re: Ruby/TK on Mac OS X Tiger?
Date: Thu, 19 May 2005 16:43:12 +0900
Message-ID:
<de63abca05051900436025ed4b@mail.gmail.com>
> I'll try it out. I suspect Apple used it when
compiling, though, since
> they linked it against the framework.
>
> configure --prefix=/foo/local
--enable-mac-tcltk-framework --enable-pthread
    (snip)
> Here's the extconf output from a successful
configuration:
>
> mark@eMac% ruby extconf.rb
> checking for t_open() in -lnsl... no
> checking for socket() in -lsocket... no
> checking for dlopen() in -ldl... yes
> checking for log() in -lm... no
> checking for tcl.h... yes
> checking for tk.h... yes
> checking for XOpenDisplay() in -lX11... yes
> checking for Tcl_FindExecutable() in -ltcl... yes
> checking for Tk_Init() in -ltk... yes
> creating Makefile

Thank you for your report.
Possibly, at least one of the following tests
returns fail.

------------------------------------------------------------------

is_macosx = (/darwin/ =~ RUBY_PLATFORM)

mac_need_framework =
  is_macosx &&
  enable_config("mac-tcltk-framework", false) &&

FileTest.directory?("/Library/Frameworks/Tcl.framework/")

&&

FileTest.directory?("/Library/Frameworks/Tk.framework/")

------------------------------------------------------------------

Could you tell me about which test does make
"mac_need_framework"
value false?

# Or could you recommend better test for MacOS X
Framework?
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Message-ID: <20050519170423.59440.qmail@web81410.mail.yahoo.com>

That is correct. I used:

  $ ./configure --enable-mac-tcltk-framework

and I don't need X11 library to run RubyTk.

Thank you for your report.
However, I got a report that frameworks directory is changed
on MacOS X Tiger.
If you don't mind, please test the following patch of
ext/tcltklib/extconf.rb whether it has no trouble on your
environment.

Index: extconf.rb

···

From: Goran Stankovic <goran2@swbell.net>
Subject: Re: Ruby/TK on Mac OS X Tiger?
Date: Fri, 20 May 2005 02:04:29 +0900

RCS file: /var/cvs/src/ruby/ext/tcltklib/Attic/extconf.rb,v
retrieving revision 1.15.2.9
diff -u -r1.15.2.9 extconf.rb
--- extconf.rb 25 Jan 2005 05:08:21 -0000 1.15.2.9
+++ extconf.rb 20 May 2005 01:33:34 -0000
@@ -5,11 +5,23 @@
is_win32 = (/mswin32|mingw|cygwin|bccwin32/ =~ RUBY_PLATFORM)
is_macosx = (/darwin/ =~ RUBY_PLATFORM)

-mac_need_framework =
- is_macosx &&
- enable_config("mac-tcltk-framework", false) &&
- FileTest.directory?("/Library/Frameworks/Tcl.framework/") &&
- FileTest.directory?("/Library/Frameworks/Tk.framework/")
+def find_mac_framework
+ if macosx_frameworks = with_config("mac-tcltk-framework")
+ paths = [macosx_frameworks]
+ else
+ return false unless enable_config("mac-tcltk-framework", false)
+ paths = ["/Library/Frameworks", "/System/Library/Frameworks"]
+ end
+
+ paths.find{|dir|
+ dir.strip!
+ dir.chomp!('/')
+ FileTest.directory?(dir + "/Tcl.framework/") &&
+ FileTest.directory?(dir + "/Tk.framework/")
+ }
+end
+
+mac_need_framework = is_macosx && find_mac_framework()

unless is_win32
   have_library("nsl", "t_open")
@@ -259,7 +271,8 @@
   $CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM

   if mac_need_framework
- $CPPFLAGS += ' -I/Library/Frameworks/Tcl.framework/headers -I/Library/Frameworks/Tk.framework/Headers'
+ $CPPFLAGS += " -I#{mac_need_framework}/Tcl.framework/headers"
+ $CPPFLAGS += " -I#{mac_need_framework}/Tk.framework/Headers"
     $LDFLAGS += ' -framework Tk -framework Tcl'
   end

--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Message-ID: <20050520.103824.41656113.nagai@ai.kyutech.ac.jp>

If you don't mind, please test the following patch of
ext/tcltklib/extconf.rb whether it has no trouble on your
environment.

Is the following better?

Index: README.1st

···

From: Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
Subject: Re: Ruby/TK on Mac OS X Tiger?
Date: Fri, 20 May 2005 10:38:27 +0900

RCS file: /var/cvs/src/ruby/ext/tcltklib/Attic/README.1st,v
retrieving revision 1.4.2.3
diff -u -r1.4.2.3 README.1st
--- README.1st 2 Sep 2004 17:16:59 -0000 1.4.2.3
+++ README.1st 20 May 2005 17:47:57 -0000
@@ -22,7 +22,24 @@
  --with-tcl-lib=<dir> the directry containts 'libtcl<version>.so'
  --with-tk-lib=<dir> the directry containts 'libtk<version>.so'

- --enable-mac-tcltk-framework (Mac OSX only) use Tcl/Tk framework
+ --enable-mac-tcltk-framework (MacOS X) use Tcl/Tk framework
+ (Obsolete. Please use '--enable-tcltk-framework'.)
+
+ --enable-tcltk-framework use Tcl/Tk framework
+
+ --with-tcltk-framework=<dir> the directory containts Tcl/Tk framework;
+ "<dir>/Tcl.framework" and "<dir>/Tk.framework".
+ When this option is given, it is assumed that
+ --enable-tcltk-framework option is given also.
+
+ --with-tcl-framework-header=<dir>
+ Tcl framework headers directory
+ (e.g. "/Library/Frameworks/Tcl.framework/Headers")
+
+ --with-tk-framework-header=<dir>
+ Tk framework headers directory
+ (e.g. "/Library/Frameworks/Tk.framework/Headers")
+

If you forgot to give the options when do 'configure' on toplevel
directry of Ruby sources, please try something like as the followings.
Index: extconf.rb

RCS file: /var/cvs/src/ruby/ext/tcltklib/Attic/extconf.rb,v
retrieving revision 1.15.2.9
diff -u -r1.15.2.9 extconf.rb
--- extconf.rb 25 Jan 2005 05:08:21 -0000 1.15.2.9
+++ extconf.rb 20 May 2005 17:47:58 -0000
@@ -3,13 +3,34 @@
require 'mkmf'

is_win32 = (/mswin32|mingw|cygwin|bccwin32/ =~ RUBY_PLATFORM)
-is_macosx = (/darwin/ =~ RUBY_PLATFORM)
+#is_macosx = (/darwin/ =~ RUBY_PLATFORM)

-mac_need_framework =
- is_macosx &&
- enable_config("mac-tcltk-framework", false) &&
- FileTest.directory?("/Library/Frameworks/Tcl.framework/") &&
- FileTest.directory?("/Library/Frameworks/Tk.framework/")
+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
+
+tcl_framework_header = with_config("tcl-framework-header")
+tk_framework_header = with_config("tk-framework-header")
+
+tcltk_framework = find_framework(tcl_framework_header, tk_framework_header)

unless is_win32
   have_library("nsl", "t_open")
@@ -249,7 +270,7 @@
   end
end

-if mac_need_framework ||
+if tcltk_framework ||
    (have_header("tcl.h") && have_header("tk.h") &&
     (is_win32 || find_library("X11", "XOpenDisplay",
       "/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", "/usr/openwin/lib")) &&
@@ -258,8 +279,19 @@
   $CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs
   $CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM

- if mac_need_framework
- $CPPFLAGS += ' -I/Library/Frameworks/Tcl.framework/headers -I/Library/Frameworks/Tk.framework/Headers'
+ if tcltk_framework
+ if tcl_framework_header
+ $CPPFLAGS += " -I#{tcl_framework_header}"
+ else
+ $CPPFLAGS += " -I#{tcltk_framework}/Tcl.framework/Headers"
+ end
+
+ if tk_framework_header
+ $CPPFLAGS += " -I#{tk_framework_header}"
+ else
+ $CPPFLAGS += " -I#{tcltk_framework}/Tk.framework/Headers"
+ end
+
     $LDFLAGS += ' -framework Tk -framework Tcl'
   end

--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)