sqlanywhere 0.1.6-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +34 -0
- data/LICENSE +23 -0
- data/README +134 -0
- data/Rakefile +196 -0
- data/ext/Makefile +215 -0
- data/ext/extconf.rb +30 -0
- data/ext/sacapi.h +909 -0
- data/ext/sacapidll.c +182 -0
- data/ext/sacapidll.h +332 -0
- data/ext/sacapidll.o +0 -0
- data/ext/sqlanywhere-i386-mingw32.def +2 -0
- data/ext/sqlanywhere.c +1753 -0
- data/ext/sqlanywhere.o +0 -0
- data/ext/sqlanywhere.so +0 -0
- data/lib/sqlanywhere.so +0 -0
- data/test/sqlanywhere_test.rb +423 -0
- data/test/test.sql +92 -0
- metadata +73 -0
data/CHANGELOG
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
=CHANGE LOG
|
2
|
+
|
3
|
+
=====0.1.5 -- 2010/01/25
|
4
|
+
- Updated library to use DBCAPI 2.0
|
5
|
+
- Changed test suite to correctly test BIT and TINYINT types
|
6
|
+
- Added support for Ruby 1.9.1
|
7
|
+
|
8
|
+
=====0.1.4 -- 2009/03/25
|
9
|
+
- Changed Rakefile to automatically create lib directory
|
10
|
+
- Fixed bug that tried to build native extensions on binary distsributions
|
11
|
+
|
12
|
+
=====0.1.3 -- 2008/12/31
|
13
|
+
- Removed 'hint file' in lib directory
|
14
|
+
- Added extensions to gemspec to force a local compile
|
15
|
+
|
16
|
+
=====0.1.2 -- 2008/12/18
|
17
|
+
- Fixed bug when trying to read input value from OUTPUT parameter
|
18
|
+
- Added error checking to C2RB
|
19
|
+
- Fixed Rake to handle .bundle on OSX
|
20
|
+
|
21
|
+
=====0.1.1 -- 2008/11/06
|
22
|
+
- Created a source gem rake task
|
23
|
+
- Created a 'hint' file if the source gem is used directly
|
24
|
+
- Changed file permissions on archives
|
25
|
+
- Changed archives to be specific to platform (.zip on windows, .tar.gz
|
26
|
+
otherwise)
|
27
|
+
- Changed default rake task to only build library, not gem
|
28
|
+
- Added a gem rake task
|
29
|
+
|
30
|
+
=====0.1.0 -- 2008/10/15
|
31
|
+
- Initial Release
|
32
|
+
- Wraps DBCAPI functionality
|
33
|
+
- Includes a simple unit test suite
|
34
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
/*====================================================
|
2
|
+
*
|
3
|
+
* Copyright 2008-2011 iAnywhere Solutions, Inc.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
*
|
16
|
+
* See the License for the specific language governing permissions and
|
17
|
+
* limitations under the License.
|
18
|
+
*
|
19
|
+
* While not a requirement of the license, if you do modify this file, we
|
20
|
+
* would appreciate hearing about it. Please email sqlany_interfaces@sybase.com
|
21
|
+
*
|
22
|
+
*
|
23
|
+
*====================================================*/
|
data/README
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
=SQL Anywhere Ruby Driver
|
2
|
+
|
3
|
+
This is a native SQL Anywhere driver for Ruby. This library wraps the
|
4
|
+
functionality provided by the SQL Anywhere DBCAPI library. This driver
|
5
|
+
is intended to be a base-level library to be used by interface libraries
|
6
|
+
such as Ruby-DBI and ActiveRecord.
|
7
|
+
|
8
|
+
This driver can be used with SQL Anywhere 10 and later versions.
|
9
|
+
|
10
|
+
This driver is licensed under the Apache License, Version 2.
|
11
|
+
|
12
|
+
The official code repository is located on GitHub. The repository can be cloned with:
|
13
|
+
|
14
|
+
git clone git://github.com/sqlanywhere/sqlanywhere.git
|
15
|
+
|
16
|
+
==Build Instructions
|
17
|
+
|
18
|
+
===Requirements
|
19
|
+
* C Compiler
|
20
|
+
* Ruby
|
21
|
+
* RubyGem Package manager
|
22
|
+
|
23
|
+
|
24
|
+
===All Platforms
|
25
|
+
|
26
|
+
To build the library (.so), use:
|
27
|
+
|
28
|
+
rake
|
29
|
+
|
30
|
+
To build and install the gem, use:
|
31
|
+
|
32
|
+
rake gem
|
33
|
+
rake install
|
34
|
+
|
35
|
+
The other rake tasks are
|
36
|
+
|
37
|
+
rake clean -> Cleans up all temp files (ex *.~)
|
38
|
+
rake clobber -> Cleans up all built files (ex *.gem, *.o, *.so)
|
39
|
+
|
40
|
+
===Additional Install Notes for Windows
|
41
|
+
|
42
|
+
The popular One-Click Ruby Installer for Windows (RubyInstaller) is built using
|
43
|
+
Microsoft Visual C++ 6.0. Since problems can arise by combining binaries from
|
44
|
+
different compilers, we advise you use this compiler.
|
45
|
+
|
46
|
+
If you want to use a more recent version of the MS C++ compiler, you will need to make a few changes:
|
47
|
+
|
48
|
+
1. Open the file: <RUBY DIR>\lib\ruby\1.8\i386-mswin32\config.h, and comment out the first three lines so they look like:
|
49
|
+
|
50
|
+
//#if _MSC_VER != 1200
|
51
|
+
//#error MSC version unmatch
|
52
|
+
//#endif
|
53
|
+
|
54
|
+
This removes the check for C++ Version 6.0
|
55
|
+
|
56
|
+
2. Open <tt>rakefile</tt> and set:
|
57
|
+
|
58
|
+
APPLY_MANIFEST = true
|
59
|
+
|
60
|
+
This will add the manifest to the compiled binaries.
|
61
|
+
|
62
|
+
By default, rake will attempt to use Microsoft <tt>nmake</tt> when building under Windows. To use another make program, set:
|
63
|
+
|
64
|
+
USE_NMAKE_ON_WIN = FALSE
|
65
|
+
|
66
|
+
==Running Unit Tests
|
67
|
+
|
68
|
+
1. Change to the the <tt>test</tt> directory
|
69
|
+
|
70
|
+
cd test
|
71
|
+
|
72
|
+
2. Create a testing database:
|
73
|
+
|
74
|
+
dbinit test
|
75
|
+
|
76
|
+
3. Start the testing database:
|
77
|
+
|
78
|
+
dbeng11 test.db
|
79
|
+
|
80
|
+
4. Create the test schema:
|
81
|
+
|
82
|
+
dbisql -c "eng=test;uid=dba;pwd=sql" test.sql
|
83
|
+
|
84
|
+
5. Run the unit tests:
|
85
|
+
|
86
|
+
ruby sqlanywhere_test.rb
|
87
|
+
|
88
|
+
<b>If the tests fail to run, make sure you have set up the SQL Anywhere environment variables correctly.</b> For more information
|
89
|
+
review the online documentation here[http://dcx.sybase.com/index.php#http%3A%2F%2Fdcx.sybase.com%2F1100en%2Fdbadmin_en11%2Fda-envvar-sect1-3672410.html].
|
90
|
+
|
91
|
+
==Sample
|
92
|
+
|
93
|
+
This script makes a connection, prints <tt>Successful Ruby Connection</tt> to the SQL
|
94
|
+
Anywhere console, then disconnects.
|
95
|
+
|
96
|
+
# load the SQLAnywhere gem
|
97
|
+
begin
|
98
|
+
require 'rubygems'
|
99
|
+
gem 'sqlanywhere'
|
100
|
+
unless defined? SQLAnywhere
|
101
|
+
require 'sqlanywhere'
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# create an interface
|
106
|
+
api = SQLAnywhere::SQLAnywhereInterface.new()
|
107
|
+
|
108
|
+
# initialize the interface (loads the DLL/SO)
|
109
|
+
SQLAnywhere::API.sqlany_initialize_interface( api )
|
110
|
+
|
111
|
+
# initialize our api object
|
112
|
+
api.sqlany_init()
|
113
|
+
|
114
|
+
# create a connection
|
115
|
+
conn = api.sqlany_new_connection()
|
116
|
+
|
117
|
+
# establish a connection
|
118
|
+
api.sqlany_connect(conn, "uid=dba;pwd=sql")
|
119
|
+
|
120
|
+
# execute a query without a result set
|
121
|
+
api.sqlany_execute_immediate(conn, "MESSAGE 'Successful Ruby Connection'")
|
122
|
+
|
123
|
+
# disconnect from the database
|
124
|
+
api.sqlany_disconnect(conn)
|
125
|
+
|
126
|
+
# free the connection resources
|
127
|
+
api.sqlany_free_connection(conn)
|
128
|
+
|
129
|
+
# free resources the api object uses
|
130
|
+
api.sqlany_fini()
|
131
|
+
|
132
|
+
# close the interface
|
133
|
+
SQLAnywhere::API.sqlany_finalize_interface( api )
|
134
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
#====================================================
|
2
|
+
#
|
3
|
+
# Copyright 2008-2010 iAnywhere Solutions, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
#
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
# While not a requirement of the license, if you do modify this file, we
|
20
|
+
# would appreciate hearing about it. Please email sqlany_interfaces@sybase.com
|
21
|
+
#
|
22
|
+
#
|
23
|
+
#====================================================
|
24
|
+
|
25
|
+
require 'fileutils'
|
26
|
+
require 'rbconfig'
|
27
|
+
require 'rake/clean'
|
28
|
+
require 'rdoc/task'
|
29
|
+
require 'rubygems'
|
30
|
+
require 'rubygems/builder'
|
31
|
+
|
32
|
+
# By default, windows will try to use nmake instead of make. If you are on windows but using
|
33
|
+
# a different compiler that uses standard make, set this to false.
|
34
|
+
USE_NMAKE_ON_WIN = true
|
35
|
+
|
36
|
+
# By default on windows, ruby expects to be compiled by Visual Studio C++ 6.0. If you are using
|
37
|
+
# a newer version of Visual Studio, you will need to apply a manifest to the dll. To apply the
|
38
|
+
# manifest set this to true.
|
39
|
+
APPLY_MANIFEST = false
|
40
|
+
|
41
|
+
PACKAGE_NAME = "sqlanywhere"
|
42
|
+
ARCH=RbConfig::CONFIG['arch']
|
43
|
+
|
44
|
+
Dir.mkdir('lib') unless File.directory?('lib')
|
45
|
+
pkg_version = ""
|
46
|
+
|
47
|
+
library_file = ARCH =~ /darwin/ ? "sqlanywhere.bundle" : "sqlanywhere.so"
|
48
|
+
|
49
|
+
# The package version of determined by parsing the c source file. This ensures the version is
|
50
|
+
# only ever specified ins a single place.
|
51
|
+
File.open(File.join("ext", "sqlanywhere.c") ) do |f|
|
52
|
+
f.grep( /const char\* VERSION/ ) do |line|
|
53
|
+
pkg_version = /\s*const char\* VERSION\s*=\s*["|']([^"']*)["|'];\s*/.match(line)[1]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# If we can't determine the version, throw up your hands and exit
|
58
|
+
raise RuntimeError, "Could not determine current package version!" if pkg_version.empty?
|
59
|
+
|
60
|
+
MAKE = (ARCH =~ /win32/ and USE_NMAKE_ON_WIN) ? 'nmake' : 'make'
|
61
|
+
|
62
|
+
spec = Gem::Specification.new do |spec|
|
63
|
+
spec.authors = ["Eric Farrar"]
|
64
|
+
spec.email = 'eric.farrar@ianywhere.com'
|
65
|
+
spec.name = 'sqlanywhere'
|
66
|
+
spec.summary = 'SQL Anywhere library for Ruby'
|
67
|
+
spec.description = <<-EOF
|
68
|
+
SQL Anywhere Driver for Ruby
|
69
|
+
EOF
|
70
|
+
spec.version = pkg_version
|
71
|
+
#spec.autorequire = 'sqlanywhere'
|
72
|
+
spec.has_rdoc = true
|
73
|
+
spec.rubyforge_project = 'sqlanywhere'
|
74
|
+
spec.homepage = 'http://sqlanywhere.rubyforge.org'
|
75
|
+
spec.required_ruby_version = '>= 1.8.6'
|
76
|
+
spec.require_paths = ['lib']
|
77
|
+
spec.test_file = 'test/sqlanywhere_test.rb'
|
78
|
+
spec.rdoc_options << '--title' << 'SQL Anywhere Ruby Driver' <<
|
79
|
+
'--main' << 'README' <<
|
80
|
+
'--line-numbers'
|
81
|
+
spec.extra_rdoc_files = ['README', 'CHANGELOG', 'LICENSE', 'ext/sqlanywhere.c']
|
82
|
+
end
|
83
|
+
|
84
|
+
# The default task is to build the library (.dll or .so)
|
85
|
+
desc "Build the library"
|
86
|
+
task :default => [File.join("lib", library_file)]
|
87
|
+
|
88
|
+
# Builds the binary gem for this platform
|
89
|
+
desc "Build the gem"
|
90
|
+
task :gem => ["sqlanywhere-#{pkg_version}-#{spec.platform}.gem"]
|
91
|
+
|
92
|
+
file "sqlanywhere-#{pkg_version}-#{spec.platform}.gem" => ["Rakefile",
|
93
|
+
"test/test.sql",
|
94
|
+
"test/sqlanywhere_test.rb",
|
95
|
+
"README",
|
96
|
+
"CHANGELOG",
|
97
|
+
"LICENSE",
|
98
|
+
File.join("lib", library_file)] do
|
99
|
+
# Get the updated list of files to include in the gem
|
100
|
+
spec.files = Dir['ext/**/*'] + Dir['lib/**/*'] + Dir['test/**/*'] + Dir['CHANGELOG'] + Dir['LICENSE'] + Dir['README'] + Dir['Rakefile']
|
101
|
+
# Set the gem to be platform specific since it includes compiled binaries
|
102
|
+
spec.platform = Gem::Platform::CURRENT
|
103
|
+
#spec.extensions = ''
|
104
|
+
Gem::Builder.new(spec).build
|
105
|
+
end
|
106
|
+
|
107
|
+
# Builds the source gem for any platform
|
108
|
+
desc "Build the source gem"
|
109
|
+
task :source_gem => ["sqlanywhere-#{pkg_version}.gem"]
|
110
|
+
|
111
|
+
file "sqlanywhere-#{pkg_version}.gem" => ["Rakefile",
|
112
|
+
"test/test.sql",
|
113
|
+
"test/sqlanywhere_test.rb",
|
114
|
+
"README",
|
115
|
+
"CHANGELOG",
|
116
|
+
"LICENSE"] do
|
117
|
+
# Get the updated list of files to include in the gem
|
118
|
+
spec.files = Dir['ext/**/*'] + Dir['lib/**/*'] + Dir['test/**/*'] + Dir['CHANGELOG'] + Dir['LICENSE'] + Dir['README'] + Dir['Rakefile']
|
119
|
+
# Since this contains no compilked binaries, set it to be platform RUBY
|
120
|
+
spec.extensions = 'ext/extconf.rb'
|
121
|
+
Gem::Builder.new(spec).build
|
122
|
+
end
|
123
|
+
|
124
|
+
file File.join("lib", library_file) => [File.join("ext", library_file)] do
|
125
|
+
FileUtils.copy(File.join("ext", library_file), "lib")
|
126
|
+
end
|
127
|
+
|
128
|
+
file File.join("ext", library_file) => ["ext/sqlanywhere.c"] do
|
129
|
+
sh "cd ext && ruby extconf.rb"
|
130
|
+
sh "cd ext && #{MAKE}"
|
131
|
+
sh "cd ext && mt -outputresource:sqlanywhere.so;2 -manifest sqlanywhere.so.manifest" if APPLY_MANIFEST
|
132
|
+
end
|
133
|
+
|
134
|
+
desc "Install the gem"
|
135
|
+
task :install => [:gem] do
|
136
|
+
sh "gem install sqlanywhere-#{pkg_version}-#{spec.platform}.gem"
|
137
|
+
end
|
138
|
+
|
139
|
+
# This builds the distributables. On windows it builds a platform specific gem, a source gem, and a souce zip archive.
|
140
|
+
# On other platforms this builds a platform specific gem, a source gem, and a source tar.gz archive.
|
141
|
+
desc "Build distributables (src zip, src tar.gz, gem)"
|
142
|
+
task :dist do |t|
|
143
|
+
puts "Cleaning Build Environment..."
|
144
|
+
Rake.application['clobber'].invoke
|
145
|
+
|
146
|
+
files = Dir.glob('*')
|
147
|
+
|
148
|
+
puts "Creating #{File.join('build', PACKAGE_NAME)}-#{pkg_version} directory..."
|
149
|
+
FileUtils.mkdir_p "#{File.join('build', PACKAGE_NAME)}-#{pkg_version}"
|
150
|
+
|
151
|
+
puts "Copying files to #{File.join('build', PACKAGE_NAME)}-#{pkg_version}..."
|
152
|
+
FileUtils.cp_r files, "#{File.join('build', PACKAGE_NAME)}-#{pkg_version}"
|
153
|
+
|
154
|
+
if( ARCH =~ /win32/ ) then
|
155
|
+
system "attrib -R #{File.join('build', PACKAGE_NAME)}-#{pkg_version} /S"
|
156
|
+
else
|
157
|
+
system "find #{File.join('build', PACKAGE_NAME)}-#{pkg_version} -type d -exec chmod 755 {} \\;"
|
158
|
+
system "find #{File.join('build', PACKAGE_NAME)}-#{pkg_version} -type f -exec chmod 644 {} \\;"
|
159
|
+
end
|
160
|
+
|
161
|
+
if( ARCH =~ /win32/ ) then
|
162
|
+
puts "Creating #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.zip..."
|
163
|
+
system "cd build && zip -q -r #{PACKAGE_NAME}-#{pkg_version}.zip #{PACKAGE_NAME}-#{pkg_version}"
|
164
|
+
else
|
165
|
+
puts "Creating #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.tar..."
|
166
|
+
system "tar cf #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.tar -C build #{PACKAGE_NAME}-#{pkg_version}"
|
167
|
+
|
168
|
+
puts "GZipping to create #{File.join('build', PACKAGE_NAME, PACKAGE_NAME)}-#{pkg_version}.tar.gz..."
|
169
|
+
system "gzip #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.tar"
|
170
|
+
end
|
171
|
+
|
172
|
+
puts "Building GEM source distributable..."
|
173
|
+
Rake.application['source_gem'].invoke
|
174
|
+
|
175
|
+
puts "Copying source GEM to #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.gem..."
|
176
|
+
FileUtils.cp "#{PACKAGE_NAME}-#{pkg_version}.gem", "build"
|
177
|
+
|
178
|
+
puts "Building GEM binary distributable..."
|
179
|
+
Rake.application['gem'].invoke
|
180
|
+
|
181
|
+
puts "Copying binary GEM to #{File.join('build', PACKAGE_NAME)}-#{pkg_version}-#{spec.platform}.gem..."
|
182
|
+
FileUtils.cp "#{PACKAGE_NAME}-#{pkg_version}-#{spec.platform}.gem", "build"
|
183
|
+
end
|
184
|
+
|
185
|
+
RDoc::Task.new do |rd|
|
186
|
+
rd.title = "SQL Anywhere Ruby Driver"
|
187
|
+
rd.main = "README"
|
188
|
+
rd.rdoc_files.include('README', 'CHANGELOG', 'LICENSE', 'ext/sqlanywhere.c')
|
189
|
+
end
|
190
|
+
|
191
|
+
desc "Publish the RDOCs on RubyForge"
|
192
|
+
task :publish_rdoc => ["html/index.html"] do
|
193
|
+
system "pscp -r html/* efarrar@rubyforge.org:/var/www/gforge-projects/sqlanywhere/sqlanywhere"
|
194
|
+
end
|
195
|
+
|
196
|
+
CLOBBER.include("sqlanywhere-#{pkg_version}-#{spec.platform}.gem", "sqlanywhere-#{pkg_version}.gem", "lib/*", "ext/*.obj", "ext/*.def", "ext/*.so", "ext/*.bundle", "ext/*.log", "ext/*.exp", "ext/*.lib", "ext/*.pdb", "ext/Makefile", "ext/*.so.manifest", "ext/*.o", "build/**/*", "build")
|
data/ext/Makefile
ADDED
@@ -0,0 +1,215 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
# V=0 quiet, V=1 verbose. other values don't work.
|
5
|
+
V = 0
|
6
|
+
Q1 = $(V:1=)
|
7
|
+
Q = $(Q1:0=@)
|
8
|
+
n=$(NULLCMD)
|
9
|
+
ECHO1 = $(V:1=@$n)
|
10
|
+
ECHO = $(ECHO1:0=@echo)
|
11
|
+
|
12
|
+
#### Start of system configuration section. ####
|
13
|
+
|
14
|
+
srcdir = .
|
15
|
+
topdir = /C/Ruby193/include/ruby-1.9.1
|
16
|
+
hdrdir = /C/Ruby193/include/ruby-1.9.1
|
17
|
+
arch_hdrdir = C:/Ruby193/include/ruby-1.9.1/$(arch)
|
18
|
+
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
19
|
+
|
20
|
+
DESTDIR = C:
|
21
|
+
prefix = $(DESTDIR)/Ruby193
|
22
|
+
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
23
|
+
exec_prefix = $(prefix)
|
24
|
+
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
25
|
+
sitehdrdir = $(rubyhdrdir)/site_ruby
|
26
|
+
rubyhdrdir = $(includedir)/$(RUBY_BASE_NAME)-$(ruby_version)
|
27
|
+
vendordir = $(rubylibprefix)/vendor_ruby
|
28
|
+
sitedir = $(rubylibprefix)/site_ruby
|
29
|
+
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
30
|
+
mandir = $(datarootdir)/man
|
31
|
+
localedir = $(datarootdir)/locale
|
32
|
+
libdir = $(exec_prefix)/lib
|
33
|
+
psdir = $(docdir)
|
34
|
+
pdfdir = $(docdir)
|
35
|
+
dvidir = $(docdir)
|
36
|
+
htmldir = $(docdir)
|
37
|
+
infodir = $(datarootdir)/info
|
38
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
39
|
+
oldincludedir = $(DESTDIR)/usr/include
|
40
|
+
includedir = $(prefix)/include
|
41
|
+
localstatedir = $(prefix)/var
|
42
|
+
sharedstatedir = $(prefix)/com
|
43
|
+
sysconfdir = $(prefix)/etc
|
44
|
+
datadir = $(datarootdir)
|
45
|
+
datarootdir = $(prefix)/share
|
46
|
+
libexecdir = $(exec_prefix)/libexec
|
47
|
+
sbindir = $(exec_prefix)/sbin
|
48
|
+
bindir = $(exec_prefix)/bin
|
49
|
+
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
50
|
+
archdir = $(rubylibdir)/$(arch)
|
51
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
52
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
53
|
+
vendorlibdir = $(vendordir)/$(ruby_version)
|
54
|
+
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
55
|
+
|
56
|
+
NULLCMD = :
|
57
|
+
|
58
|
+
CC = gcc
|
59
|
+
CXX = g++
|
60
|
+
LIBRUBY = lib$(RUBY_SO_NAME).dll.a
|
61
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
62
|
+
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
63
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
64
|
+
OUTFLAG = -o
|
65
|
+
COUTFLAG = -o
|
66
|
+
|
67
|
+
RUBY_EXTCONF_H =
|
68
|
+
cflags = $(optflags) $(debugflags) $(warnflags)
|
69
|
+
optflags = -O3
|
70
|
+
debugflags = -g
|
71
|
+
warnflags = -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
|
72
|
+
CFLAGS = $(cflags)
|
73
|
+
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
74
|
+
DEFS =
|
75
|
+
CPPFLAGS = $(DEFS) $(cppflags)
|
76
|
+
CXXFLAGS = $(CFLAGS) $(cxxflags)
|
77
|
+
ldflags = -L.
|
78
|
+
dldflags = -Wl,--enable-auto-image-base,--enable-auto-import $(DEFFILE)
|
79
|
+
ARCH_FLAG =
|
80
|
+
DLDFLAGS = $(ldflags) $(dldflags)
|
81
|
+
LDSHARED = $(CC) -shared $(if $(filter-out -g -g0,$(debugflags)),,-s)
|
82
|
+
LDSHAREDXX = $(CXX) -shared $(if $(filter-out -g -g0,$(debugflags)),,-s)
|
83
|
+
AR = ar
|
84
|
+
EXEEXT = .exe
|
85
|
+
|
86
|
+
RUBY_BASE_NAME = ruby
|
87
|
+
RUBY_INSTALL_NAME = ruby
|
88
|
+
RUBY_SO_NAME = msvcrt-ruby191
|
89
|
+
arch = i386-mingw32
|
90
|
+
sitearch = i386-msvcrt
|
91
|
+
ruby_version = 1.9.1
|
92
|
+
ruby = C:/Ruby193/bin/ruby
|
93
|
+
RUBY = $(ruby)
|
94
|
+
RM = rm -f
|
95
|
+
RM_RF = $(RUBY) -run -e rm -- -rf
|
96
|
+
RMDIRS = rmdir --ignore-fail-on-non-empty -p
|
97
|
+
MAKEDIRS = /usr/bin/mkdir -p
|
98
|
+
INSTALL = /usr/bin/install -c
|
99
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
100
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
101
|
+
COPY = cp
|
102
|
+
|
103
|
+
#### End of system configuration section. ####
|
104
|
+
|
105
|
+
preload =
|
106
|
+
|
107
|
+
libpath = . $(libdir)
|
108
|
+
LIBPATH = -L. -L$(libdir)
|
109
|
+
DEFFILE = $(TARGET)-$(arch).def
|
110
|
+
|
111
|
+
CLEANFILES = mkmf.log $(DEFFILE)
|
112
|
+
DISTCLEANFILES =
|
113
|
+
DISTCLEANDIRS =
|
114
|
+
|
115
|
+
extout =
|
116
|
+
extout_prefix =
|
117
|
+
target_prefix =
|
118
|
+
LOCAL_LIBS =
|
119
|
+
LIBS = $(LIBRUBYARG_SHARED) -lshell32 -lws2_32 -limagehlp
|
120
|
+
SRCS = sacapidll.c sqlanywhere.c
|
121
|
+
OBJS = sacapidll.o sqlanywhere.o
|
122
|
+
TARGET = sqlanywhere
|
123
|
+
DLLIB = $(TARGET).so
|
124
|
+
EXTSTATIC =
|
125
|
+
STATIC_LIB =
|
126
|
+
|
127
|
+
BINDIR = $(bindir)
|
128
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
129
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
130
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
131
|
+
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
132
|
+
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
133
|
+
|
134
|
+
TARGET_SO = $(DLLIB)
|
135
|
+
CLEANLIBS = $(TARGET).so
|
136
|
+
CLEANOBJS = *.o *.bak
|
137
|
+
|
138
|
+
all: $(DLLIB)
|
139
|
+
static: $(STATIC_LIB)
|
140
|
+
.PHONY: all install static install-so install-rb
|
141
|
+
.PHONY: clean clean-so clean-rb
|
142
|
+
|
143
|
+
clean-rb-default::
|
144
|
+
clean-rb::
|
145
|
+
clean-so::
|
146
|
+
clean: clean-so clean-rb-default clean-rb
|
147
|
+
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
148
|
+
|
149
|
+
distclean-rb-default::
|
150
|
+
distclean-rb::
|
151
|
+
distclean-so::
|
152
|
+
distclean: clean distclean-so distclean-rb-default distclean-rb
|
153
|
+
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
154
|
+
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
155
|
+
@-$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
156
|
+
|
157
|
+
realclean: distclean
|
158
|
+
install: install-so install-rb
|
159
|
+
|
160
|
+
install-so: $(RUBYARCHDIR)
|
161
|
+
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
162
|
+
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
163
|
+
@-$(MAKEDIRS) $(@D)
|
164
|
+
$(INSTALL_PROG) $(DLLIB) $(@D)
|
165
|
+
install-rb: pre-install-rb install-rb-default
|
166
|
+
install-rb-default: pre-install-rb-default
|
167
|
+
pre-install-rb: Makefile
|
168
|
+
pre-install-rb-default: Makefile
|
169
|
+
pre-install-rb-default:
|
170
|
+
$(ECHO) installing default sqlanywhere libraries
|
171
|
+
$(RUBYARCHDIR):
|
172
|
+
$(Q) $(MAKEDIRS) $@
|
173
|
+
|
174
|
+
site-install: site-install-so site-install-rb
|
175
|
+
site-install-so: install-so
|
176
|
+
site-install-rb: install-rb
|
177
|
+
|
178
|
+
.SUFFIXES: .c .m .cc .mm .cxx .cpp .o
|
179
|
+
|
180
|
+
.cc.o:
|
181
|
+
$(ECHO) compiling $(<)
|
182
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
183
|
+
|
184
|
+
.mm.o:
|
185
|
+
$(ECHO) compiling $(<)
|
186
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
187
|
+
|
188
|
+
.cxx.o:
|
189
|
+
$(ECHO) compiling $(<)
|
190
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
191
|
+
|
192
|
+
.cpp.o:
|
193
|
+
$(ECHO) compiling $(<)
|
194
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
195
|
+
|
196
|
+
.c.o:
|
197
|
+
$(ECHO) compiling $(<)
|
198
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
199
|
+
|
200
|
+
.m.o:
|
201
|
+
$(ECHO) compiling $(<)
|
202
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
203
|
+
|
204
|
+
$(DLLIB): $(DEFFILE) $(OBJS) Makefile
|
205
|
+
$(ECHO) linking shared-object $(DLLIB)
|
206
|
+
@-$(RM) $(@)
|
207
|
+
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
$(DEFFILE):
|
212
|
+
$(ECHO) generating $(@)
|
213
|
+
$(Q) $(RUBY) -e "puts 'EXPORTS', '' + 'Init_$(TARGET)'.sub(/\..*\z/,'')" > $@
|
214
|
+
|
215
|
+
$(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h
|