Hi all!

What an EuRuKo doesn't make you do...
Should I put this on the Wiki somewhere, too?

I managed to cross compile ruby 1.8.3 for iPAQ, linux (familiar distro,
see http://handhelds.org) but I haven't uploaded or anything.

1) get a cross compiling toolchain (arm-linux-gcc and friends, including
some libs and stuff). in this case, it's a simple download from
handhelds.org

2) get an copy of the target environment, in my case
  $ cd ~/iPAQ/Image
  $ cat etc/ipkg.conf  # showing part of it...
  arch arm 10  # and some more
  option offline_root /home/kero/iPAQ/Image
  dest root /
  $ ipkg -f etc/ipkg.conf update
  $ ipkg -f etc/ipkg.conf install libreadline4 libreadline-dev  # etc, etc

3) ./configure --host=arm-linux --build=i686-gnu-linux --prefix=/usr \
	--enable-shared --disable-ipv6 --with-curses-include=/usr/include \
	--with-curses-lib=/home/kero/iPAQ/Image/usr/lib/ \
	--with-readline-dir=/home/kero/iPAQ/Image/ \
	--with-zlib-include=/usr/include \
	--with-zlib-lib=/home/kero/iPAQ/Image/usr/lib

Note 1: the readline dir, which is based on the target env in iPAQ/Image
(nice), as opposed to the curses and zlib lines, which are based on a plain
copy of /usr/lib and /lib from the iPAQ (ugly, even using x86 header
files...)

Note 2: Ruby needs a whole bunch of these, for tcl, tk, openssl, X11,
dbm(?) and possibly more of the stdlib things. Possibly --enable-socks

Note 3: as mentioned in a recent thread, you'll want
  $ export CONFIG_SITE=arm-config.site
  $ cat arm-config.site
  ac_cv_func_setpgrp_void=yes
which isn't as bad as e.g. openssh (sigh)

4) make DESTDIR=path/to/xcompile/lib libdir=path/to/xcompile/lib

Note 1: DESTDIR is abused via via in ext/* when linking .so files
Note 2: libdir is abused when linking ruby

both result in using -L/usr/lib/ (containing x86 stuff, not arm) if not
specified. I consider this a bug in the Ruby Makefile !

4) make install DESTDIR=/home/kero/iPAQ/Image/

Note 1: actually, I install it elsewhere in order to make a dozen ruby
packages. Some ruby scripts assist me there. I use a separate package
for each external dependency (readline, curses, tk, ...; zlib is an
exception I granted myself). Since it goes onto an iPAQ, I don't want
libstaticruby.a or extensive docs to munch precious Compact Flash
memory, this results in two more packages (that I don't use)

Note 2: I arm-linux-strip the binaries and shared libraries, before
packaging.

Hth,
Kero.

--
The last good thing written in C++ was the Pachelbel Canon
  Jerry Olson