[Rubygems-developers] The return of PLATFORM constants

Eric Hodel drbrain at segment7.net
Thu May 15 03:45:43 EDT 2008

On May 11, 2008, at 10:18 AM, Daniel Berger wrote:

> I have a few C extensions where I would like to be able to provide a
> way to specify a generic platform.
> For example, the sys-cpu source is the same for both FreeBSD and OS X.
> However, as things stand now I must create two separate gems - one for
> each platform. Here's where a Gem::Platform::BSD constant would be
> very handy. Or whatever you want to call it.

The same binary works on FreeBSD and OS X?  Or is it a source-only gem?

If it is a source-only gem, is there a way to handle this with  
extconf.rb instead?  While OS X has FreeBSD roots, the two don't have  
completely compatible internals, so its hard to describe this in  

> I'm in a similar situation with gems that aren't particular to any
> version of a given platform or compiler. For example, the sys-cpu
> source for Solaris is the same for any version of Solaris, be it 2.6
> or 2.10. Here's where a Gem::Platform::SOLARIS would be very handy.
> Is there any chance of adding these? If not, what are my options
> outside of building a gem on every platform?

You should be able to hand-specify a platform with something like  
Gem::Platform.new 'x86-freebsd', but there seems to be a bug.

Currently Gem::Platform is rather strict, as it is easier to make it  
more permissive in future releases than less permissive in future  

More information about the Rubygems-developers mailing list