Native cross-compiling (-packing) with GUI

Hi community,

i’m brand new to Ruby, but i like what i’ve seen by now.

After some time with Lazarus ( http://lazarus.freepascal.org ) and gcj (
http://gcc.gnu.org/java ) i unfortunately haven’t found what i am really
looking for. I hope i’ll find it in Ruby.

I want:

  1. coding on a GNU/Linux-machine
  2. creating GUI-programs (if possible with the luxus of a GUI-designer)
  3. compiling (or packing) against linux and win32 (=cross-compiling)
    ( 4) the compiled executable should fit on one 1.44-floppy … if
    possible )

my aim:
I want to share my programs to friends of mine (mostly windows-user),
and i dont want any installation-routine - i just want one executable
(or a folder with exe, dll/so, textfiles, etc) - so that i can explain
them: “download [file] from [url], unzip, and double-click on
[name].exe”

i searched the web for the last 3 days, but couldn’t find really
anything that matches point 3) from above - i tried exerb (of course)
but couldn’t create a working fox-gui-program (perhaps that was just a
fault of some miss-matching versions :-? ) … but fox could be good - i
think
Then i tried RubyScript2Exe, but it’s not possible to cross-compile with
it (will it ever be??) (does it run through wine? - haven’t tried yet).
Another problem with it: i can’t use UPX with a
RubyScript2Exe-OutputFile … dont know why.

so, if someone of you does have any hints, ideas, links, experiences,
etc for me - please tell me about them.

… and dont try to convince me to give up my goals - you wouldn’t
succed :wink:

so far
Meillo r e t u r n s

Le 23 déc. 05, à 14:44, Meillo r e t u r n s a écrit :

I want to share my programs to friends of mine (mostly windows-user),
fault of some miss-matching versions :-? ) … but fox could be good -
i
think
Then i tried RubyScript2Exe, but it’s not possible to cross-compile
with
it (will it ever be??) (does it run through wine? - haven’t tried yet).

I don’t think it will be possible to cross-compile with RubyScript2Exe.
My quick experiment of ruby with wine was not very successful.
Although, one thing that stopped me is that wine implementation is
based on win98 and the tools from win32-utils[1] works only on 2000/XP.
It might be possible to get wine to work as 2000/XP, not sure.

Maybe it is doable to use qemu or another hardware emulator to
test/package your script on windows without leaving your linux machine.

At this point, I also do all my development on Linux, but when the time
comes to package the app for windows, I run it on windows. At least to
see what it looks like and iron out the remaining cross-platform
wrinkles.

Guillaume.

[1] http://rubyforge.org/projects/win32utils/

I don’t think it will be possible to cross-compile with
RubyScript2Exe.

Indeed, cross-compiling with RubyScript2Exe is not possible.
Because of the gathering of files from your own Ruby
installation, RubyScript2Exe creates an executable for the
platform it’s being run on. In theory, you could trace the
application on Linux and gather the library files and gems it
uses from the Windows version of Ruby. I’ve investigated that
and it didn’t make me happy. For me, personally, there was no
need for it either.

Maybe it is doable to use qemu or another hardware emulator
to test/package your script on windows without leaving your
linux machine.

I run Linux on my laptop. On top of that, I installed Windows
98 in a virtual machine, using QEMU, and Windows 2000 in
another. Such a virtual machine is just one big file on the
native machine. When I have to boot a (not the) instance of
Windows 98, I simply run “win98clone abc”, which copies the
original win98.img to win98-abc.img (if it doesn’t already
exist…) and starts the virtual machine. In my win98-dev.img
(created with “win98clone dev”) I installed Ruby+GEMS+LIBS,
FPC, RubyScript2Exe, Tar2RubyScript and other tools I need to
build an application. When it’s time to test the executable, I
run “win98clone test”, which results in win98-test.img, another
copy of the original win98.img. No Ruby, no tools, just Windows
98. (Both Windows 98 machines run concurrently on top of
Linux!) Hopefully, this machine is able to boot the
application.exe I created on the development machine…

There’s one directory (/scratch) on my native machine that’s
available as S:-drives in all Windows machines. Transferring
data from one machine to another is no problem at all.

Conclusion:

  • Develop the application on Linux.
  • Build application.exe on Windows98-dev.
  • Test application.exe on Windows98-test.

gegroet,
Erik V. - http://www.erikveen.dds.nl/

Meillo r e t u r n s wrote:

I want:

  1. coding on a GNU/Linux-machine

No trouble. You just need to find yourself a decent GUI. I’ve had good
experience with jEdit and its Ruby plug in on Win32. It might work for
you as well.

  1. creating GUI-programs (if possible with the luxus of a GUI-designer)

I’d definitely go with GTK2 here. It’s portable and native looking (not
100% to OS X, but there’s work on that) on lots of platforms.

It’s Ruby bindings are highly comfortable and will make you feel like
you are coding in Ruby.

And there’s Glade which will let you drag&drop GUIs together and save
them to an XML file. It’s then very easy to load those XML files from
Ruby and to actually make things happen when widgets are clicked etc.

  1. compiling (or packing) against linux and win32 (=cross-compiling)
    ( 4) the compiled executable should fit on one 1.44-floppy … if
    possible )

There’s no compiling, but at least for Win32 and OS X there is
RubyScript2Exe. I’m not sure if it is also available for Linux, but if
everything else fails you will be able to pack all your files into a
single Ruby file for all platforms. And to binaries for others.

Ruby executables tend to be bigger than applications written in C and
Pascal, but the situation is still quite good.

A game I wrote used 385 KB after UPX packing it. That is without
additional SDL DLLs and data, however.

I’m not sure if a single floppy disk is possible when also including the
GTK2 libraries.

Also, GTK2 might need to be installed separately so that your
application works. This is a very simple procedure, however. Basically
you just have to click “Next” in the installer a few times.

X-Chat and Freeciv seem to include GTK2 itself in their installers,
lately. So that is probably easy to do as well.

TK will probably work without any setup, but it does less for you, the
programmer.

Then i tried RubyScript2Exe, but it’s not possible to cross-compile with
it (will it ever be??)

It sounds very possible. I’m pretty sure the developer would be able to
make this work if you ask nicely.

(does it run through wine? - haven’t tried yet).

I think so.

Another problem with it: i can’t use UPX with a
RubyScript2Exe-OutputFile … dont know why.

This worked fine for me. Tried contacting the developer yet?

Here’s a few links: