Skip to content

Commit ed691ff

Browse files
authored
Upgrade openssl and freetds (#322)
- Fix openssl being out of date. (Bumped to 1.0.2j) - Fix freetds being out of date. (Bumped to 1.00.21) - Fix the invalid w32 application error which occurs on x64 platforms occasionally due to problems with DLLs generated via dllwrap after being relocated. Relates to: #290 and #310
1 parent 86c5a0e commit ed691ff

File tree

5 files changed

+22
-12
lines changed

5 files changed

+22
-12
lines changed

Rakefile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,15 @@ Rake::ExtensionTask.new('tiny_tds', gemspec) do |ext|
6868
gemplat = spec.platform.to_s
6969
host = platform_host_map[gemplat]
7070
dlls = [
71-
"libeay32-1.0.2g-#{host}.dll",
72-
"ssleay32-1.0.2g-#{host}.dll",
71+
"libeay32-#{OPENSSL_VERSION}-#{host}.dll",
72+
"ssleay32-#{OPENSSL_VERSION}-#{host}.dll",
7373
'libiconv-2.dll',
7474
'libsybdb-5.dll'
7575
]
7676
# We don't need the sources in a fat binary gem
7777
spec.files = spec.files.reject { |f| f =~ %r{^ports\/archives/} }
7878
spec.files += dlls.map { |dll| "ports/#{host}/bin/#{File.basename(dll)}" }
7979
spec.files += Dir.glob('exe/*')
80-
dlls.each do |dll|
81-
file "ports/#{host}/bin/#{dll}" do |t|
82-
sh 'x86_64-w64-mingw32-strip', t.name
83-
end
84-
end
8580
end
8681
end
8782

appveyor.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,8 @@ environment:
3939
secure: fYKSKV4v+36OFQp2nZdX4DfUpgmy5cm0wuR73cgdmEk=
4040
matrix:
4141
- ruby_version: "23-x64"
42+
- ruby_version: "23"
43+
- ruby_version: "22-x64"
44+
- ruby_version: "22"
4245
on_failure:
4346
- find -name compile.log | xargs cat

ext/tiny_tds/extconf.rb

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,19 @@ def configure
166166
execute "configure", "sh -c \"#{args.join(" ")}\""
167167
end
168168

169+
def dllwrap(dllname, outputlib, deffile, linkto)
170+
gcc = consolidated_host(RbConfig::CONFIG["CC"])
171+
172+
#RbConfig does not provide dlltool, but it should exist where dllwrap lives
173+
dlltool = consolidated_host(RbConfig::CONFIG["DLLWRAP"]).sub('dllwrap','dlltool')
174+
175+
execute "gcc-#{dllname}-compile", "#{gcc} -Wl,--base-file,#{dllname}.base -mdll -o #{dllname}.dll --leading-underscore #{linkto}"
176+
execute "dlltool-#{dllname}-exp", "#{dlltool} --base-file #{dllname}.base --output-exp #{dllname}.exp --dllname #{dllname}.dll --def #{deffile}"
177+
execute "gcc-#{dllname}-dll", "#{gcc} -Wl,--base-file,#{dllname}.base #{dllname}.exp -mdll -o #{dllname}.dll --leading-underscore #{linkto}"
178+
execute "dlltool-#{dllname}-outputlib", "#{dlltool} --base-file #{dllname}.base --output-exp #{dllname}.exp --dllname #{dllname}.dll --def #{deffile} --output-lib #{outputlib}"
179+
execute "gcc-#{dllname}-link", "#{gcc} #{dllname}.exp -mdll -o #{dllname}.dll --leading-underscore #{linkto}"
180+
end
181+
169182
def compile
170183
super
171184
# OpenSSL DLLs are called "libeay32.dll" and "ssleay32.dll" per default,
@@ -174,9 +187,8 @@ def compile
174187
# with our own naming scheme.
175188
execute "mkdef-libeay32", "(perl util/mkdef.pl 32 libeay >libeay32.def)"
176189
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"
190+
dllwrap("libeay32-#{version}-#{host}", "libcrypto.dll.a", "libeay32.def", "libcrypto.a -lws2_32 -lgdi32 -lcrypt32")
191+
dllwrap("ssleay32-#{version}-#{host}", "libssl.dll.a", "ssleay32.def", "libssl.a libcrypto.dll.a")
180192
end
181193

182194
def install

ext/tiny_tds/extconsts.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
ICONV_VERSION = ENV['TINYTDS_ICONV_VERSION'] || "1.14"
33
ICONV_SOURCE_URI = "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-#{ICONV_VERSION}.tar.gz"
44

5-
OPENSSL_VERSION = ENV['TINYTDS_OPENSSL_VERSION'] || '1.0.2g'
5+
OPENSSL_VERSION = ENV['TINYTDS_OPENSSL_VERSION'] || '1.0.2j'
66
OPENSSL_SOURCE_URI = "https://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz"
77

8-
FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "1.00.15"
8+
FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "1.00.21"
99
FREETDS_VERSION_INFO = Hash.new { |h,k|
1010
h[k] = {files: "ftp://ftp.freetds.org/pub/freetds/stable/freetds-#{k}.tar.bz2"}
1111
}

0 commit comments

Comments
 (0)