amalgalite 0.4.2-x86-mswin32-60 → 0.5.0-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +12 -0
- data/bin/amalgalite-pack +121 -0
- data/examples/blob.rb +18 -35
- data/examples/bootstrap.rb +6 -6
- data/examples/require_me.rb +11 -0
- data/examples/requires.rb +23 -35
- data/ext/amalgalite3.h +3 -0
- data/ext/amalgalite3_requires_bootstrap.c +17 -15
- data/ext/sqlite3.c +4684 -3983
- data/ext/sqlite3.h +301 -96
- data/ext/sqlite3ext.h +9 -1
- data/lib/amalgalite/blob.rb +1 -1
- data/lib/amalgalite/core_ext/kernel/require.rb +11 -4
- data/lib/amalgalite/packer.rb +221 -0
- data/lib/amalgalite/requires.rb +60 -52
- data/lib/amalgalite/statement.rb +5 -2
- data/lib/amalgalite/version.rb +2 -2
- data/lib/amalgalite3.so +0 -0
- data/spec/packer_spec.rb +50 -0
- data/spec/requires_spec.rb +23 -0
- data/spec/sqlite3/version_spec.rb +2 -2
- data/spec/version_spec.rb +6 -0
- data/tasks/config.rb +4 -5
- data/tasks/extension.rake +4 -1
- metadata +10 -6
- data/bin/amalgalite-pack-into-db +0 -155
- data/ext/rbconfig-mingw.rb +0 -178
data/lib/amalgalite/statement.rb
CHANGED
@@ -83,6 +83,9 @@ module Amalgalite
|
|
83
83
|
def execute( *params )
|
84
84
|
bind( *params )
|
85
85
|
begin
|
86
|
+
# save the error state at the beginning of the execution. We only want to
|
87
|
+
# reraise the error if it was raised during this execution.
|
88
|
+
s_before = $!
|
86
89
|
if block_given? then
|
87
90
|
while row = next_row
|
88
91
|
yield row
|
@@ -96,7 +99,7 @@ module Amalgalite
|
|
96
99
|
reset_for_next_execute!
|
97
100
|
rescue => e
|
98
101
|
end
|
99
|
-
raise s if s
|
102
|
+
raise s if s != s_before
|
100
103
|
end
|
101
104
|
end
|
102
105
|
|
@@ -285,7 +288,7 @@ module Amalgalite
|
|
285
288
|
write_blobs
|
286
289
|
else
|
287
290
|
raise Amalgalite::SQLite3::Error,
|
288
|
-
"SQLITE ERROR #{rc} (#{Amalgalite::SQLite3::Constants::ResultCode.
|
291
|
+
"SQLITE ERROR #{rc} (#{Amalgalite::SQLite3::Constants::ResultCode.name_from_value( rc )}) : #{@db.api.last_error_message}"
|
289
292
|
end
|
290
293
|
return row
|
291
294
|
end
|
data/lib/amalgalite/version.rb
CHANGED
data/lib/amalgalite3.so
CHANGED
Binary file
|
data/spec/packer_spec.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),"spec_helper.rb"))
|
2
|
+
require 'amalgalite/packer'
|
3
|
+
|
4
|
+
describe "Amalgalite::Packer" do
|
5
|
+
before( :each ) do
|
6
|
+
@table = Amalgalite::Requires::Bootstrap::DEFAULT_BOOTSTRAP_TABLE
|
7
|
+
@packer = Amalgalite::Packer.new( :table_name => @table )
|
8
|
+
end
|
9
|
+
|
10
|
+
after( :each ) do
|
11
|
+
FileUtils.rm_f Amalgalite::Requires::Bootstrap::DEFAULT_DB
|
12
|
+
end
|
13
|
+
|
14
|
+
it "does not load the amalgalite/requires file" do
|
15
|
+
$LOADED_FEATURES.should_not be_include("amalgalite/requires")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "packs amalgalite into a bootsrap database" do
|
19
|
+
@packer.pack( Amalgalite::Packer.amalgalite_require_order )
|
20
|
+
db = Amalgalite::Database.new( @packer.dbfile )
|
21
|
+
db.schema.tables[ @table ].should_not be_nil
|
22
|
+
count = db.execute("SELECT count(1) FROM #{@table}").first
|
23
|
+
count.first.should == Amalgalite::Packer.amalgalite_require_order.size
|
24
|
+
end
|
25
|
+
|
26
|
+
it "recreates the table if :drop_table option is given " do
|
27
|
+
@packer.pack( Amalgalite::Packer.amalgalite_require_order )
|
28
|
+
db = Amalgalite::Database.new( @packer.dbfile )
|
29
|
+
db.schema.tables[ @table ].should_not be_nil
|
30
|
+
count = db.execute("SELECT count(1) FROM #{@table}").first
|
31
|
+
count.first.should == Amalgalite::Packer.amalgalite_require_order.size
|
32
|
+
|
33
|
+
np = Amalgalite::Packer.new( :drop_table => true, :table_name => @table )
|
34
|
+
np.options[ :drop_table ].should == true
|
35
|
+
np.check_db( db )
|
36
|
+
count = db.execute("SELECT count(1) FROM #{@table}").first
|
37
|
+
count.first.should == 0
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
it "compresses the content if told too" do
|
42
|
+
@packer.options[ :compressed ] = true
|
43
|
+
@packer.pack( Amalgalite::Packer.amalgalite_require_order )
|
44
|
+
db = Amalgalite::Database.new( @packer.dbfile )
|
45
|
+
orig = IO.read( File.join( File.dirname( __FILE__ ), "..", "lib", "amalgalite.rb" ) )
|
46
|
+
zipped = db.execute("SELECT contents FROM #{@table} WHERE filename = 'amalgalite'")
|
47
|
+
expanded = Amalgalite::Packer.gunzip( zipped.first['contents'].to_s )
|
48
|
+
expanded.should == orig
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'spec'
|
3
|
+
|
4
|
+
$: << File.expand_path(File.join(File.dirname(__FILE__),"..","lib"))
|
5
|
+
#require 'amalgalite/requires'
|
6
|
+
|
7
|
+
#describe Amalgalite::Requires do
|
8
|
+
# it "#require_order has all files in 'lib' and no more" do
|
9
|
+
# dir_files = Dir.glob( File.join( Amalgalite::Paths.lib_path , "**", "*.rb" ) )
|
10
|
+
# require_files = Amalgalite::Requires.require_order.collect { |r| Amalgalite::Paths.lib_path r }
|
11
|
+
# dir_files.size.should == require_files.size
|
12
|
+
# (dir_files - require_files).size.should == 0
|
13
|
+
# (require_files - dir_files).size.should == 0
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# it "can compress and uncompress data" do
|
17
|
+
# s = IO.read( __FILE__ )
|
18
|
+
# s_gz = Amalgalite::Requires.gzip( s )
|
19
|
+
# s.should == Amalgalite::Requires.gunzip( s_gz )
|
20
|
+
# end
|
21
|
+
#end
|
22
|
+
|
23
|
+
|
@@ -5,10 +5,10 @@ describe "Amalgalite::SQLite3::Version" do
|
|
5
5
|
it "should have the sqlite3 version" do
|
6
6
|
Amalgalite::SQLite3::VERSION.should =~ /\d\.\d\.\d/
|
7
7
|
Amalgalite::SQLite3::Version.to_s.should =~ /\d\.\d\.\d/
|
8
|
-
Amalgalite::SQLite3::Version.to_i.should ==
|
8
|
+
Amalgalite::SQLite3::Version.to_i.should == 3006005
|
9
9
|
Amalgalite::SQLite3::Version::MAJOR.should == 3
|
10
10
|
Amalgalite::SQLite3::Version::MINOR.should == 6
|
11
|
-
Amalgalite::SQLite3::Version::RELEASE.should ==
|
11
|
+
Amalgalite::SQLite3::Version::RELEASE.should == 5
|
12
12
|
Amalgalite::SQLite3::Version.to_a.should have(3).items
|
13
13
|
end
|
14
14
|
end
|
data/spec/version_spec.rb
CHANGED
@@ -6,4 +6,10 @@ describe "Amalgalite::Version" do
|
|
6
6
|
Amalgalite::Version.to_s.should =~ /\d+\.\d+\.\d+/
|
7
7
|
Amalgalite::VERSION.should =~ /\d+\.\d+\.\d+/
|
8
8
|
end
|
9
|
+
it "should have a version hash" do
|
10
|
+
h = Amalgalite::Version.to_hash
|
11
|
+
[ :major, :minor, :build ].each do |k|
|
12
|
+
h[k].should_not be_nil
|
13
|
+
end
|
14
|
+
end
|
9
15
|
end
|
data/tasks/config.rb
CHANGED
@@ -44,14 +44,14 @@ Configuration.for('packaging') {
|
|
44
44
|
formats {
|
45
45
|
tgz true
|
46
46
|
zip true
|
47
|
-
|
47
|
+
rubygem Configuration::Table.has_key?('rubygem')
|
48
48
|
}
|
49
49
|
}
|
50
50
|
|
51
51
|
#-----------------------------------------------------------------------
|
52
52
|
# Gem packaging
|
53
53
|
#-----------------------------------------------------------------------
|
54
|
-
Configuration.for("
|
54
|
+
Configuration.for("rubygem") {
|
55
55
|
spec "gemspec.rb"
|
56
56
|
Configuration.for('packaging').files.all << spec
|
57
57
|
}
|
@@ -63,7 +63,7 @@ Configuration.for("gem") {
|
|
63
63
|
Configuration.for('test') {
|
64
64
|
mode "spec"
|
65
65
|
files Configuration.for("packaging").files.test
|
66
|
-
options %w[ --format
|
66
|
+
options %w[ --format progress --color ]
|
67
67
|
ruby_opts %w[ ]
|
68
68
|
}
|
69
69
|
|
@@ -77,7 +77,7 @@ Configuration.for('rcov') {
|
|
77
77
|
ruby_opts %w[ ]
|
78
78
|
test_files Configuration.for('packaging').files.test
|
79
79
|
}
|
80
|
-
|
80
|
+
#
|
81
81
|
#-----------------------------------------------------------------------
|
82
82
|
# Rdoc
|
83
83
|
#-----------------------------------------------------------------------
|
@@ -107,4 +107,3 @@ Configuration.for('rubyforge') {
|
|
107
107
|
rdoc_location "#{user}@#{host}:/var/www/gforge-projects/#{project}/amalgalite/"
|
108
108
|
}
|
109
109
|
|
110
|
-
|
data/tasks/extension.rake
CHANGED
@@ -29,8 +29,9 @@ if ext_config = Configuration.for_if_exist?('extension') then
|
|
29
29
|
path = Pathname.new( extension )
|
30
30
|
parts = path.split
|
31
31
|
conf = parts.last
|
32
|
+
mingw_rbconfig = path.dirname.parent.realpath + "rbconfig-mingw.rb"
|
32
33
|
Dir.chdir( path.dirname ) do |d|
|
33
|
-
cp
|
34
|
+
cp mingw_rbconfig, "rbconfig.rb"
|
34
35
|
sh "ruby -I. extconf.rb"
|
35
36
|
sh "make"
|
36
37
|
rm_f "rbconfig.rb"
|
@@ -69,9 +70,11 @@ if ext_config = Configuration.for_if_exist?('extension') then
|
|
69
70
|
desc "Download and integrate the next version of sqlite"
|
70
71
|
task :update_sqlite do
|
71
72
|
next_version = ENV['VERSION']
|
73
|
+
raise "VERSION env variable must be set" unless next_version
|
72
74
|
puts "downloading ..."
|
73
75
|
url = URI.parse("http://sqlite.org/sqlite-amalgamation-#{next_version}.tar.gz")
|
74
76
|
file = "tmp/#{File.basename( url.path ) }"
|
77
|
+
FileUtils.mkdir "tmp" unless File.directory?( "tmp" )
|
75
78
|
File.open( file, "wb+") do |f|
|
76
79
|
res = Net::HTTP.get_response( url )
|
77
80
|
f.write( res.body )
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amalgalite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: x86-mswin32-60
|
6
6
|
authors:
|
7
7
|
- Jeremy Hinegardner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-11-17 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -35,7 +35,7 @@ dependencies:
|
|
35
35
|
description: Amalgalite embeds the SQLite database engine in a ruby extension. There is no need to install SQLite separately. Look in the examples/ directory to see * general usage * blob io * schema information Also Scroll through Amalgalite::Database for a quick example, and a general overview of the API.
|
36
36
|
email: jeremy@hinegardner.org
|
37
37
|
executables:
|
38
|
-
- amalgalite-pack
|
38
|
+
- amalgalite-pack
|
39
39
|
extensions: []
|
40
40
|
|
41
41
|
extra_rdoc_files:
|
@@ -48,6 +48,7 @@ extra_rdoc_files:
|
|
48
48
|
- lib/amalgalite/core_ext/kernel/require.rb
|
49
49
|
- lib/amalgalite/database.rb
|
50
50
|
- lib/amalgalite/index.rb
|
51
|
+
- lib/amalgalite/packer.rb
|
51
52
|
- lib/amalgalite/paths.rb
|
52
53
|
- lib/amalgalite/profile_tap.rb
|
53
54
|
- lib/amalgalite/requires.rb
|
@@ -77,7 +78,7 @@ extra_rdoc_files:
|
|
77
78
|
- ext/amalgalite3_requires_bootstrap.c
|
78
79
|
- ext/amalgalite3_statement.c
|
79
80
|
files:
|
80
|
-
- bin/amalgalite-pack
|
81
|
+
- bin/amalgalite-pack
|
81
82
|
- ext/amalgalite3.c
|
82
83
|
- ext/amalgalite3_blob.c
|
83
84
|
- ext/amalgalite3_constants.c
|
@@ -91,11 +92,11 @@ files:
|
|
91
92
|
- ext/sqlite3ext.h
|
92
93
|
- ext/extconf.rb
|
93
94
|
- ext/gen_constants.rb
|
94
|
-
- ext/rbconfig-mingw.rb
|
95
95
|
- examples/a.rb
|
96
96
|
- examples/blob.rb
|
97
97
|
- examples/bootstrap.rb
|
98
98
|
- examples/gem-db.rb
|
99
|
+
- examples/require_me.rb
|
99
100
|
- examples/requires.rb
|
100
101
|
- examples/schema-info.rb
|
101
102
|
- lib/amalgalite/blob.rb
|
@@ -104,6 +105,7 @@ files:
|
|
104
105
|
- lib/amalgalite/core_ext/kernel/require.rb
|
105
106
|
- lib/amalgalite/database.rb
|
106
107
|
- lib/amalgalite/index.rb
|
108
|
+
- lib/amalgalite/packer.rb
|
107
109
|
- lib/amalgalite/paths.rb
|
108
110
|
- lib/amalgalite/profile_tap.rb
|
109
111
|
- lib/amalgalite/requires.rb
|
@@ -132,7 +134,9 @@ files:
|
|
132
134
|
- spec/database_spec.rb
|
133
135
|
- spec/default_map_spec.rb
|
134
136
|
- spec/integeration_spec.rb
|
137
|
+
- spec/packer_spec.rb
|
135
138
|
- spec/paths_spec.rb
|
139
|
+
- spec/requires_spec.rb
|
136
140
|
- spec/schema_spec.rb
|
137
141
|
- spec/spec_helper.rb
|
138
142
|
- spec/sqlite3/constants_spec.rb
|
@@ -184,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
188
|
requirements: []
|
185
189
|
|
186
190
|
rubyforge_project: copiousfreetime
|
187
|
-
rubygems_version: 1.
|
191
|
+
rubygems_version: 1.3.1
|
188
192
|
signing_key:
|
189
193
|
specification_version: 2
|
190
194
|
summary: Amalgalite embeds the SQLite database engine in a ruby extension
|
data/bin/amalgalite-pack-into-db
DELETED
@@ -1,155 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'optparse'
|
4
|
-
|
5
|
-
#
|
6
|
-
# A commandline utility to pack all of amalgalite into a database so that it can
|
7
|
-
# be loaded with the C extension only.
|
8
|
-
#
|
9
|
-
|
10
|
-
#
|
11
|
-
# given a file, see if it can be found in the ruby load path, if so, return that
|
12
|
-
# full path
|
13
|
-
#
|
14
|
-
def full_path_of( rb_file )
|
15
|
-
$:.each do |load_path|
|
16
|
-
guess = File.join( load_path, rb_file )
|
17
|
-
return guess if File.exist?( guess )
|
18
|
-
end
|
19
|
-
return nil
|
20
|
-
end
|
21
|
-
|
22
|
-
OPTIONS = { :force => false }
|
23
|
-
|
24
|
-
parser = OptionParser.new do |op|
|
25
|
-
op.banner = "Usage: #{op.program_name} [options] <dbfile>"
|
26
|
-
op.separator ""
|
27
|
-
|
28
|
-
op.on("-f", "--force", "Force overwriting of an existing database") do |f|
|
29
|
-
OPTIONS[:force]= true
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
begin
|
35
|
-
parser.parse!
|
36
|
-
rescue OptionParser::ParseError => pe
|
37
|
-
STDERR.puts "ERROR : #{pe}"
|
38
|
-
STDERR.puts parser
|
39
|
-
exit 1
|
40
|
-
end
|
41
|
-
|
42
|
-
#
|
43
|
-
# capture before and after snapshots of the loaded features to see what changed
|
44
|
-
# when we required amalgalite
|
45
|
-
#
|
46
|
-
require 'rubygems'
|
47
|
-
$: << "lib"
|
48
|
-
$: << "ext"
|
49
|
-
loaded_features_before = $".dup
|
50
|
-
require 'amalgalite/requires'
|
51
|
-
loaded_features_after = $".dup
|
52
|
-
|
53
|
-
#
|
54
|
-
# reorder the items that should be required, putting the system level .rb files
|
55
|
-
# first in the list
|
56
|
-
#
|
57
|
-
amalgalite_needs = loaded_features_after - loaded_features_before
|
58
|
-
core_libs = (amalgalite_needs - Amalgalite::Requires.require_order).delete_if { |l| l.index(".rb").nil? }
|
59
|
-
|
60
|
-
#
|
61
|
-
# check and make sure nothing is missed
|
62
|
-
#
|
63
|
-
core_libs.each do |l|
|
64
|
-
if l.index("malgalite") then
|
65
|
-
STDERR.puts "ERROR! require_order needs an update #{l}"
|
66
|
-
STDERR.puts "run rake test:check_requries and fix"
|
67
|
-
exit 2
|
68
|
-
end
|
69
|
-
end
|
70
|
-
amalgalite_needs = core_libs.concat( Amalgalite::Requires.require_order )
|
71
|
-
|
72
|
-
|
73
|
-
# width value for tidy output
|
74
|
-
max_width = amalgalite_needs.sort_by { |l| l.length }.last.length
|
75
|
-
|
76
|
-
#
|
77
|
-
# Get the filename, and do not overwrite if the file already exists, unless of
|
78
|
-
# course, --force is used
|
79
|
-
#
|
80
|
-
dbfile = ARGV.shift || Amalgalite::Requires::Bootstrap::DEFAULT_DB
|
81
|
-
if OPTIONS[:force] then
|
82
|
-
File.unlink( dbfile ) if File.exist?( dbfile )
|
83
|
-
end
|
84
|
-
|
85
|
-
if File.exist?( dbfile ) then
|
86
|
-
STDERR.puts "ERROR: #{dbfile} already exists, erase manually or use '--force' option"
|
87
|
-
STDERR.puts parser
|
88
|
-
exit 1
|
89
|
-
end
|
90
|
-
|
91
|
-
|
92
|
-
#
|
93
|
-
# Create the datbase
|
94
|
-
#
|
95
|
-
puts "Creating database #{dbfile}"
|
96
|
-
db = Amalgalite::Database.new( dbfile )
|
97
|
-
table_name = Amalgalite::Requires::Bootstrap::DEFAULT_TABLE
|
98
|
-
rowid_col = Amalgalite::Requires::Bootstrap::DEFAULT_ROWID_COLUMN
|
99
|
-
filename_col = Amalgalite::Requires::Bootstrap::DEFAULT_FILENAME_COLUMN
|
100
|
-
contents_col = Amalgalite::Requires::Bootstrap::DEFAULT_CONTENTS_COLUMN
|
101
|
-
db.execute(<<-create)
|
102
|
-
CREATE TABLE #{table_name} (
|
103
|
-
#{rowid_col} INTEGER PRIMARY KEY AUTOINCREMENT,
|
104
|
-
#{filename_col} TEXT UNIQUE,
|
105
|
-
#{contents_col} BLOB
|
106
|
-
)
|
107
|
-
create
|
108
|
-
db.reload_schema!
|
109
|
-
|
110
|
-
#
|
111
|
-
# for every file in the list, insert it into the database
|
112
|
-
#
|
113
|
-
db.transaction do |dbt|
|
114
|
-
db.prepare( "INSERT INTO #{table_name}(#{filename_col}, #{contents_col}) VALUES ( $filename, $contents )" ) do |stmt|
|
115
|
-
amalgalite_needs.each do |am_requires|
|
116
|
-
|
117
|
-
msg = " skipped, probably a binary extension"
|
118
|
-
|
119
|
-
if File.extname( am_requires ) == ".rb" then
|
120
|
-
full_path = File.expand_path( full_path_of( am_requires ) )
|
121
|
-
|
122
|
-
if full_path and File.readable?( full_path ) then
|
123
|
-
contents = IO.readlines( full_path )
|
124
|
-
contents.each { |l| l.gsub!( /^(\s*require .*)$/m, "# commented out by #{parser.program_name} \\1") }
|
125
|
-
# strip off the .rb
|
126
|
-
rq = am_requires[ /\A(.*)\.rb\Z/, 1]
|
127
|
-
stmt.execute( { "$filename" => rq,
|
128
|
-
"$contents" => Amalgalite::Blob.new( :string => contents.join,
|
129
|
-
:column => dbt.schema.tables[table_name].columns[contents_col] ) } )
|
130
|
-
msg = "stored #{full_path}"
|
131
|
-
end
|
132
|
-
|
133
|
-
puts " -> #{am_requires.ljust( max_width )} : #{msg}"
|
134
|
-
else
|
135
|
-
STDERR.puts "ERROR : #{am_requires} is an invalid file to pack"
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
140
|
-
db.close
|
141
|
-
|
142
|
-
puts <<-text
|
143
|
-
|
144
|
-
Packing complete. To utilize the bootstrapping in #{dbfile} you must do
|
145
|
-
one of the following:
|
146
|
-
|
147
|
-
* statically compile the amalgalite C extension into your application
|
148
|
-
* require 'amalgalite3'
|
149
|
-
|
150
|
-
Once one of those is working you can boostrap the Amalgalite library with
|
151
|
-
this line in your code:
|
152
|
-
|
153
|
-
Amalgalite::Requries::Boostrap.lift( 'dbfile' => '#{dbfile}' )
|
154
|
-
|
155
|
-
text
|
data/ext/rbconfig-mingw.rb
DELETED
@@ -1,178 +0,0 @@
|
|
1
|
-
|
2
|
-
# This file was created by mkconfig.rb when ruby was built. Any
|
3
|
-
# changes made to this file will be lost the next time ruby is built.
|
4
|
-
|
5
|
-
module Config
|
6
|
-
RUBY_VERSION == "1.8.6" or
|
7
|
-
raise "ruby lib version (1.8.6) doesn't match executable version (#{RUBY_VERSION})"
|
8
|
-
|
9
|
-
TOPDIR = File.dirname(__FILE__).chomp!("/lib/ruby/1.8/i386-mingw32")
|
10
|
-
DESTDIR = '' unless defined? DESTDIR
|
11
|
-
CONFIG = {}
|
12
|
-
CONFIG["DESTDIR"] = DESTDIR
|
13
|
-
CONFIG["INSTALL"] = '/opt/local/bin/ginstall -c'
|
14
|
-
CONFIG["prefix"] = (TOPDIR || DESTDIR + "#{ENV["HOME"]}/ruby-mingw32")
|
15
|
-
CONFIG["EXEEXT"] = ".exe"
|
16
|
-
CONFIG["ruby_install_name"] = "ruby"
|
17
|
-
CONFIG["RUBY_INSTALL_NAME"] = "ruby"
|
18
|
-
CONFIG["RUBY_SO_NAME"] = "msvcrt-ruby18"
|
19
|
-
CONFIG["SHELL"] = "/bin/sh"
|
20
|
-
CONFIG["PATH_SEPARATOR"] = ":"
|
21
|
-
CONFIG["PACKAGE_NAME"] = ""
|
22
|
-
CONFIG["PACKAGE_TARNAME"] = ""
|
23
|
-
CONFIG["PACKAGE_VERSION"] = ""
|
24
|
-
CONFIG["PACKAGE_STRING"] = ""
|
25
|
-
CONFIG["PACKAGE_BUGREPORT"] = ""
|
26
|
-
CONFIG["exec_prefix"] = "$(prefix)"
|
27
|
-
CONFIG["bindir"] = "$(exec_prefix)/bin"
|
28
|
-
CONFIG["sbindir"] = "$(exec_prefix)/sbin"
|
29
|
-
CONFIG["libexecdir"] = "$(exec_prefix)/libexec"
|
30
|
-
CONFIG["datarootdir"] = "$(prefix)/share"
|
31
|
-
CONFIG["datadir"] = "$(datarootdir)"
|
32
|
-
CONFIG["sysconfdir"] = "$(prefix)/etc"
|
33
|
-
CONFIG["sharedstatedir"] = "$(prefix)/com"
|
34
|
-
CONFIG["localstatedir"] = "$(prefix)/var"
|
35
|
-
CONFIG["includedir"] = "$(prefix)/include"
|
36
|
-
CONFIG["oldincludedir"] = "/usr/include"
|
37
|
-
CONFIG["docdir"] = "$(datarootdir)/doc/$(PACKAGE)"
|
38
|
-
CONFIG["infodir"] = "$(datarootdir)/info"
|
39
|
-
CONFIG["htmldir"] = "$(docdir)"
|
40
|
-
CONFIG["dvidir"] = "$(docdir)"
|
41
|
-
CONFIG["pdfdir"] = "$(docdir)"
|
42
|
-
CONFIG["psdir"] = "$(docdir)"
|
43
|
-
CONFIG["libdir"] = "$(exec_prefix)/lib"
|
44
|
-
CONFIG["localedir"] = "$(datarootdir)/locale"
|
45
|
-
CONFIG["mandir"] = "$(datarootdir)/man"
|
46
|
-
CONFIG["ECHO_C"] = ""
|
47
|
-
CONFIG["ECHO_N"] = "-n"
|
48
|
-
CONFIG["ECHO_T"] = ""
|
49
|
-
CONFIG["LIBS"] = "-lwsock32 "
|
50
|
-
CONFIG["build_alias"] = "i686-darwin9.2.2"
|
51
|
-
CONFIG["host_alias"] = "i386-mingw32"
|
52
|
-
CONFIG["target_alias"] = "i386-mingw32"
|
53
|
-
CONFIG["MAJOR"] = "1"
|
54
|
-
CONFIG["MINOR"] = "8"
|
55
|
-
CONFIG["TEENY"] = "6"
|
56
|
-
CONFIG["build"] = "i686-pc-darwin9.2.2"
|
57
|
-
CONFIG["build_cpu"] = "i686"
|
58
|
-
CONFIG["build_vendor"] = "pc"
|
59
|
-
CONFIG["build_os"] = "darwin9.2.2"
|
60
|
-
CONFIG["host"] = "i386-pc-mingw32"
|
61
|
-
CONFIG["host_cpu"] = "i386"
|
62
|
-
CONFIG["host_vendor"] = "pc"
|
63
|
-
CONFIG["host_os"] = "mingw32"
|
64
|
-
CONFIG["target"] = "i386-pc-mingw32"
|
65
|
-
CONFIG["target_cpu"] = "i386"
|
66
|
-
CONFIG["target_vendor"] = "pc"
|
67
|
-
CONFIG["target_os"] = "mingw32"
|
68
|
-
CONFIG["CC"] = "i386-mingw32-gcc"
|
69
|
-
CONFIG["CFLAGS"] = "-g -O2 "
|
70
|
-
CONFIG["LDFLAGS"] = "-L. "
|
71
|
-
CONFIG["CPPFLAGS"] = ""
|
72
|
-
CONFIG["OBJEXT"] = "o"
|
73
|
-
CONFIG["CPP"] = "i386-mingw32-gcc -E"
|
74
|
-
CONFIG["GREP"] = "/usr/bin/grep"
|
75
|
-
CONFIG["EGREP"] = "/usr/bin/grep -E"
|
76
|
-
CONFIG["GNU_LD"] = "yes"
|
77
|
-
CONFIG["CPPOUTFILE"] = "-o conftest.i"
|
78
|
-
CONFIG["OUTFLAG"] = "-o "
|
79
|
-
CONFIG["YACC"] = "bison -y"
|
80
|
-
CONFIG["YFLAGS"] = ""
|
81
|
-
CONFIG["RANLIB"] = "i386-mingw32-ranlib"
|
82
|
-
CONFIG["AR"] = "i386-mingw32-ar"
|
83
|
-
CONFIG["AS"] = "i386-mingw32-as"
|
84
|
-
CONFIG["ASFLAGS"] = ""
|
85
|
-
CONFIG["NM"] = "i386-mingw32-nm"
|
86
|
-
CONFIG["WINDRES"] = "i386-mingw32-windres"
|
87
|
-
CONFIG["DLLWRAP"] = "i386-mingw32-dllwrap"
|
88
|
-
CONFIG["OBJDUMP"] = "i386-mingw32-objdump"
|
89
|
-
CONFIG["LN_S"] = "ln -s"
|
90
|
-
CONFIG["SET_MAKE"] = ""
|
91
|
-
CONFIG["INSTALL_PROGRAM"] = "$(INSTALL)"
|
92
|
-
CONFIG["INSTALL_SCRIPT"] = "$(INSTALL)"
|
93
|
-
CONFIG["INSTALL_DATA"] = "$(INSTALL) -m 644"
|
94
|
-
CONFIG["RM"] = "rm -f"
|
95
|
-
CONFIG["CP"] = "cp"
|
96
|
-
CONFIG["MAKEDIRS"] = "mkdir -p"
|
97
|
-
CONFIG["ALLOCA"] = ""
|
98
|
-
CONFIG["DLDFLAGS"] = " -Wl,--enable-auto-image-base,--enable-auto-import,--export-all"
|
99
|
-
CONFIG["ARCH_FLAG"] = ""
|
100
|
-
CONFIG["STATIC"] = ""
|
101
|
-
CONFIG["CCDLFLAGS"] = ""
|
102
|
-
CONFIG["LDSHARED"] = "i386-mingw32-gcc -shared -s"
|
103
|
-
CONFIG["DLEXT"] = "so"
|
104
|
-
CONFIG["DLEXT2"] = "dll"
|
105
|
-
CONFIG["LIBEXT"] = "a"
|
106
|
-
CONFIG["LINK_SO"] = ""
|
107
|
-
CONFIG["LIBPATHFLAG"] = " -L\"%s\""
|
108
|
-
CONFIG["RPATHFLAG"] = ""
|
109
|
-
CONFIG["LIBPATHENV"] = ""
|
110
|
-
CONFIG["TRY_LINK"] = ""
|
111
|
-
CONFIG["STRIP"] = "strip"
|
112
|
-
CONFIG["EXTSTATIC"] = ""
|
113
|
-
CONFIG["setup"] = "Setup"
|
114
|
-
CONFIG["MINIRUBY"] = "ruby -I#{ENV["HOME"]}/pkgs/ruby-1.8.6-p114 -rfake"
|
115
|
-
CONFIG["PREP"] = "fake.rb"
|
116
|
-
CONFIG["RUNRUBY"] = "$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`"
|
117
|
-
CONFIG["EXTOUT"] = ".ext"
|
118
|
-
CONFIG["ARCHFILE"] = ""
|
119
|
-
CONFIG["RDOCTARGET"] = ""
|
120
|
-
CONFIG["XCFLAGS"] = " -DRUBY_EXPORT"
|
121
|
-
CONFIG["XLDFLAGS"] = " -Wl,--stack,0x02000000"
|
122
|
-
CONFIG["LIBRUBY_LDSHARED"] = "i386-mingw32-gcc -shared -s"
|
123
|
-
CONFIG["LIBRUBY_DLDFLAGS"] = " -Wl,--enable-auto-image-base,--enable-auto-import,--export-all -Wl,--out-implib=$(LIBRUBY)"
|
124
|
-
CONFIG["rubyw_install_name"] = "rubyw"
|
125
|
-
CONFIG["RUBYW_INSTALL_NAME"] = "rubyw"
|
126
|
-
CONFIG["LIBRUBY_A"] = "lib$(RUBY_SO_NAME)-static.a"
|
127
|
-
CONFIG["LIBRUBY_SO"] = "$(RUBY_SO_NAME).dll"
|
128
|
-
CONFIG["LIBRUBY_ALIASES"] = ""
|
129
|
-
CONFIG["LIBRUBY"] = "lib$(LIBRUBY_SO).a"
|
130
|
-
CONFIG["LIBRUBYARG"] = "$(LIBRUBYARG_SHARED)"
|
131
|
-
CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static"
|
132
|
-
CONFIG["LIBRUBYARG_SHARED"] = "-l$(RUBY_SO_NAME)"
|
133
|
-
CONFIG["SOLIBS"] = "$(LIBS)"
|
134
|
-
CONFIG["DLDLIBS"] = ""
|
135
|
-
CONFIG["ENABLE_SHARED"] = "yes"
|
136
|
-
CONFIG["MAINLIBS"] = ""
|
137
|
-
CONFIG["COMMON_LIBS"] = "m"
|
138
|
-
CONFIG["COMMON_MACROS"] = ""
|
139
|
-
CONFIG["COMMON_HEADERS"] = "windows.h winsock.h"
|
140
|
-
CONFIG["EXPORT_PREFIX"] = ""
|
141
|
-
CONFIG["MAKEFILES"] = "Makefile GNUmakefile"
|
142
|
-
CONFIG["arch"] = "i386-mingw32"
|
143
|
-
CONFIG["sitearch"] = "i386-msvcrt"
|
144
|
-
CONFIG["sitedir"] = "$(prefix)/lib/ruby/site_ruby"
|
145
|
-
CONFIG["configure_args"] = " '--host=i386-mingw32' '--target=i386-mingw32' '--build=i686-darwin9.2.2' '--prefix=#{ENV['HOME']}/ruby-mingw32' 'build_alias=i686-darwin9.2.2' 'host_alias=i386-mingw32' 'target_alias=i386-mingw32'"
|
146
|
-
CONFIG["NROFF"] = "/usr/bin/nroff"
|
147
|
-
CONFIG["MANTYPE"] = "doc"
|
148
|
-
CONFIG["ruby_version"] = "$(MAJOR).$(MINOR)"
|
149
|
-
CONFIG["rubylibdir"] = "$(libdir)/ruby/$(ruby_version)"
|
150
|
-
CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
|
151
|
-
CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
|
152
|
-
CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
|
153
|
-
CONFIG["topdir"] = File.dirname(__FILE__)
|
154
|
-
MAKEFILE_CONFIG = {}
|
155
|
-
CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
|
156
|
-
def Config::expand(val, config = CONFIG)
|
157
|
-
val.gsub!(/\$\$|\$\(([^()]+)\)|\$\{([^{}]+)\}/) do |var|
|
158
|
-
if !(v = $1 || $2)
|
159
|
-
'$'
|
160
|
-
elsif key = config[v = v[/\A[^:]+(?=(?::(.*?)=(.*))?\z)/]]
|
161
|
-
pat, sub = $1, $2
|
162
|
-
config[v] = false
|
163
|
-
Config::expand(key, config)
|
164
|
-
config[v] = key
|
165
|
-
key = key.gsub(/#{Regexp.quote(pat)}(?=\s|\z)/n) {sub} if pat
|
166
|
-
key
|
167
|
-
else
|
168
|
-
var
|
169
|
-
end
|
170
|
-
end
|
171
|
-
val
|
172
|
-
end
|
173
|
-
CONFIG.each_value do |val|
|
174
|
-
Config::expand(val)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
RbConfig = Config # compatibility for ruby-1.9
|
178
|
-
CROSS_COMPILING = nil unless defined? CROSS_COMPILING
|