Robert,
The way this works is the 'platform' attribute of the Gem::Specification
object in your .gemspec. Normally, for pure-Ruby libraries, this is set to
Gem:
latform::RUBY. We are gonna release a 0.8.0 version that adds the
ability to specify:
spec.platform = Gem:
latform::CURRENT
Which pulls the current platform (from RUBY_PLATFORM) and sets it as a
binary gem. So, on win32, if you do a:
gem build mygem.gemspec
With the cygwin-based Ruby, it will set that as the platfrom (and the name
will be something like mygem-0.1.0-cygwin.gem or soemthing), if you run it
from the standard win32 version it will be named mygem-0.1.0-mswin32.gem.
When you say:
gem install mygem
It will present a list of available platforms (and identify your current
platform) for you to choose from. You could also publish one with the
platform as RUBY and specify:
spec.extensions << 'ext/extconf.rb'
...or wherever your extconf.rb is for the native extension itself and that
will be presented as a source version. If there was no binary version
available for your platform, or you were so inclined to build it for
yourself, you could select the source version of the gem from the list and
it will build the extension upon gem install.
This choosing between platforms will be all operational in 0.8.0 of
rubygems...which should be out within a week.