[Rubygems-developers] Initial capability to build native (source) gems

Jamis Buck jgb3 at email.byu.edu
Tue Mar 30 06:48:34 EST 2004


Wonderful, Rich!  I'm excited to play with this one--I've been waiting 
for it. :)  Thanks!

- Jamis

Richard Kilmer wrote:
> All,
> 
> I have added the ability to build native extension gems from source.  
> This will not (yet) work on win32 using nmake (tomorrow).
> 
> To use this...
> 
> example gemspec:
> 
> require 'rubygems'
> 
> spec = Gem::Specification.new do |s|
> 
>   s.name = 'semitar'
>   s.version = "0.1.0"
>   s.platform = Gem::Platform::RUBY
>   s.summary = "Semitar is a pure Ruby Semantic Web library (RDF/RDFS/OWL)"
>   s.requirements << 'raptorlib rdf parser'
>   s.files = Dir.glob("{lib,ext}/**/*").delete_if {|item| 
> item.include?("CVS")}
>   s.require_path = 'lib'
>   s.extensions << 'ext/raptor/extconf.rb'
>   s.autorequire = 'semitar'
> 
>   s.has_rdoc=false
> 
>   s.author = "Richard Kilmer"
>   s.email = "rich at infoether.com"
>   s.homepage = "http://semitar.semwebcentral.org"
> end
> 
> if $0==__FILE__
>   Gem::Builder.new(spec).build
> end
> 
> _____
> 
> The key is having the:
> 
> s.extensions << 'ext/raptor/extconf.rb'
> 
> This will instruct the system to execute that extconf.rb file, then (if 
> the Makefile is created) do a 'make' and 'make install'.  I do a little 
> trick to make sure the 'make install' installs the shared 
> library/dll/bundle in the first 'require_path' for your gem.  This way 
> we do not have to have an additional path for the native library.
> 
> If you need to pass parameters to the extconf.rb:
> 
> ruby blah.gem --force -- --with-raptor-dir=/usr/local
> 
> everything past the -- is sent to the extconf.rb file.
> 
> This is rough, but it does work for my gem!
> 
> Will work on it more soon (must sleep...)
> 
> Best,
> 
> Rich
> 
> _______________________________________________
> Rubygems-developers mailing list
> Rubygems-developers at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rubygems-developers
> .
> 


-- 
Jamis Buck
jgb3 at email.byu.edu
http://www.jamisbuck.org/jamis

ruby -h | ruby -e 
'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << 
r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'


More information about the Rubygems-developers mailing list