From: Tim Hunter Date: 2008-03-15T03:01:56+09:00 Subject: Re: installing C + Ruby extensions Gerardo Santana G�mez Garrido wrote: > I'm using mkmf for building and installing a C extension. I'm also > providing a gem. > > I'm thinking of reorganizing the code to extract those C bits that can > be coded in Ruby, and extend them in Ruby, while preserving a C core > that provides a Ruby interface for the libraries I'm linking to. > > My problem is how should my source tree look and what tools and how > should I use to have both the Ruby and the C portion built and > installed in the appropriate places. > > Preferrably avoiding rubygems, so that I don't force my users to have rubygems. > > Which makes me ask: if rubygems will be included in Ruby 2.0, �will it > be mandatory?, �would it make sense not to make a gem for an > extension? > > -- > Gerardo Santana > I use Minero Aoki's setup.rb (you can find it on the RAA) for RMagick. The code is a bit opaque but it's robust and mature. The source/build tree that setup uses is here: http://i.loveruby.net/en/projects/setup/doc/devel.html. RubyGems works well with setup.rb, and it's not hard to build a tar.gz version as well as a gem. I do not recommend avoiding RubyGems. Unless the typical consumer of your extension is different from the mainstream of Ruby programmers, I don't think it's going to be a problem "forcing" them to have RubyGems. In my experience 99% of Rubyists use RubyGems and probably half of them are not able to install an extension that is not supplied in the form of a gem. RubyGems is built in to 1.9.0. While I don't think its use will be *mandantory* it seems very useful to supply your extension as a gem. Since the main problem with RubyGems today is that people don't know to require "rubygems" before requiring the gem, having RubyGems built in to Ruby will be very nice indeed, both for us and for our users. -- RMagick: http://rmagick.rubyforge.org/ RMagick 2: http://rmagick.rubyforge.org/rmagick2.html