[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Problems building gem with c-extension

Stefan Achatz

5/30/2005 5:17:00 PM

Hello,
i want to build a gem with a c-extension.
Some infos:
Directory Stucture:
mygem/mygem.gemspec
mygem/lib/mydir/somefunctions.rb
mygem/ext/extconf.rb
mygem/ext/otherfunctions.c

File mygem/ext/extconf.rb:
require 'mkmf'
create_makefile('mydir/otherfunctions')

File mygem/mygem.gemspec:
require 'rubygems'
spec = Gem::Specification.new do |s|
s.name = 'MyGem'
s.version = '0.1.0'
s.platform = Gem::Platform::RUBY
s.summary = 'Something that doesnt work'
s.description = <<-EOF
EOF
s.require_path = 'lib'
s.autorequire = 'mydir/somefunctions'
s.has_rdoc = false
s.files = Dir.glob("{ext,lib,tests}/**/{*.rb,*.c}")
s.extensions = ['ext/extconf.rb']
s.author = 'Stefan Achatz'
s.email = 'me@home.de'
end
if $0 == __FILE__
Gem::manage_gems
Gem::Builder.new(spec).build
end

Now what does not work:
when i go into the ext-dir and call manually
ruby extconf.rb && make && make install
the dir mydir gets created in the site-ruby-library-dir and the library gets
copied there.

When i build and try to install the gem with
gem build mygem.gemspec
gem install MyGem-0.1.0.gem

the file otherfunctions.so gets copied to mygem/lib instead of
mygem/lib/mydir

a diff on the Makefiles resulting in the two ways show that the definitions
of RUBYLIBDIR and RUBYARCHDIR are different.
normal build results in $(sitelibdir)$(target_prefix) and
$(sitearchdir)$(target_prefix).
Whereas the gem-compile-process sets the dir fix to /usr/lib/.../MyGem/lib.

What can i do to get the library in the right place for
namespace-correctness?
Thanks in advance
Stefan Achatz