Unfortunately, the Ruby library for Camellia is only available
as a RubyGem in two flavours,
i486-linux, neither of which is much use if you’re on
Mac OS X.
Fortunately, with a bit of work, you can get it to compile. I’ll assume in these instructions that you’re using Ruby from MacPorts. I also can’t guarantee that this works on PowerPC Macs: I’ve only tried it on Intel.
The first prerequisite is the Camellia library itself; that’s a straightforward case of downloading the source (use the ‘Unix/Linux’ distribution), expanding the archive and doing the usual incantation:
./configure && make && sudo make install
For the gem itself, it’s a bit more complicated. There’s no
source distribution as such, but it’s easy enough to pick apart the
file once you’ve downloaded
it (go for the
mkdir camellia-gem cd camellia-gem tar xvf ../camellia-2.5.10-i486-linux.gem tar zxvf data.tar.gz cd ext
The only thing that stops the gem compiling out of the box is a
couple of linker settings; change the line in
extconf.rb that reads
CONFIG['LDSHARED'] = "g++ -shared -lCamellia"
CONFIG['LDSHARED'] = "g++ -lCamellia -bundle -flat_namespace -undefined suppress"
You can now build the extension:
ruby extconf.rb && make
You should now have a
camellia.bundle file; check
whether it has built correctly:
ruby -d -w -e 'require "camellia"'
If you get no errors, everything worked. You can copy
camellia.bundle into your
directory so that it’s available to all programs:
sudo cp camellia.bundle /opt/local/lib/ruby/site_ruby/1.8/
That’s it! Now try some of the demo code ....