rdbxml 2.3.10 → 2.4.13.2
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +1 -1
- data/README.rdoc +33 -0
- data/Rakefile +29 -73
- data/docs/dbxml.rb +5 -1
- data/ext/db-minimal.i +78 -0
- data/ext/dbxml.i +205 -104
- data/ext/dbxml_ruby.i +8 -7
- data/lib/rdbxml.rb +21 -28
- data/test/test_dbxml.rb +1 -2
- data/test/test_rdbxml.rb +1 -1
- metadata +66 -58
- data/README +0 -68
- data/docs/db.rb +0 -6
- data/ext/db.i +0 -23
- data/ext/dbxml_wrap.cc +0 -30866
- data/extconf.rb +0 -9
- data/rake/extensiontask.rb +0 -188
- data/rake/swigextensiontask.rb +0 -100
- data/test/test_db.rb +0 -11
data/extconf.rb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
DBXML_DIST=ENV['DBXML_DIST'] || './dbxml-2.2.13'
|
3
|
-
|
4
|
-
# Build wrapper makefile that just calls rakefile
|
5
|
-
File.open( 'Makefile', 'w' ) do |mk|
|
6
|
-
targets = ['all', 'clean', 'test', 'install']
|
7
|
-
mk.puts ".PHONY: #{targets.join(' ')}\n"
|
8
|
-
targets.each { |t| mk.puts "#{t}:\n\t@rake $@\n" }
|
9
|
-
end
|
data/rake/extensiontask.rb
DELETED
@@ -1,188 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/clean'
|
3
|
-
require 'rake/tasklib'
|
4
|
-
|
5
|
-
# Rake tasks to build Ruby extensions
|
6
|
-
|
7
|
-
module Rake
|
8
|
-
|
9
|
-
# Create a build task that will generate a Ruby extension (e.g. .so) from one or more
|
10
|
-
# C (.c) or C++ (.cc, .cpp, .cxx) files, and is intended as a replcaement for mkmf.
|
11
|
-
# It determines platform-specific settings (e.g. file extensions, compiler flags, etc.)
|
12
|
-
# from rbconfig (note: examples assume *nix file extensions).
|
13
|
-
#
|
14
|
-
# *Note*: Strings vs Symbols
|
15
|
-
# In places where filenames are expected (e.g. lib_name and objs), Strings are used
|
16
|
-
# as verbatim filenames, while, Symbols have the platform-dependant extension
|
17
|
-
# appended (e.g. '.so' for libraries and '.o' for objects). Also, only Symbols
|
18
|
-
# have #dir prepended to them.
|
19
|
-
#
|
20
|
-
# Example:
|
21
|
-
# desc "build sample extension"
|
22
|
-
# # build sample.so (from foo.{c,cc,cxx,cpp}, through foo.o)
|
23
|
-
# Rake::ExtensionTask.new :sample => :foo do |t|
|
24
|
-
# # all extension files under this directory
|
25
|
-
# t.dir = 'ext'
|
26
|
-
# # link libraries (libbar.so)
|
27
|
-
# t.link_libs << 'bar'
|
28
|
-
# end
|
29
|
-
#
|
30
|
-
# Author:: Steve Sloan (mailto:steve@finagle.org)
|
31
|
-
# Copyright:: Copyright (c) 2006 Steve Sloan
|
32
|
-
# License:: GPL
|
33
|
-
|
34
|
-
class ExtensionTask < Rake::TaskLib
|
35
|
-
# The name of the extension
|
36
|
-
attr_accessor :name
|
37
|
-
|
38
|
-
# The filename of the extension library file (e.g. 'extension.so')
|
39
|
-
attr_accessor :lib_name
|
40
|
-
|
41
|
-
# Object files to build and link into the extension.
|
42
|
-
attr_accessor :objs
|
43
|
-
|
44
|
-
# The directory where the extension files (source, output, and
|
45
|
-
# intermediate) are stored.
|
46
|
-
attr_accessor :dir
|
47
|
-
|
48
|
-
# Environment configuration -- i.e. CONFIG from rbconfig, with a few other
|
49
|
-
# settings, and converted to lowercase-symbols.
|
50
|
-
attr_accessor :env
|
51
|
-
|
52
|
-
# Additional link libraries
|
53
|
-
attr_accessor :link_libs
|
54
|
-
|
55
|
-
# Same arguments as Rake::define_task
|
56
|
-
def initialize( args, &blk )
|
57
|
-
@env = @@DefaultEnv.dup
|
58
|
-
@name, @objs = resolve_args(args)
|
59
|
-
set_defaults
|
60
|
-
yield self if block_given?
|
61
|
-
define_tasks
|
62
|
-
end
|
63
|
-
|
64
|
-
# Generate default values. This is called from initialize _before_ the
|
65
|
-
# yield block.
|
66
|
-
#
|
67
|
-
# Defaults:
|
68
|
-
# - lib_name: name.so
|
69
|
-
# - objs: name.o (<- name.{c,cxx,cpp,cc})
|
70
|
-
# - dir: .
|
71
|
-
# - link_libs: <none>
|
72
|
-
def set_defaults
|
73
|
-
@lib_name ||= name.to_sym
|
74
|
-
@objs = [name.to_sym] unless @objs and @objs.any?
|
75
|
-
@dir ||= '.'
|
76
|
-
@link_libs ||= []
|
77
|
-
end
|
78
|
-
|
79
|
-
# Defines the library task.
|
80
|
-
def define_tasks
|
81
|
-
output_objs = @objs.collect { |obj| filepath obj, :objext }
|
82
|
-
output_lib = filepath lib_name, :dlext
|
83
|
-
|
84
|
-
task name => output_lib
|
85
|
-
|
86
|
-
file output_lib => output_objs do |t|
|
87
|
-
sh_cmd :ldshared, :dldflags, :ldflags, {'-L' => :libdirs}, '-o', output_lib, output_objs.join(' '),
|
88
|
-
link_libs.collect { |l| "-l#{l}" }.join(' '), :libs, :dldlibs, :librubyarg_shared
|
89
|
-
end
|
90
|
-
|
91
|
-
CLEAN.include output_objs
|
92
|
-
CLOBBER.include output_lib
|
93
|
-
define_rules
|
94
|
-
end
|
95
|
-
|
96
|
-
# Defines C and C++ source-to-object rules, using the source extensions from env.
|
97
|
-
def define_rules
|
98
|
-
for ext in env[:c_exts]
|
99
|
-
Rake::Task.create_rule '.'+env[:objext] => '.'+ext do |r|
|
100
|
-
sh_cmd :cc, :cflags, :cppflags, {'-D' => :defines}, {'-I' => :includedirs}, {'-I' => :topdir},
|
101
|
-
'-c', '-o', r.name, r.sources
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
for ext in env[:cpp_exts]
|
106
|
-
Rake::Task.create_rule '.'+env[:objext] => '.'+ext do |r|
|
107
|
-
sh_cmd :cxx, :cxxflags, :cppflags, {'-D' => :defines}, {'-I' => :includedirs}, {'-I' => :topdir},
|
108
|
-
'-o', r.name, '-c', r.sources
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
class << self
|
114
|
-
# The default environment for all extensions.
|
115
|
-
@@DefaultEnv = {}
|
116
|
-
def env
|
117
|
-
@@DefaultEnv
|
118
|
-
end
|
119
|
-
def env=(e)
|
120
|
-
@@DefaultEnv = e
|
121
|
-
end
|
122
|
-
|
123
|
-
Config::CONFIG.merge(ENV).each { |k, v| @@DefaultEnv[k.downcase.to_sym] = v }
|
124
|
-
@@DefaultEnv = {
|
125
|
-
:cxx => 'c++',
|
126
|
-
:cxxflags => '',
|
127
|
-
:c_exts => ['c'],
|
128
|
-
:cpp_exts => ['cc', 'cxx', 'cpp'],
|
129
|
-
:includedirs => [],
|
130
|
-
:libdirs => [],
|
131
|
-
}.update(@@DefaultEnv)
|
132
|
-
end
|
133
|
-
|
134
|
-
protected
|
135
|
-
|
136
|
-
# Handles convenience filenames:
|
137
|
-
# * f (String) => f
|
138
|
-
# * f (Symbol) => dir/f.ext
|
139
|
-
def filepath( f, ext )
|
140
|
-
ext = env[ext] if Symbol === ext
|
141
|
-
Symbol === f ? File.join( dir, "#{f}.#{ext}" ) : f
|
142
|
-
end
|
143
|
-
|
144
|
-
# Convenience function for cnstructing command lines for build tools.
|
145
|
-
def optify( *opts )
|
146
|
-
return optify(*opts.first) if opts.size == 1 and opts.first.kind_of? Array
|
147
|
-
opts.collect do |opt|
|
148
|
-
case opt
|
149
|
-
when String then opt
|
150
|
-
when Symbol then optify env[opt]
|
151
|
-
when Hash
|
152
|
-
opt.collect do |k, v|
|
153
|
-
v = env[v] if v.kind_of? Symbol
|
154
|
-
if v.kind_of? Array
|
155
|
-
optify v.collect { |w| k.to_s + w.to_s }
|
156
|
-
elsif v
|
157
|
-
k.to_s + v.to_s
|
158
|
-
end
|
159
|
-
end
|
160
|
-
else
|
161
|
-
opt.to_s
|
162
|
-
end
|
163
|
-
end.join(' ').squeeze(' ')
|
164
|
-
end
|
165
|
-
|
166
|
-
def sh_cmd( cmd, *opts )
|
167
|
-
sh optify( cmd, *opts )
|
168
|
-
end
|
169
|
-
|
170
|
-
# For some reason, Rake::TaskManager.resolve_args can't be found, so snarf it.
|
171
|
-
def resolve_args(args)
|
172
|
-
case args
|
173
|
-
when Hash
|
174
|
-
fail "Too Many Task Names: #{args.keys.join(' ')}" if args.size > 1
|
175
|
-
fail "No Task Name Given" if args.size < 1
|
176
|
-
task_name = args.keys[0]
|
177
|
-
deps = args[task_name]
|
178
|
-
deps = [deps] if (String===deps) || (Regexp===deps) || (Proc===deps)
|
179
|
-
else
|
180
|
-
task_name = args
|
181
|
-
deps = []
|
182
|
-
end
|
183
|
-
[task_name, deps]
|
184
|
-
end
|
185
|
-
|
186
|
-
end
|
187
|
-
|
188
|
-
end
|
data/rake/swigextensiontask.rb
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/extensiontask'
|
3
|
-
|
4
|
-
module Rake
|
5
|
-
|
6
|
-
# Create a build task that will generate a Ruby wrapper extension from
|
7
|
-
# SWIG interface definition(s). Requires SWIG[http://www.swig.org] version 1.3.x.
|
8
|
-
#
|
9
|
-
# See ExtensionTask for more information.
|
10
|
-
#
|
11
|
-
# Example (from RDBXML):
|
12
|
-
# # dbxml.i -> dbxml_wrap.cc -> dbxml_wrap.o -> dbxml.so
|
13
|
-
# Rake::SWIGExtensionTask.new :dbxml do |t|
|
14
|
-
# # keep it all under ext/
|
15
|
-
# t.dir = 'ext'
|
16
|
-
# # dbxml.i includes dbxml_ruby.i so rebuild if it changes
|
17
|
-
# t.deps[:dbxml] << :dbxml_ruby
|
18
|
-
# # link in dbxml libraries
|
19
|
-
# t.link_libs += ['db', 'db_cxx', 'dbxml', 'xquery', 'xerces-c', 'pathan']
|
20
|
-
# end
|
21
|
-
#
|
22
|
-
# Author:: Steve Sloan (mailto:steve@finagle.org)
|
23
|
-
# Copyright:: Copyright (c) 2006 Steve Sloan
|
24
|
-
# License:: GPL
|
25
|
-
class SWIGExtensionTask < ExtensionTask
|
26
|
-
|
27
|
-
# An Array of interface filenames (Symbol or String) to build and link into
|
28
|
-
# the extension.
|
29
|
-
attr_accessor :ifaces
|
30
|
-
|
31
|
-
# A Hash of interface filenames and their dependencies, i.e. files which
|
32
|
-
# are not built or linked, but cause the corresponding interface to be
|
33
|
-
# rebuild if any of them change.
|
34
|
-
attr_accessor :deps
|
35
|
-
|
36
|
-
# Defaults:
|
37
|
-
# - lib_name: name.so
|
38
|
-
# - ifaces: name.i
|
39
|
-
# - deps: <none>
|
40
|
-
# - dir: .
|
41
|
-
# - link_libs: <none>
|
42
|
-
def set_defaults
|
43
|
-
super
|
44
|
-
@ifaces ||= [name.to_sym]
|
45
|
-
@deps ||= Hash.new []
|
46
|
-
@objs = []
|
47
|
-
end
|
48
|
-
|
49
|
-
def define_tasks
|
50
|
-
for iface in @ifaces
|
51
|
-
deps = @deps[iface]
|
52
|
-
iface = filepath(iface, :swigext)
|
53
|
-
src = iface.sub(/\.#{env[:swigext]}$/, env[:swig_cppext])
|
54
|
-
|
55
|
-
deps = [deps] unless deps.kind_of? Enumerable
|
56
|
-
if deps and deps.any?
|
57
|
-
file src => deps.collect { |dep| filepath(dep, :swigext) } << iface
|
58
|
-
end
|
59
|
-
CLEAN.include src
|
60
|
-
@objs << src.sub(/\.[^.]+$/, '.'+env[:objext])
|
61
|
-
end
|
62
|
-
super
|
63
|
-
end
|
64
|
-
|
65
|
-
# Add rule for generating C++ wrapper code (_wrap.cc) from SWIG interface definition (.i).
|
66
|
-
def define_rules
|
67
|
-
verify_swig_version
|
68
|
-
super
|
69
|
-
Rake::Task.create_rule(
|
70
|
-
/#{env[:swig_cppext]}$/ => [proc {|t| t.sub /#{env[:swig_cppext]}$/, '.'+env[:swigext] }]
|
71
|
-
) do |r|
|
72
|
-
sh_cmd :swig, :swig_flags, {'-I' => :swig_includedirs}, {'-I' => :includedirs},
|
73
|
-
'-o', r.name, r.sources
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
ExtensionTask.env = {
|
78
|
-
:swig => 'swig',
|
79
|
-
:swigext => 'i',
|
80
|
-
:swig_cppext => '_wrap.cc',
|
81
|
-
:swig_flags => ['-ruby', '-c++'],
|
82
|
-
:swig_includedirs => ['.']
|
83
|
-
}.update(ExtensionTask.env)
|
84
|
-
|
85
|
-
protected
|
86
|
-
|
87
|
-
# Raise an exception unless we have SWIG version 1.3 or later.
|
88
|
-
def verify_swig_version
|
89
|
-
@@swig_version ||= IO.popen "#{env[:swig]} -version 2>&1" do |swig|
|
90
|
-
banner = swig.readlines.reject { |l| l.strip.empty? }
|
91
|
-
banner = banner[0].match(/swig version ([^ ]+)/i)
|
92
|
-
banner and banner[1]
|
93
|
-
end
|
94
|
-
unless @@swig_version and @@swig_version >= '1.3'
|
95
|
-
raise "Need SWIG version 1.3 or later (have #{@@swig_version || 'none'})"
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|