[MacRuby-devel] HAVE_RUBY_VM_H and nkf.bundle (was: installing tmail)

Laurent Sansonetti lsansonetti at apple.com
Wed May 12 12:42:20 PDT 2010


Hi Brian,

On May 12, 2010, at 10:17 AM, Brian Marick wrote:

> The problem with installing TMail are lines like this in tmailscanner.c
> 
> #ifdef HAVE_RUBY_VM_H
> #include "ruby/re.h"
> #include "ruby/encoding.h"
> #else
> #include "re.h"
> #endif
> 
> I suspect "HAVE_RUBY_VM_H" is being used as a synonym for "on 1.9". It's defined once in the 1.9 source I have, never used. It's not defined in either 1.8.7 or MacRuby.
> 
> Is there a more correct way to say "compiling against 1.9"? I don't see anything obvious in the include files, other than parsing it out of paths.

(I should have read all the messages first :-).)

I agree, it sounds like they use HAVE_RUBY_VM_H to determine if they build against 1.9. We need to define that variable in MacRuby too.

I don't think there is a better way yet. I know that Nokogiri does something even worse (it assumes it's 1.9 if the encoding.h header exists, or something similar).

> Hacking around that gets tmailscanner.c to compile, but tmail also requires 'nkf.bundle', which exists in 1.8 but not in MacRuby. I might try to compile the version out of 1.9, but this pile of yak hair is getting pretty deep, considering I just want to parse RFC822 headers.

We don't compile the nkf extension yet because we thought it wouldn't been necessary with the new 1.9 encodings API. But it looks like we might have to ship it nevertheless. I suspect we should be able to make a pure Ruby version for it.

In the meantime, I'm afraid you will have to hack the tmail sources to avoid using nkf (or create a fake nkf.rb file and put it in the path).

Laurent


More information about the MacRuby-devel mailing list