gem2deb for ruby-bdb (former libdb-ruby)
Hi,
Lucas has asked me if I could gem2debize libdb-ruby, so here are the findings.
[Disclaimer: I am not a ruby user, my only interest is helping my
db5.1 transition, so my experience is limited by readability of ruby
programs and ruby docs + google]
bdb package:
- doesn't have gemspec
- does have 4 extconf.rb ['extconf.rb', 'src/extconf.rb',
'bdbxml1/extconf.rb', 'bdbxml2/extconf.rb']
- does build only by calling <sourcedir>/extconf.rb, it does all the
subdirectory work itself
The build failed on several places due the fact, that
gem2deb/metadata.rb searches for subdirs for extconf.rb
(Dir.glob(**/...)) which is not correct for bdb. The dbxml is not in
Debian, so it cannot be built.
I was able to circumvent this either by removing bdbxml*/extconf.rb or
the next solution was to write own gemspec.
The second FTBFS after creating gemspec with:
spec.extensions << 'extconf.rb'
came from extconf.rb. It includes this code:
subdirs.each do |subdir|
STDERR.puts("#{$0}: Entering directory `#{subdir}'")
Dir.chdir(subdir)
system("#{CONFIG['RUBY_INSTALL_NAME']} extconf.rb " + ARGV.join(" "))
Dir.chdir("..")
STDERR.puts("#{$0}: Leaving directory `#{subdir}'")
end
Which doesn't pass the target variable from
gem2deb/extension_builder.rb, therefore build fails when it tries to
install shared library to /usr/local/lib.
The workaround which I have used was to create gemspec file with just
the extension directory supplied thus it doesn't run the
<sourcedir>/extconf.rb at all.
spec = Gem::Specification.new do |s|
s.extensions << 'src/extconf.rb'
end
I also had to write some code (mostly copied from
<sourcedir/extconf.rb) to run the tests, but somebody should check it
if it's correct.
I am little bit convinced that it's the upstream at fault who uses
little bit non-standard system (they should use gemspec instead of
custom extconf.rb), but as I said I don't use ruby, so maybe I am just
confused.
The git repository was pushed to
git.debian.org/git/users/ondrej/ruby-bdb since I am not a member of
pkg-ruby-extras (and I don't want to be). Please copy this repository
and drop me an email when it's done, so I can delete it.
O.
--
Ondřej Surý <ondrej@sury.org>
Reply to: