tries to find db-libs and headers automatically. no more --with-db :)

This commit is contained in:
Denis Knauf 2010-03-28 17:09:09 +02:00
parent e59232f993
commit b329501945
2 changed files with 14 additions and 84 deletions

View file

@ -1,73 +0,0 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{dk-bdb}
s.version = "0.2.4.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Justin Balthrop", "Denis Knauf"]
s.date = %q{2010-03-11}
s.description = %q{Advanced Ruby Berkeley DB library.}
s.email = ["code@justinbalthrop.com", "Denis.Knauf@gmail.com"]
s.extensions = ["ext/extconf.rb"]
s.extra_rdoc_files = [
"LICENSE",
"README.md"
]
s.files = [
"README.md",
"VERSION",
"ext/bdb.c",
"ext/bdb.h",
"lib/bdb/base.rb",
"lib/bdb/database.rb",
"lib/bdb/environment.rb",
"lib/bdb/partitioned_database.rb",
"lib/bdb/replication.rb",
"lib/bdb/result_set.rb",
"test/benchmark.rb",
"test/cursor_test.rb",
"test/database_test.rb",
"test/database_test_helper.rb",
"test/db_test.rb",
"test/deadlock_test.rb",
"test/env_test.rb",
"test/replication_test.rb",
"test/stat_test.rb",
"test/test_helper.rb",
"test/txn_test.rb"
]
s.homepage = %q{http://github.com/DenisKnauf/bdb}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["ext", "lib"]
s.rubygems_version = %q{1.3.6}
s.summary = %q{Ruby Berkeley DB}
s.test_files = [
"test/txn_test.rb",
"test/database_test.rb",
"test/deadlock_test.rb",
"test/test_helper.rb",
"test/database_test_helper.rb",
"test/benchmark.rb",
"test/db_test.rb",
"test/env_test.rb",
"test/stat_test.rb",
"test/cursor_test.rb",
"test/replication_test.rb",
"examples/replication.rb"
]
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
else
end
else
end
end

View file

@ -1,11 +1,14 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'mkmf' require 'mkmf'
default_dir = '/usr/local/BerkeleyDB.4.8'
inc, lib = dir_config('db', "#{default_dir}/include", "#{default_dir}/lib")
versions=%w(db-4.8 db-4.7 db-4.6 db-4.5 db-4.4 db-4.3 db-4.2) %w[/usr/local /usr / /usr/local/db* /usr/local/BerkeleyDB*].each do |pdir|
until versions.empty? Dir[pdir].each do |dir|
(lib_ok = have_library(versions.shift, 'db_version', 'db.h')) && break dir_config('db', "#{dir}/include", "#{dir}/lib")
end
end
%w(db-4.9 db-4.8 db-4.7 db-4.6 db-4.5 db-4.4 db-4.3 db-4.2).each do |ver|
have_library ver, 'db_version', 'db.h'
end end
def create_header def create_header
@ -19,7 +22,7 @@ def create_header
f = File.join(e[2..-1], 'db.h') f = File.join(e[2..-1], 'db.h')
File.exists?(f) ? f : nil File.exists?(f) ? f : nil
}.select { |e| e }.first }.select { |e| e }.first
n=0 n=0
defines=[] defines=[]
File.open(db_header) {|fd| File.open(db_header) {|fd|
@ -50,10 +53,10 @@ def create_header
} }
end end
if lib_ok #if lib_ok
create_header create_header
create_makefile('bdb') create_makefile('bdb')
else #else
$stderr.puts("cannot create Makefile") # $stderr.puts("cannot create Makefile")
exit 1 # exit 1
end #end