Building Ruby Extensions with Rake

Posted by code_monkey_steve on Sep 8, 2006 Sep 8

At the moment, the tasks are a part of the RDBXML project, hosted by RubyForge . There is documentation, and you can view the latest version in SVN here.

Usage is simple enough:

{% highlight ruby }
require ‘rake/swigextensiontask’
desc “Build the BDB interface extension”
Rake::SWIGExtensionTask.new :db do |t|
t.dir = ‘ext’
t.link_libs += [‘db’, ‘db_cxx’]
end
{
endhighlight %}

This will build db.so, from the db.i SWIG interface file in the ext directory, linking-aginst db.so and db_cxx.so. For a full usage example, see the Rakefile for RDBXML.