[Rubygems-developers] Binary gems or extension source - which and how?

Clifford Heath clifford.heath at gmail.com
Thu May 22 05:24:17 EDT 2008

On 22/05/2008, at 6:22 PM, Nic Williams wrote:
> If there are any lessons to be learned, and things to be added to  
> the newgem generator I'd love to have them.

Ahh, Hi Nic - congrats on becoming a Dad (again?)!

There were two things that tricked me:

If your extension has the name as the gem, and you have a lib/ 
<gemname>.rb file
that's supposed to load it, it doesn't (at least on Leopard). You need  
to give the
extension and the .rb file different basenames. Perhaps on LInux it's  
ok because
the shared library has a libXYZ.so name, I don't know.

The other thing, and perhaps this could go into the extconf_generator,  
is that you
need to add something like this to your config/hoe.rake:

# Arrange to build the extension on install:
$hoe.spec.extensions = ['ext/wbxml/extconf.rb']

where wbxml is a wildcard for your extensions. Otherwise hoe won't  
build them when
the gem gets installed.

Thanks for newgem BTW, it has saved me time several times now. This is  
the first
time I've used it with a gem having a C extension.

In the area of documentation, I used pure rubyforge for source and  
publishing because
I wasn't sure about how integrated the publishing is with source on  
github and the
releases going to rubyforge. If it's all fine and "just works"  
something should say so.

Some more clues or recipes on how to generate a source gem for most  
and a (say) Windows gem for deployment there (where folk often don't  
have a
compiler installed) would be good too.

Clifford Heath.

More information about the Rubygems-developers mailing list