tiny_tds 1.0.4 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.codeclimate.yml +20 -0
- data/.gitattributes +1 -0
- data/.github/workflows/ci.yml +590 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +31 -0
- data/{CHANGELOG → CHANGELOG.md} +133 -26
- data/Gemfile +1 -5
- data/ISSUE_TEMPLATE.md +36 -3
- data/README.md +147 -85
- data/Rakefile +51 -94
- data/VERSION +1 -1
- data/docker-compose.yml +34 -0
- data/ext/tiny_tds/client.c +149 -67
- data/ext/tiny_tds/client.h +11 -5
- data/ext/tiny_tds/extconf.rb +144 -283
- data/ext/tiny_tds/extconsts.rb +4 -11
- data/ext/tiny_tds/result.c +68 -50
- data/ext/tiny_tds/tiny_tds_ext.c +4 -1
- data/lib/tiny_tds/bin.rb +44 -40
- data/lib/tiny_tds/client.rb +63 -55
- data/lib/tiny_tds/error.rb +0 -3
- data/lib/tiny_tds/gem.rb +23 -0
- data/lib/tiny_tds/result.rb +0 -3
- data/lib/tiny_tds.rb +37 -32
- data/{ports/patches/freetds/1.00 → patches/freetds/1.00.27}/0001-mingw_missing_inet_pton.diff +4 -4
- data/patches/freetds/1.00.27/0002-Don-t-use-MSYS2-file-libws2_32.diff +28 -0
- data/patches/libiconv/1.14/1-avoid-gets-error.patch +17 -0
- data/setup_cimgruby_dev.sh +25 -0
- data/start_dev.sh +21 -0
- data/tasks/native_gem.rake +16 -0
- data/tasks/package.rake +6 -0
- data/tasks/ports.rake +24 -0
- data/tasks/test.rake +7 -0
- data/test/bin/install-freetds.sh +18 -0
- data/test/bin/install-mssql.ps1 +42 -0
- data/test/bin/install-mssqltools.sh +9 -0
- data/test/bin/install-openssl.sh +18 -0
- data/test/bin/restore-from-native-gem.ps1 +10 -0
- data/test/bin/setup_tinytds_db.sh +7 -0
- data/test/bin/setup_volume_permissions.sh +10 -0
- data/test/client_test.rb +161 -112
- data/test/gem_test.rb +100 -0
- data/test/result_test.rb +293 -313
- data/test/schema_test.rb +369 -395
- data/test/sql/db-create.sql +18 -0
- data/test/sql/db-login.sql +38 -0
- data/test/test_helper.rb +116 -85
- data/test/thread_test.rb +22 -31
- data/tiny_tds.gemspec +27 -24
- metadata +109 -56
- data/appveyor.yml +0 -51
- data/test/appveyor/dbsetup.ps1 +0 -27
- data/test/appveyor/dbsetup.sql +0 -9
- data/test/benchmark/query.rb +0 -77
- data/test/benchmark/query_odbc.rb +0 -106
- data/test/benchmark/query_tinytds.rb +0 -126
- data/test/schema/sqlserver_2000.sql +0 -140
- data/test/schema/sqlserver_2005.sql +0 -140
- data/test/schema/sqlserver_2014.sql +0 -140
- data/test/schema/sybase_ase.sql +0 -138
- /data/bin/{defncopy → defncopy-ttds} +0 -0
- /data/bin/{tsql → tsql-ttds} +0 -0
- /data/test/schema/{sqlserver_2008.sql → sqlserver_2017.sql} +0 -0
data/ext/tiny_tds/extconf.rb
CHANGED
@@ -1,329 +1,190 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
|
15
|
-
|
16
|
-
# Shamelessly copied from nokogiri
|
17
|
-
#
|
18
|
-
|
19
|
-
def do_help
|
20
|
-
print <<HELP
|
21
|
-
usage: ruby #{$0} [options]
|
22
|
-
|
23
|
-
--enable-system-freetds / --disable-system-freetds
|
24
|
-
--enable-system-iconv / --disable-system-iconv
|
25
|
-
--enable-system-openssl / --disable-system-openssl
|
26
|
-
Force use of system or builtin freetds/iconv/openssl library.
|
27
|
-
Default is to prefer system libraries and fallback to builtin.
|
28
|
-
|
29
|
-
--with-freetds-dir=DIR
|
30
|
-
Use the freetds library placed under DIR.
|
31
|
-
|
32
|
-
--enable-lookup
|
33
|
-
Search for freetds through all paths in the PATH environment variable.
|
34
|
-
|
35
|
-
--disable-openssl
|
36
|
-
Disable OpenSSL for freetds build. No effect on system-freetds.
|
37
|
-
|
38
|
-
--enable-gnutls
|
39
|
-
Use GnuTLS instead of OpenSSL for freetds build.
|
40
|
-
|
41
|
-
--enable-cross-build
|
42
|
-
Do cross-build.
|
43
|
-
HELP
|
44
|
-
exit! 0
|
45
|
-
end
|
46
|
-
|
47
|
-
do_help if arg_config('--help')
|
48
|
-
|
49
|
-
FREETDSDIR = ENV['FREETDS_DIR']
|
50
|
-
|
51
|
-
if FREETDSDIR.nil? || FREETDSDIR.empty?
|
52
|
-
LIBDIR = RbConfig::CONFIG['libdir']
|
53
|
-
INCLUDEDIR = RbConfig::CONFIG['includedir']
|
54
|
-
else
|
55
|
-
puts "Will use #{FREETDSDIR}"
|
56
|
-
LIBDIR = "#{FREETDSDIR}/lib"
|
57
|
-
INCLUDEDIR = "#{FREETDSDIR}/include"
|
58
|
-
end
|
59
|
-
|
60
|
-
$CFLAGS << " #{ENV["CFLAGS"]}"
|
61
|
-
$LDFLAGS << " #{ENV["LDFLAGS"]}"
|
62
|
-
$LIBS << " #{ENV["LIBS"]}"
|
63
|
-
|
64
|
-
SEARCHABLE_PATHS = begin
|
65
|
-
eop_regexp = /#{File::SEPARATOR}bin$/
|
66
|
-
paths = ENV['PATH']
|
67
|
-
paths = paths.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
|
68
|
-
paths = paths.split(File::PATH_SEPARATOR)
|
69
|
-
bin_paths = paths.select{ |p| p =~ eop_regexp }
|
70
|
-
bin_paths.map{ |p| p.sub(eop_regexp,'') }.compact.reject{ |p| p.empty? }.uniq
|
1
|
+
require "mkmf"
|
2
|
+
require_relative "extconsts"
|
3
|
+
|
4
|
+
if ENV["MAINTAINER_MODE"]
|
5
|
+
warn "Maintainer mode enabled."
|
6
|
+
$CFLAGS << # standard:disable Style/GlobalVars
|
7
|
+
" -Wall" \
|
8
|
+
" -ggdb" \
|
9
|
+
" -DDEBUG" \
|
10
|
+
" -pedantic"
|
11
|
+
$LDFLAGS << # standard:disable Style/GlobalVars
|
12
|
+
" -ggdb"
|
71
13
|
end
|
72
14
|
|
73
|
-
|
74
|
-
|
75
|
-
directories.map do |paths|
|
76
|
-
dir = File.join path, *paths
|
77
|
-
File.directory?(dir) ? dir : nil
|
78
|
-
end.flatten.compact
|
79
|
-
end.flatten.compact
|
80
|
-
end
|
15
|
+
if (gem_platform = with_config("cross-build"))
|
16
|
+
require "mini_portile2"
|
81
17
|
|
82
|
-
|
83
|
-
def initialize(name, version, files)
|
84
|
-
super(name, version)
|
85
|
-
self.files = files
|
86
|
-
self.target = File.expand_path('../../../ports', __FILE__)
|
87
|
-
self.host = consolidated_host(RbConfig::CONFIG["host"])
|
88
|
-
self.patch_files = Dir[File.join(self.target, "patches", self.name, self.version, "*.diff")].sort
|
89
|
-
end
|
18
|
+
openssl_platform = with_config("openssl-platform")
|
90
19
|
|
91
|
-
|
92
|
-
|
93
|
-
name.gsub('i686-pc-mingw32', 'i686-w64-mingw32')
|
94
|
-
end
|
20
|
+
class BuildRecipe < MiniPortile
|
21
|
+
attr_accessor :gem_platform
|
95
22
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
"
|
100
|
-
"
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
# Use the same path for all recipes, so that only one include/lib path is required.
|
105
|
-
def port_path
|
106
|
-
"#{target}/#{host}"
|
107
|
-
end
|
108
|
-
|
109
|
-
# We use the same port_path for all recipes. That breaks the standard installed? method.
|
110
|
-
def installed?
|
111
|
-
false
|
112
|
-
end
|
23
|
+
def initialize(name, version, files)
|
24
|
+
super(name, version)
|
25
|
+
self.files = files
|
26
|
+
rootdir = File.expand_path("../../..", __FILE__)
|
27
|
+
self.target = File.join(rootdir, "ports")
|
28
|
+
self.patch_files = Dir[File.join("patches", self.name, self.version, "*.patch")].sort
|
29
|
+
end
|
113
30
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
def chdir_for_build
|
118
|
-
build_dir = ENV['RCD_HOST_RUBY_PLATFORM'].to_s =~ /mingw|mswin|cygwin/ ? '/tmp' : '.'
|
119
|
-
Dir.chdir(build_dir) do
|
120
|
-
yield
|
31
|
+
# this will yield all ports into the same directory, making our path configuration for the linker easier
|
32
|
+
def port_path
|
33
|
+
"#{@target}/#{gem_platform}"
|
121
34
|
end
|
122
|
-
end
|
123
35
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
36
|
+
def cook_and_activate
|
37
|
+
checkpoint = File.join(target, "#{name}-#{version}-#{gem_platform}.installed")
|
38
|
+
|
39
|
+
unless File.exist?(checkpoint)
|
40
|
+
cook
|
41
|
+
FileUtils.touch checkpoint
|
129
42
|
end
|
130
|
-
|
43
|
+
|
44
|
+
activate
|
45
|
+
self
|
131
46
|
end
|
132
|
-
self.activate
|
133
|
-
self
|
134
47
|
end
|
135
|
-
end
|
136
48
|
|
137
|
-
|
138
|
-
BuildRecipe.new("openssl", OPENSSL_VERSION, [OPENSSL_SOURCE_URI]).tap do |recipe|
|
49
|
+
openssl_recipe = BuildRecipe.new("openssl", OPENSSL_VERSION, [OPENSSL_SOURCE_URI]).tap do |recipe|
|
139
50
|
class << recipe
|
140
|
-
|
141
|
-
filename = File.basename(file)
|
142
|
-
FileUtils.mkdir_p target
|
143
|
-
|
144
|
-
message "Extracting #{filename} into #{target}... "
|
145
|
-
result = `#{tar_exe} #{tar_compression_switch(filename)}xf "#{file}" -C "#{target}" 2>&1`
|
146
|
-
if $?.success?
|
147
|
-
output "OK"
|
148
|
-
else
|
149
|
-
# tar on windows returns error exit code, because it can not extract symlinks
|
150
|
-
output "ERROR (ignored)"
|
151
|
-
end
|
152
|
-
end
|
51
|
+
attr_accessor :openssl_platform
|
153
52
|
|
154
53
|
def configure
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
"./Configure",
|
160
|
-
"no-shared",
|
161
|
-
configure_prefix,
|
162
|
-
config,
|
163
|
-
]
|
164
|
-
args.unshift("CROSS_COMPILE=#{host}-") if enable_config("cross-build")
|
165
|
-
|
166
|
-
execute "configure", "sh -c \"#{args.join(" ")}\""
|
54
|
+
envs = []
|
55
|
+
envs << "CFLAGS=-DDSO_WIN32 -DOPENSSL_THREADS" if MiniPortile.windows?
|
56
|
+
envs << "CFLAGS=-fPIC -DOPENSSL_THREADS" if MiniPortile.linux?
|
57
|
+
execute("configure", ["env", *envs, "./Configure", openssl_platform, "threads", "-static", "CROSS_COMPILE=#{host}-", configure_prefix, "--libdir=lib"], altlog: "config.log")
|
167
58
|
end
|
168
59
|
|
169
60
|
def compile
|
170
|
-
|
171
|
-
# OpenSSL DLLs are called "libeay32.dll" and "ssleay32.dll" per default,
|
172
|
-
# regardless to the version. This is best suited to meet the Windows DLL hell.
|
173
|
-
# To avoid any conflicts we do a static build and build DLLs afterwards,
|
174
|
-
# with our own naming scheme.
|
175
|
-
execute "mkdef-libeay32", "(perl util/mkdef.pl 32 libeay >libeay32.def)"
|
176
|
-
execute "mkdef-ssleay32", "(perl util/mkdef.pl 32 ssleay >ssleay32.def)"
|
177
|
-
dllwrap = consolidated_host(RbConfig::CONFIG["DLLWRAP"])
|
178
|
-
execute "dllwrap-libeay32", "#{dllwrap} --dllname libeay32-#{version}-#{host}.dll --output-lib libcrypto.dll.a --def libeay32.def libcrypto.a -lwsock32 -lgdi32 -lcrypt32"
|
179
|
-
execute "dllwrap-ssleay32", "#{dllwrap} --dllname ssleay32-#{version}-#{host}.dll --output-lib libssl.dll.a --def ssleay32.def libssl.a libcrypto.dll.a"
|
61
|
+
execute("compile", "#{make_cmd} build_libs")
|
180
62
|
end
|
181
63
|
|
182
64
|
def install
|
183
|
-
|
184
|
-
FileUtils.cp "#{work_path}/libeay32-#{version}-#{host}.dll", "#{path}/bin/"
|
185
|
-
FileUtils.cp "#{work_path}/ssleay32-#{version}-#{host}.dll", "#{path}/bin/"
|
186
|
-
FileUtils.cp "#{work_path}/libcrypto.dll.a", "#{path}/lib/"
|
187
|
-
FileUtils.cp "#{work_path}/libssl.dll.a", "#{path}/lib/"
|
65
|
+
execute("install", "#{make_cmd} install_dev")
|
188
66
|
end
|
189
67
|
end
|
68
|
+
|
69
|
+
recipe.gem_platform = gem_platform
|
70
|
+
recipe.openssl_platform = openssl_platform
|
71
|
+
recipe.cook_and_activate
|
190
72
|
end
|
191
|
-
end
|
192
73
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
74
|
+
libiconv_recipe = BuildRecipe.new("libiconv", ICONV_VERSION, [ICONV_SOURCE_URI]).tap do |recipe|
|
75
|
+
recipe.configure_options << "CFLAGS=-fPIC" if MiniPortile.linux?
|
76
|
+
recipe.gem_platform = gem_platform
|
77
|
+
|
78
|
+
recipe.cook_and_activate
|
197
79
|
end
|
198
|
-
end
|
199
80
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
recipe.configure_options << '--with-pic'
|
205
|
-
recipe.configure_options << "--with-libiconv-prefix=#{libiconv.path}" if libiconv
|
206
|
-
if true == libssl
|
207
|
-
recipe.configure_options << "--with-openssl"
|
208
|
-
elsif libssl
|
209
|
-
recipe.configure_options << "--with-openssl=#{libssl.path}"
|
210
|
-
end
|
211
|
-
recipe.configure_options << "--with-gnutls" if gnutls
|
212
|
-
recipe.configure_options << '--sysconfdir=C:\Sites' if for_windows
|
213
|
-
recipe.configure_options << '--enable-sspi' if for_windows
|
214
|
-
recipe.configure_options << "--disable-odbc"
|
215
|
-
recipe.configure_options << with_tdsver
|
216
|
-
if libiconv
|
217
|
-
# For some reason freetds doesn't honor --with-libiconv-prefix
|
218
|
-
# so we have do add it by hand:
|
219
|
-
recipe.configure_options << "CFLAGS=-I#{libiconv.path}/include"
|
220
|
-
recipe.configure_options << "LDFLAGS=-L#{libiconv.path}/lib -liconv"
|
221
|
-
end
|
81
|
+
# remove the ".la" files, otherwise libtool starts to complain when linking into FreeTDS
|
82
|
+
Dir.glob(File.join(libiconv_recipe.path, "lib", "**", "*.la")).each do |la_file|
|
83
|
+
File.delete(la_file)
|
84
|
+
end
|
222
85
|
|
86
|
+
freetds_recipe = BuildRecipe.new("freetds", FREETDS_VERSION, [FREETDS_SOURCE_URI]).tap do |recipe|
|
223
87
|
class << recipe
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
return unless File.directory?(bin_path)
|
232
|
-
['tsql', 'defncopy'].each do |bin|
|
233
|
-
['.exe', ''].each do |ext|
|
234
|
-
exe = File.join bin_path, "#{bin}#{ext}"
|
235
|
-
next unless File.exists?(exe)
|
236
|
-
next unless File.executable?(exe)
|
237
|
-
FileUtils.cp exe, exe_path
|
238
|
-
end
|
239
|
-
end
|
240
|
-
end
|
241
|
-
super_value
|
88
|
+
def configure_defaults
|
89
|
+
[
|
90
|
+
"--host=#{@host}",
|
91
|
+
"--enable-shared",
|
92
|
+
"--disable-static",
|
93
|
+
"--disable-odbc"
|
94
|
+
]
|
242
95
|
end
|
96
|
+
end
|
243
97
|
|
98
|
+
# i am not 100% what is going on behind the scenes
|
99
|
+
# it seems that FreeTDS build system prefers OPENSSL_CFLAGS and OPENSSL_LIBS
|
100
|
+
# but the linker still relies on LIBS and CPPFLAGS
|
101
|
+
# removing one or the other leads to build failures in any case of FreeTDS
|
102
|
+
if MiniPortile.linux?
|
103
|
+
recipe.configure_options << "CFLAGS=-fPIC"
|
104
|
+
elsif MiniPortile.windows?
|
105
|
+
recipe.configure_options << "--enable-sspi"
|
244
106
|
end
|
245
107
|
|
108
|
+
# pass an additional runtime path to the linker so defncopy and tsql can find our shared sybdb
|
109
|
+
recipe.configure_options << "LDFLAGS=-L#{openssl_recipe.path}/lib #{"-Wl,-rpath='$$ORIGIN/../lib'" if MiniPortile.linux?}"
|
110
|
+
recipe.configure_options << "LIBS=-liconv -lssl -lcrypto #{"-lwsock32 -lgdi32 -lws2_32 -lcrypt32" if MiniPortile.windows?} #{"-ldl -lpthread" if MiniPortile.linux?}"
|
111
|
+
recipe.configure_options << "CPPFLAGS=-I#{openssl_recipe.path}/include"
|
112
|
+
|
113
|
+
recipe.configure_options << "OPENSSL_CFLAGS=-L#{openssl_recipe.path}/lib"
|
114
|
+
recipe.configure_options << "OPENSSL_LIBS=-lssl -lcrypto #{"-lwsock32 -lgdi32 -lws2_32 -lcrypt32" if MiniPortile.windows?} #{"-ldl -lpthread" if MiniPortile.linux?}"
|
115
|
+
|
116
|
+
recipe.configure_options << "--with-openssl=#{openssl_recipe.path}"
|
117
|
+
recipe.configure_options << "--with-libiconv-prefix=#{libiconv_recipe.path}"
|
118
|
+
recipe.configure_options << "--sysconfdir=C:/Sites" if MiniPortile.windows?
|
119
|
+
|
120
|
+
recipe.gem_platform = gem_platform
|
121
|
+
recipe.cook_and_activate
|
246
122
|
end
|
247
|
-
end
|
248
123
|
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
#
|
253
|
-
# variables
|
254
|
-
HEADER_DIRS = [INCLUDEDIR]
|
255
|
-
LIB_DIRS = [LIBDIR]
|
124
|
+
# enable relative path to later load the FreeTDS shared library
|
125
|
+
$LDFLAGS << " '-Wl,-rpath=$$ORIGIN/../../../ports/#{gem_platform}/lib'" # standard:disable Style/GlobalVars
|
126
|
+
|
127
|
+
dir_config("freetds", "#{freetds_recipe.path}/include", "#{freetds_recipe.path}/lib")
|
256
128
|
else
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
#
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
129
|
+
# Make sure to check the ports path for the configured host
|
130
|
+
architecture = RbConfig::CONFIG["arch"]
|
131
|
+
|
132
|
+
project_dir = File.expand_path("../../..", __FILE__)
|
133
|
+
freetds_ports_dir = File.join(project_dir, "ports", architecture, "freetds", FREETDS_VERSION)
|
134
|
+
freetds_ports_dir = File.expand_path(freetds_ports_dir)
|
135
|
+
|
136
|
+
# Add all the special path searching from the original tiny_tds build
|
137
|
+
# order is important here! First in, first searched.
|
138
|
+
DIRS = %w[
|
139
|
+
/opt/local
|
140
|
+
/usr/local
|
141
|
+
]
|
142
|
+
|
143
|
+
if /darwin/i.match?(RbConfig::CONFIG["host_os"])
|
144
|
+
# Ruby below 2.7 seems to label the host CPU on Apple Silicon as aarch64
|
145
|
+
# 2.7 and above print is as ARM64
|
146
|
+
target_host_cpu = (Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7")) ? "aarch64" : "arm64"
|
147
|
+
|
148
|
+
if RbConfig::CONFIG["host_cpu"] == target_host_cpu
|
149
|
+
# Homebrew on Apple Silicon installs into /opt/hombrew
|
150
|
+
# https://docs.brew.sh/Installation
|
151
|
+
# On Intel Macs, it is /usr/local, so no changes necessary to DIRS
|
152
|
+
DIRS.unshift("/opt/homebrew")
|
153
|
+
end
|
154
|
+
end
|
279
155
|
|
280
|
-
|
281
|
-
|
156
|
+
if ENV["RI_DEVKIT"] && ENV["MINGW_PREFIX"] # RubyInstaller Support
|
157
|
+
DIRS.unshift(File.join(ENV["RI_DEVKIT"], ENV["MINGW_PREFIX"]))
|
158
|
+
end
|
282
159
|
|
283
|
-
#
|
284
|
-
|
285
|
-
if enable_config("lookup", true)
|
286
|
-
dir_config('freetds', FREETDS_HEADER_DIRS, FREETDS_LIB_DIRS)
|
287
|
-
else
|
288
|
-
dir_config('freetds')
|
160
|
+
# Add the ports directory if it exists for local developer builds
|
161
|
+
DIRS.unshift(freetds_ports_dir) if File.directory?(freetds_ports_dir)
|
289
162
|
|
290
|
-
#
|
291
|
-
|
292
|
-
|
163
|
+
# Grab freetds environment variable for use by people on services like
|
164
|
+
# Heroku who they can't easily use bundler config to set directories
|
165
|
+
DIRS.unshift(ENV["FREETDS_DIR"]) if ENV.has_key?("FREETDS_DIR")
|
293
166
|
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
abort(msg)
|
300
|
-
end
|
167
|
+
# Add the search paths for freetds configured above
|
168
|
+
ldirs = DIRS.flat_map do |path|
|
169
|
+
ldir = "#{path}/lib"
|
170
|
+
[ldir, "#{ldir}/freetds"]
|
171
|
+
end
|
301
172
|
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
end
|
173
|
+
idirs = DIRS.flat_map do |path|
|
174
|
+
idir = "#{path}/include"
|
175
|
+
[idir, "#{idir}/freetds"]
|
176
|
+
end
|
307
177
|
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
# We expect to have iconv and OpenSSL available on non-Windows systems
|
312
|
-
host = RbConfig::CONFIG["host"]
|
313
|
-
system_iconv = enable_config('system-iconv', host =~ /mingw|mswin/ ? false : true)
|
314
|
-
system_openssl = enable_config('system-openssl', host =~ /mingw|mswin/ ? false : true )
|
315
|
-
enable_gnutls = enable_config('gnutls', false )
|
316
|
-
enable_openssl = enable_config('openssl', !enable_gnutls )
|
317
|
-
|
318
|
-
unless system_freetds
|
319
|
-
libssl = define_libssl_recipe(host).cook_and_activate unless system_openssl
|
320
|
-
libiconv = define_libiconv_recipe(host).cook_and_activate unless system_iconv
|
321
|
-
freetds = define_freetds_recipe(host, libiconv, libssl || enable_openssl, enable_gnutls).cook_and_activate
|
322
|
-
dir_config('freetds', freetds.path + "/include", freetds.path + "/lib")
|
178
|
+
puts "looking for freetds headers in the following directories:\n#{idirs.map { |a| " - #{a}\n" }.join}"
|
179
|
+
puts "looking for freetds library in the following directories:\n#{ldirs.map { |a| " - #{a}\n" }.join}"
|
180
|
+
dir_config("freetds", idirs, ldirs)
|
323
181
|
end
|
324
182
|
|
325
|
-
|
183
|
+
find_header("sybfront.h") or abort "Can't find the 'sybfront.h' header"
|
184
|
+
find_header("sybdb.h") or abort "Can't find the 'sybdb.h' header"
|
326
185
|
|
327
|
-
|
186
|
+
unless have_library("sybdb", "dbanydatecrack")
|
187
|
+
abort "Failed! Do you have FreeTDS 1.0.0 or higher installed?"
|
188
|
+
end
|
328
189
|
|
329
|
-
|
190
|
+
create_makefile("tiny_tds/tiny_tds")
|
data/ext/tiny_tds/extconsts.rb
CHANGED
@@ -1,15 +1,8 @@
|
|
1
|
-
|
2
|
-
ICONV_VERSION = ENV['TINYTDS_ICONV_VERSION'] || "1.14"
|
1
|
+
ICONV_VERSION = ENV["TINYTDS_ICONV_VERSION"] || "1.18"
|
3
2
|
ICONV_SOURCE_URI = "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-#{ICONV_VERSION}.tar.gz"
|
4
3
|
|
5
|
-
OPENSSL_VERSION = ENV[
|
4
|
+
OPENSSL_VERSION = ENV["TINYTDS_OPENSSL_VERSION"] || "3.4.0"
|
6
5
|
OPENSSL_SOURCE_URI = "https://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz"
|
7
6
|
|
8
|
-
FREETDS_VERSION = ENV[
|
9
|
-
|
10
|
-
h[k] = {files: "ftp://ftp.freetds.org/pub/freetds/stable/freetds-#{k}.tar.bz2"}
|
11
|
-
}
|
12
|
-
FREETDS_VERSION_INFO['1.00'] = {files: 'ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.00.tar.bz2'}
|
13
|
-
FREETDS_VERSION_INFO['0.99'] = {files: 'ftp://ftp.freetds.org/pub/freetds/current/freetds-dev.0.99.678.tar.gz'}
|
14
|
-
FREETDS_VERSION_INFO['0.95'] = {files: 'ftp://ftp.freetds.org/pub/freetds/stable/freetds-0.95.92.tar.gz'}
|
15
|
-
FREETDS_SOURCE_URI = FREETDS_VERSION_INFO[FREETDS_VERSION][:files]
|
7
|
+
FREETDS_VERSION = ENV["TINYTDS_FREETDS_VERSION"] || "1.4.26"
|
8
|
+
FREETDS_SOURCE_URI = "http://www.freetds.org/files/stable/freetds-#{FREETDS_VERSION}.tar.bz2"
|