[Rubygems-developers] Building native gems for deployment
lyle.johnson at gmail.com
Fri Apr 13 14:54:23 EDT 2007
On 4/13/07, Graham Miller <gmiller at marketcetera.com> wrote:
> So I guess my question would be: what is the best way to install a gem onto
> a machine without having to do the native compilation step?
A "binary" gem (i.e. one that contains pre-compiled code for a
specific platform) really isn't all that different from a regular gem.
In the Gem spec for your binary gem, you'll want to set the platform
to the targeted platform, e.g.
Gem::Specification.new do |spec|
spec.platform = Gem::Platform::WIN32
The Gem::Platform module defines a couple of standard constants
(WIN32, LINUX_586 and DARWIN), but it's just a string, so put whatever
makes sense for the appliance platform that you're targeting.
You'll need to add to the spec.files definition the binary files that
you want to include (e.g. the *.so files). You can of course remove
the source code from spec.files too. You should probably remove the
spec.extensions definition altogether.
Note that when you build a gem with some platform other than RUBY (the
default), you're going to get a gem whose file name reflects the
target platform (e.g. "fxruby-1.6.10-mswin32.gem").
Hope this helps,
More information about the Rubygems-developers