[Rubygems-developers] How to bundle up MS Windows version separately

Luis Lavena luislavena at gmail.com
Mon Nov 5 09:32:33 EST 2007

On 11/5/07, Trans <transfire at gmail.com> wrote:
> I'm still confused by one thing. When I use setup.rb, it will compile
> extensions and I'll end with .so files located down in ext/ somewhere.
> For instacen with TMail:
>   ext/tmail/base64/base64.so
>   ext/tmail/scanner_c/scanner_c.so
> But when I create a gem how does gems know where to find the .so ?

On Mongrel we move the pre-compiled .so file to #{gem_name}/lib/

For the mswin32 platform, we use a conditional to pre-build the
extension and bundle it in the gem (adding it to files) and removing
from extensions to be compiled.

This avoids RubyGems firing the build process for them and instead use
the one we just compiled.

As Assaph commented, using #platform allow your create gems tailored
for each platform, but you require be on that platform unless you do
some cross-platform sandboxing (which on my experience didn't work
quite right).

Take a look to the Mongrel Rakefile:

It uses Echoe, but you can go back in time and check how Zed was doing
it previously.

Hope this helps,

Luis Lavena
Multimedia systems
Leaders are made, they are not born. They are made by hard effort,
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi

More information about the Rubygems-developers mailing list