This Time Self-Hosted
dark mode light mode Search

Writing ruby extensions: hunspell

So, after my RubyTag++ bindings work, today I wanted to try writing a new set of bindings.

This time it is for a really trivial reason, that is writing a better spell module for rbot, as the default one uses ispell, that kinda sucks. What I had in mind was hunspell, as that is what it’s being used by Openoffice now, and that is quite interesting indeed.

I first had to work on hunspell to fix a problem with PIC on AMD64 that ended up with a patch (currently specific to Gentoo) to make use of libtool and thus building a shared version of libhunspell. This way it also fixed a TEXTREL issue with OpenOffice on x86, and was a step forward for porting OpenOffice 2 to AMD64 (yuppie).

This time then, I decided to give hunspell a good try, and so I started working on an extension. Luckily now that I wrote the bindings generator for RubyTag++ I know well enough how to start writing an extension, so I just fired up emacs and started writing the code.

The problem came when I wanted to put an extconfig.rb script.. as all the checks assume C libraries and C includes, rather than C++ as Hunspell is.
I looked around but I couldn’t find anything useful for that, so I decided to go with cmake, once again. I had already the FindRuby mdoule written for RubyTag++, and I just needed to write the CMakeFile.txt file.

Now I do have everything ready, and I just need to find time to add some documentation and then I’ll make a tarball, and then I’ll write the rbot module I had in mind when I started.

For who wants to follow the development, I have put ruby-hunspell on gitweb.

Update (2017-04-22): The repository is gone, I don’t know if I ahve it in any backup, Rubyforge shut down and I think the only other copy was on Gitorious, which also shut down.

Please note: it needs the patched hunspell from Gentoo right now, until the patch is merged upstream.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.