diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..1b161808 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.diff eol=lf diff --git a/Rakefile b/Rakefile index 880502e5..9804aad4 100644 --- a/Rakefile +++ b/Rakefile @@ -68,8 +68,8 @@ Rake::ExtensionTask.new('tiny_tds', gemspec) do |ext| gemplat = spec.platform.to_s host = platform_host_map[gemplat] dlls = [ - "libeay32-#{OPENSSL_VERSION}-#{host}.dll", - "ssleay32-#{OPENSSL_VERSION}-#{host}.dll", + "libcrypto32-#{OPENSSL_VERSION}-#{host}.dll", + "libssl32-#{OPENSSL_VERSION}-#{host}.dll", 'libiconv-2.dll', 'libsybdb-5.dll' ] diff --git a/ext/tiny_tds/extconf.rb b/ext/tiny_tds/extconf.rb index 40282c61..b64fb97d 100644 --- a/ext/tiny_tds/extconf.rb +++ b/ext/tiny_tds/extconf.rb @@ -151,6 +151,19 @@ def extract_file(file, target) end end + def execute(action, command, options={}) + prev_path = ENV['PATH'] + if host=~/mingw/ + git_perl = 'C:/Program Files/Git/usr/bin' + if File.directory?(git_perl) + ENV['PATH'] = git_perl + ';' + ENV['PATH'] + ENV['PERL'] = 'perl' + end + end + super + ENV['PATH'] = prev_path + end + def configure config = if host=~/mingw/ host=~/x86_64/ ? 'mingw64' : 'mingw' @@ -181,20 +194,20 @@ def dllwrap(dllname, outputlib, deffile, linkto) def compile super - # OpenSSL DLLs are called "libeay32.dll" and "ssleay32.dll" per default, + # OpenSSL DLLs are called "libcrypto32.dll" and "libssl32.dll" per default, # regardless to the version. This is best suited to meet the Windows DLL hell. # To avoid any conflicts we do a static build and build DLLs afterwards, # with our own naming scheme. - execute "mkdef-libeay32", "(perl util/mkdef.pl 32 libeay >libeay32.def)" - execute "mkdef-ssleay32", "(perl util/mkdef.pl 32 ssleay >ssleay32.def)" - dllwrap("libeay32-#{version}-#{host}", "libcrypto.dll.a", "libeay32.def", "libcrypto.a -lws2_32 -lgdi32 -lcrypt32") - dllwrap("ssleay32-#{version}-#{host}", "libssl.dll.a", "ssleay32.def", "libssl.a libcrypto.dll.a") + execute "mkdef-crypto32", "(perl util/mkdef.pl crypto 32 >libcrypto32.def)" + execute "mkdef-ssl32", "(perl util/mkdef.pl ssl 32 >libssl32.def)" + dllwrap("libcrypto32-#{version}-#{host}", "libcrypto.dll.a", "libcrypto32.def", "libcrypto.a -lws2_32 -lgdi32 -lcrypt32") + dllwrap("libssl32-#{version}-#{host}", "libssl.dll.a", "libssl32.def", "libssl.a libcrypto.dll.a") end def install super - FileUtils.cp "#{work_path}/libeay32-#{version}-#{host}.dll", "#{path}/bin/" - FileUtils.cp "#{work_path}/ssleay32-#{version}-#{host}.dll", "#{path}/bin/" + FileUtils.cp "#{work_path}/libcrypto32-#{version}-#{host}.dll", "#{path}/bin/" + FileUtils.cp "#{work_path}/libssl32-#{version}-#{host}.dll", "#{path}/bin/" FileUtils.cp "#{work_path}/libcrypto.dll.a", "#{path}/lib/" FileUtils.cp "#{work_path}/libssl.dll.a", "#{path}/lib/" end diff --git a/ext/tiny_tds/extconsts.rb b/ext/tiny_tds/extconsts.rb index cc2f02a0..2b216cfd 100644 --- a/ext/tiny_tds/extconsts.rb +++ b/ext/tiny_tds/extconsts.rb @@ -2,10 +2,10 @@ ICONV_VERSION = ENV['TINYTDS_ICONV_VERSION'] || "1.14" ICONV_SOURCE_URI = "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-#{ICONV_VERSION}.tar.gz" -OPENSSL_VERSION = ENV['TINYTDS_OPENSSL_VERSION'] || '1.0.2j' +OPENSSL_VERSION = ENV['TINYTDS_OPENSSL_VERSION'] || '1.1.0e' OPENSSL_SOURCE_URI = "https://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz" -FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "1.00.21" +FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "1.00.27" FREETDS_VERSION_INFO = Hash.new { |h,k| h[k] = {files: "ftp://ftp.freetds.org/pub/freetds/stable/freetds-#{k}.tar.bz2"} } diff --git a/ports/patches/freetds/1.00.21/0001-mingw_missing_inet_pton.diff b/ports/patches/freetds/1.00.27/0001-mingw_missing_inet_pton.diff similarity index 85% rename from ports/patches/freetds/1.00.21/0001-mingw_missing_inet_pton.diff rename to ports/patches/freetds/1.00.27/0001-mingw_missing_inet_pton.diff index 6cc4c0cb..ffefc8df 100644 --- a/ports/patches/freetds/1.00.21/0001-mingw_missing_inet_pton.diff +++ b/ports/patches/freetds/1.00.27/0001-mingw_missing_inet_pton.diff @@ -1,16 +1,16 @@ diff --git a/src/tds/tls.c b/src/tds/tls.c -index 0d11a33..b8ab2ba 100644 +index 09e7fa0..1da18f6 100644 --- a/src/tds/tls.c +++ b/src/tds/tls.c -@@ -72,6 +72,29 @@ - #define SSL_PTR bio->ptr +@@ -101,6 +101,29 @@ + #define SSL_PTR BIO_get_data(bio) #endif +/* + * Add a workaround for older Mingw versions without inet_pton(). + * This means RubyInstallers DevKit-4.7.2 in particular. + */ -+#if defined(__MINGW64_VERSION_MAJOR) && !defined(InetPtonA) ++#if defined(__MINGW32__) && !defined(InetPtonA) + #include + + static HMODULE ws2_32 = NULL; diff --git a/test/bin/install-openssl.sh b/test/bin/install-openssl.sh index 8fd11282..2745f1be 100755 --- a/test/bin/install-openssl.sh +++ b/test/bin/install-openssl.sh @@ -10,7 +10,7 @@ fi wget https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz tar -xzf openssl-$OPENSSL_VERSION.tar.gz cd openssl-$OPENSSL_VERSION -./config --prefix=/opt/local +./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl make make install cd ..