From: Hidetoshi NAGAI on
From: Albert Schlef <albertschlef(a)gmail.com>
Subject: Re: Tk on Windows and Mac OS X 10.6
Date: Wed, 17 Feb 2010 15:14:28 +0900
Message-ID: <a34cd9fcc380dd4e3514bf66803d3837(a)ruby-forum.com>
> It seems like a change in recent RubyInstallers, because I remember
> easily installing Ruby+Tk on Windows in the past.
>
> I'll try to investigate this.
>
> Hidetoshi NAGAI, are you there? Do you know anything about this?

I don't know about recent RubyInstallers.

# A kind of troubles on OneClickRuby with ActiveTcl depends on
# the 'Path' environment variable which doesn't include bin (dll)
# folder of ActiveTcl.

I heard tcltklib doesn't work on MacRuby.
But I have no Mac box, and I don't know what kinds of trouble exist
on compiling or running on MacRuby.
So, at present, I cannot develop Ruby/Tk (tcltklib) on MacRuby.

For MacRuby (and JRuby), tk-ffi may be a kind of solutions.
I've thought about using FFI in the past.
And then, I didn't have good idea to treat properly (without C
functions) exceptions on callbacks without break Tcl's event queue.

BTW,
I know that there are many problems to install or distribute Ruby/Tk.
I have a plan to create tcltklib.so includeing a Tcl/Tk environment.
When using such kind of tcltklib.so, Ruby/Tk never load the Tcl/Tk
libraries on the local environment (it means, no need installed Tcl/Tk).
Although it may be a kind of advantage for some people, it loses the
function about easy update of Tcl/Tk libraries (includes using Tcl/Tk
extensions which are installed to local Tcl/Tk environment without
re-create tcltklib.so) working with Ruby/Tk.
Of course, we can make each version of tcltklib.so.

It is based on the idea of Tclkit (Starkit).
If I can, I may try also to write a VFS-like library accessing
directly Tcl's Mk4VFS from Ruby.
The library is used to create a monolitic executable file of Ruby/Tk
application on Windows and Linux (and so on?).
I know that it is a kind of "reinvention of the wheel".
However, I think, it's worth treating Ruby and Tcl/Tk files on one VFS.
--
Hidetoshi NAGAI (nagai(a)ai.kyutech.ac.jp)

From: Axel on
> I know that there are many problems to install or distribute Ruby/Tk.
> I have a plan to create tcltklib.so includeing a Tcl/Tk environment.
> When using such kind of tcltklib.so, Ruby/Tk never load the Tcl/Tk
> libraries on the local environment (it means, no need installed Tcl/Tk).
> Although it may be a kind of advantage for some people, it loses the
> function about easy update of Tcl/Tk libraries (includes using Tcl/Tk
> extensions which are installed to local Tcl/Tk environment without
> re-create tcltklib.so) working with Ruby/Tk.

In advance, I was unhappy to need to install TCL (~ 23 MB), but
that was the only drawback. Installing ActiveTCL was without problems,
and as far as I understand, the licence is very permissive, even for
commercial use. And I was glad to _easily_ be able to install
additional TCL-libraries via "teacup", for example "plotchart", which
enables me to easily plot simple graphs from within Ruby without
having to deal with gnuplot.

For MRI-Ruby (mingw) despite installing ActiveTCL, I think, you
need only to copy precompiled Ruby/TK-binaries into the right dirs and
set the PATH-variable to the right paths. You need not to compile it
yourself. Can anybody confirm this?

And, from the licences, would it be allowed to freely distibute these
binaries?

If all this is right, I think, it could be easy to install Ruby/TK on
Windows-MRI-mingw-Ruby; IMHO, there are only few things needed:

- A site for uploading and downloading precompiled binaries of Ruby/TK
(or gem?)
(Again, from the licences, would it be allowed to freely distibute
these binaries?)
- A clear statement which binary is for which Ruby-version and
TCL/TK-version (important).
- A clear description of how the install the downloaded
Ruby/TK-binaries "copy files to xyz" (installer? gem? Roger Pack did
something like this...)
- A statement that it is a drawback that you have to install
AcitveState, but that it is the _only_ drawback and that it takes
~23 MB, that it's easy to install, that the licence is permissive
even for professional use (true?) and that it has the advantage of
enabling you to install additional packages, for example for
plotting
- A short description of how to install additional TCL/TK packages
using "teacup"
- A clear description on how to set the PATH-variable (or do it with
an installer script?)

If my assumptions are right, I think with the above list it would be
easy to install Ruby/TK on Windows-mingw-MRI-Ruby.

