From: Richard Kilmer Date: 2004-08-26T23:05:30+09:00 Subject: Re: Binary gems with precompiled so files for different platforms? 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::Platform::RUBY. We are gonna release a 0.8.0 version that adds the ability to specify: spec.platform = Gem::Platform::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. More doc on the spec format is here: http://rubygems.rubyforge.org/wiki/wiki.pl?DeveloperGuide -rich On 8/26/04 8:47 AM, "Robert Feldt" wrote: > Kaspar Schiess wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Robert Feldt wrote: >> >> | Does RubyGems currently support precompiled binary gems so that I can >> | make one gem that then unpacks the right versions of the so/dll files >> | for the platform? >> >> Rubygems has no trouble with binary files in the newest version. I am >> building RMagick as a binary gem for the windows platform and this seems >> to work a charm for many people. What is the part that you don't >> understand ? Maybe I could give you more specific help than just a >> general how-to ? >> > I'm not sure there is something I don't understand... ;) > > I want to pack up a gem with precompiled files for linux, windows-cygwin > and windows-mswin32 and have the gem choose at install time which one to > install. > > I guess I could go down the route of multiple gems, one for each > platform, (as MF pointed out) but will the command > > "gem install --remote myproject" > > then know to dl the right one and install it or will the user have to > choose the "right" gem for their platform? > > Thanks, > > Robert > > > >