Axel
From: Hidetoshi NAGAI on
From: Axel <a99.googlegroups.a99(a)dfgh.net>
Subject: Re: Tk on Windows and Mac OS X 10.6
Date: Thu, 18 Feb 2010 21:30:16 +0900
Message-ID: <1191f673-a6e5-4379-8d95-9e012665be3e(a)q16g2000yqq.googlegroups.com>
> In advance, I was unhappy to need to install TCL (~ 23 MB), but
> that was the only drawback. Installing ActiveTCL was without problems,
> and as far as I understand, the licence is very permissive, even for
> commercial use. And I was glad to _easily_ be able to install
> additional TCL-libraries via "teacup", for example "plotchart", which
> enables me to easily plot simple graphs from within Ruby without
> having to deal with gnuplot.

On your environment only or machines under your control, it's no problem.
As you say (me too), it is the best way to use Ruby (and Ruby/Tk).
However, if you must run your application on other environment
without proper version of Tcl/Tk, you may have some troubles.
I think that a monolithic tcltklib.so library is one of the solutions
to avoid such kind of troubles.
It doesn't replace current binary style of tcltklib.so on Ruby/Tk.
It is a new(?) binary style of tcltklib.so, which merges a Tcl/Tk
environment as a virtual file system.
When you load it on Ruby, you can use Ruby/Tk without installing Tcl/Tk.
It need not write files to the local disk excluding temporal DLL files
to load.

Probably, the tool will contain a base tcltklib.so library,
a work environment (a file tree), and commands for packing/unpacking.

# Maybe, I merge some codes to Ruby/Tk to support such feature.

When you want to use additional Tcl/Tk libraries,
you need copy the libraries to the work environment and pack it to
the "tcltklib.so" file.
To copy the libraries, you maybe able to use TEAcup.
And probably, you'll be able to test your application working with
the monolitic tcltklib.so by running it on the work environment.

# If it is available to pack Ruby binary and environment by similar
# way, we can get a single executable file include all environment.

> And, from the licences, would it be allowed to freely distibute these
> binaries?

Hmm..., I've not thought about the licenses.
Probably, it will depend on Tcl/Tk, Metakit, tclvfs, Tclkit (Starkit),
libraries packed with, and so on.

# I'm sorry, if my poor english cannot explain exactly.
--
Hidetoshi NAGAI (nagai(a)ai.kyutech.ac.jp)

From: Axel on
> On your environment only or machines under your control, it's no problem.
> As you say (me too), it is the best way to use Ruby (and Ruby/Tk).
> However, if you must run your application on other environment
> without proper version of Tcl/Tk, you may have some troubles.

That's true. Would OCRA solve this problem?


> I think that a monolithic tcltklib.so library is one of the solutions
> to avoid such kind of troubles.
> ...
> # way, we can get a single executable file include all environment.

Sounds to me like a very good solution; but sounds like very difficult
and time-consuming, too.


> > And, from the licences, would it be allowed to freely distibute these
> > binaries?

I meant, for example, I've compiled Ruby/Tk with mingw, for a certain
version of Ruby and TK; would it be allowed to give these files to
everybody by download? Or, do you know, are there licence issues which
don't allow or restrict this?

Axel
From: Hidetoshi NAGAI on
From: Axel <a99.googlegroups.a99(a)dfgh.net>
Subject: Re: Tk on Windows and Mac OS X 10.6
Date: Fri, 19 Feb 2010 00:12:08 +0900
Message-ID: <e349167a-2928-448f-b330-410a968db43d(a)g26g2000yqn.googlegroups.com>
> That's true. Would OCRA solve this problem?

Maybe. My plan is not only one. It's one of the solutions.

> > I think that a monolithic tcltklib.so library is one of the solutions
> > to avoid such kind of troubles.
> > ...
> > # way, we can get a single executable file include all environment.
>
> Sounds to me like a very good solution; but sounds like very difficult
> and time-consuming, too.

Probably, not easy. But it will not so difficult as you think.
By using Tclkit and some experiments, I've already succeeded to make
a tcltklib.so merged a Tcl/Tk environment and create a TclTkIp object
with Tk (of course, the version of Tcl/Tk is the one of the merged) on
Ruby with the tcltklib.so.

> > > And, from the licences, would it be allowed to freely distibute these
> > > binaries?
> I meant, for example, I've compiled Ruby/Tk with mingw, for a certain
> version of Ruby and TK; would it be allowed to give these files to
> everybody by download? Or, do you know, are there licence issues which
> don't allow or restrict this?

Although I'm not well informed about licences, I think that you can
distribute the package or binary with the same restrict as the Tcl/Tk
package or binary created by Tclkit or Starkit.
--
Hidetoshi NAGAI (nagai(a)ai.kyutech.ac.jp)