From 5da8f7655a561f9896395f24ab9acf03d5879685 Mon Sep 17 00:00:00 2001 From: aharpervc Date: Fri, 31 Jan 2020 13:30:37 -0500 Subject: [PATCH 1/9] Remove old Ruby versions from CI config & cross compile rake task --- .travis.yml | 1 - tasks/native_gem.rake | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6d0fd2fc..4407031f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,6 @@ env: - TESTOPTS="-v" - TINYTDS_UNIT_HOST=localhost rvm: - - 2.3.8 - 2.4.5 - 2.5.3 - 2.6.1 diff --git a/tasks/native_gem.rake b/tasks/native_gem.rake index 3af6f53e..192ee772 100644 --- a/tasks/native_gem.rake +++ b/tasks/native_gem.rake @@ -8,7 +8,7 @@ task 'gem:windows' => ['ports:cross'] do build = ['bundle'] # and finally build the native gem - build << 'rake cross native gem RUBY_CC_VERSION=2.5.0:2.4.0:2.3.0:2.2.2:2.1.6:2.0.0 CFLAGS="-Wall" MAKE="make -j`nproc`"' + build << 'rake cross native gem RUBY_CC_VERSION=2.5.0:2.4.0 CFLAGS="-Wall" MAKE="make -j`nproc`"' RakeCompilerDock.sh build.join(' && ') end From 33d2189bd9fd10993d9d22232782dd3f59e4f07a Mon Sep 17 00:00:00 2001 From: aharpervc Date: Fri, 7 Feb 2020 10:10:41 -0500 Subject: [PATCH 2/9] Add Ruby 2.6 to the cross compile list --- tasks/native_gem.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/native_gem.rake b/tasks/native_gem.rake index 192ee772..a9044819 100644 --- a/tasks/native_gem.rake +++ b/tasks/native_gem.rake @@ -8,7 +8,7 @@ task 'gem:windows' => ['ports:cross'] do build = ['bundle'] # and finally build the native gem - build << 'rake cross native gem RUBY_CC_VERSION=2.5.0:2.4.0 CFLAGS="-Wall" MAKE="make -j`nproc`"' + build << 'rake cross native gem RUBY_CC_VERSION=2.6.0:2.5.0:2.4.0 CFLAGS="-Wall" MAKE="make -j`nproc`"' RakeCompilerDock.sh build.join(' && ') end From e75a3797f435c988907844ce933db25f71799889 Mon Sep 17 00:00:00 2001 From: aharpervc Date: Tue, 4 Feb 2020 16:31:18 -0500 Subject: [PATCH 3/9] Update readme --- CHANGELOG.md | 6 ++++++ README.md | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc7bf28e..2592b4c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## (unreleased) + +* Removed old/unused appveyor config +* Remove old Rubies from CI & cross compile list +* Add Ruby 2.6 to the cross compile list + ## 2.1.2 * Use Kernel.BigDecimal vs BigDecimal.new. Fixes #409. diff --git a/README.md b/README.md index 947f51c3..9deffa8f 100644 --- a/README.md +++ b/README.md @@ -401,7 +401,7 @@ The default is true and since FreeTDS v1.0 would do this as well. ## Compiling Gems for Windows -For the convenience of Windows users, TinyTDS ships pre-compiled gems for Ruby 2.0, 2.1, 2.2, and 2.3 on Windows. In order to generate these gems, [rake-compiler-dock](https://github.com/rake-compiler/rake-compiler-dock) is used. This project provides a [Docker image](https://registry.hub.docker.com/u/larskanis/rake-compiler-dock/) with rvm, cross-compilers and a number of different target versions of Ruby. +For the convenience of Windows users, TinyTDS ships pre-compiled gems for supported versions of Ruby on Windows. In order to generate these gems, [rake-compiler-dock](https://github.com/rake-compiler/rake-compiler-dock) is used. This project provides a [Docker image](https://registry.hub.docker.com/u/larskanis/rake-compiler-dock/) with rvm, cross-compilers and a number of different target versions of Ruby. Run the following rake task to compile the gems for Windows. This will check the availability of [Docker](https://www.docker.com/) (and boot2docker on Windows or OS-X) and will give some advice for download and installation. When docker is running, it will download the docker image (once-only) and start the build: From ab258339b7abb75ed3d75d6fca5d0f4cc49a8d9e Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Sun, 9 Feb 2020 17:12:18 +0100 Subject: [PATCH 4/9] Add ruby-2.7 to cross build and tests, Update freetds and OpenSSL --- .travis.yml | 1 + CHANGELOG.md | 2 +- README.md | 8 ++++---- ext/tiny_tds/extconsts.rb | 4 ++-- tasks/native_gem.rake | 2 +- tasks/ports.rake | 2 -- tasks/ports/openssl.rb | 20 ++------------------ tiny_tds.gemspec | 2 +- 8 files changed, 12 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4407031f..dd9430b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ rvm: - 2.4.5 - 2.5.3 - 2.6.1 + - 2.7.0 before_install: - docker info - sudo ./test/bin/install-openssl.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 2592b4c9..3347f7d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ * Removed old/unused appveyor config * Remove old Rubies from CI & cross compile list -* Add Ruby 2.6 to the cross compile list +* Add Ruby 2.6 and 2.7 to the cross compile list ## 2.1.2 diff --git a/README.md b/README.md index 9deffa8f..c5ead9e4 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,9 @@ $ apt-get install wget $ apt-get install build-essential $ apt-get install libc6-dev -$ wget http://www.freetds.org/files/stable/freetds-1.1.6.tar.gz -$ tar -xzf freetds-1.1.6.tar.gz -$ cd freetds-1.1.6 +$ wget http://www.freetds.org/files/stable/freetds-1.1.24.tar.gz +$ tar -xzf freetds-1.1.24.tar.gz +$ cd freetds-1.1.24 $ ./configure --prefix=/usr/local --with-tdsver=7.3 $ make $ make install @@ -401,7 +401,7 @@ The default is true and since FreeTDS v1.0 would do this as well. ## Compiling Gems for Windows -For the convenience of Windows users, TinyTDS ships pre-compiled gems for supported versions of Ruby on Windows. In order to generate these gems, [rake-compiler-dock](https://github.com/rake-compiler/rake-compiler-dock) is used. This project provides a [Docker image](https://registry.hub.docker.com/u/larskanis/rake-compiler-dock/) with rvm, cross-compilers and a number of different target versions of Ruby. +For the convenience of Windows users, TinyTDS ships pre-compiled gems for supported versions of Ruby on Windows. In order to generate these gems, [rake-compiler-dock](https://github.com/rake-compiler/rake-compiler-dock) is used. This project provides several [Docker images](https://registry.hub.docker.com/u/larskanis/) with rvm, cross-compilers and a number of different target versions of Ruby. Run the following rake task to compile the gems for Windows. This will check the availability of [Docker](https://www.docker.com/) (and boot2docker on Windows or OS-X) and will give some advice for download and installation. When docker is running, it will download the docker image (once-only) and start the build: diff --git a/ext/tiny_tds/extconsts.rb b/ext/tiny_tds/extconsts.rb index 65d37732..1e1c1bf2 100644 --- a/ext/tiny_tds/extconsts.rb +++ b/ext/tiny_tds/extconsts.rb @@ -2,10 +2,10 @@ ICONV_VERSION = ENV['TINYTDS_ICONV_VERSION'] || "1.15" ICONV_SOURCE_URI = "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-#{ICONV_VERSION}.tar.gz" -OPENSSL_VERSION = ENV['TINYTDS_OPENSSL_VERSION'] || '1.1.0j' +OPENSSL_VERSION = ENV['TINYTDS_OPENSSL_VERSION'] || '1.1.1d' OPENSSL_SOURCE_URI = "https://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz" -FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "1.00.27" +FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "1.1.24" FREETDS_VERSION_INFO = Hash.new { |h,k| h[k] = {files: "http://www.freetds.org/files/stable/freetds-#{k}.tar.bz2"} } diff --git a/tasks/native_gem.rake b/tasks/native_gem.rake index a9044819..d19cdb85 100644 --- a/tasks/native_gem.rake +++ b/tasks/native_gem.rake @@ -8,7 +8,7 @@ task 'gem:windows' => ['ports:cross'] do build = ['bundle'] # and finally build the native gem - build << 'rake cross native gem RUBY_CC_VERSION=2.6.0:2.5.0:2.4.0 CFLAGS="-Wall" MAKE="make -j`nproc`"' + build << 'rake cross native gem RUBY_CC_VERSION=2.7.0:2.6.0:2.5.0:2.4.0 CFLAGS="-Wall" MAKE="make -j`nproc`"' RakeCompilerDock.sh build.join(' && ') end diff --git a/tasks/ports.rake b/tasks/ports.rake index 009f5207..0f22e7fe6 100644 --- a/tasks/ports.rake +++ b/tasks/ports.rake @@ -6,8 +6,6 @@ require_relative 'ports/openssl' require_relative 'ports/freetds' require_relative '../ext/tiny_tds/extconsts' -OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE if defined? OpenSSL - namespace :ports do openssl = Ports::Openssl.new(OPENSSL_VERSION) libiconv = Ports::Libiconv.new(ICONV_VERSION) diff --git a/tasks/ports/openssl.rb b/tasks/ports/openssl.rb index 46fd8c20..17da4e0a 100644 --- a/tasks/ports/openssl.rb +++ b/tasks/ports/openssl.rb @@ -27,27 +27,11 @@ def install private - def execute(action, command, options={}) - # OpenSSL Requires Perl >= 5.10, while the Ruby devkit uses MSYS1 with Perl 5.8.8. - # To overcome this, prepend Git's usr/bin to the PATH. - # It has MSYS2 with a recent version of perl. - prev_path = ENV['PATH'] - if host =~ /mingw/ && IO.popen(["perl", "-e", "print($])"], &:read).to_f < 5.010 - git_perl = 'C:/Program Files/Git/usr/bin' - if File.directory?(git_perl) - ENV['PATH'] = "#{git_perl}#{File::PATH_SEPARATOR}#{ENV['PATH']}" - ENV['PERL'] = 'perl' - end - end - - super - ENV['PATH'] = prev_path - end - def configure_defaults opts = [ 'shared', - target_arch + target_arch, + "--openssldir=#{path}", ] if cross_build? diff --git a/tiny_tds.gemspec b/tiny_tds.gemspec index 593f207d..b9ba6a14 100644 --- a/tiny_tds.gemspec +++ b/tiny_tds.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'mini_portile2', '~> 2.0' s.add_development_dependency 'rake', '~> 10.4' s.add_development_dependency 'rake-compiler', '~> 1.0' - s.add_development_dependency 'rake-compiler-dock', '~> 0.6.3' + s.add_development_dependency 'rake-compiler-dock', '~> 1.0' s.add_development_dependency 'minitest', '~> 5.6' s.add_development_dependency 'connection_pool', '~> 2.2' end From dcc8731a34fabf45846c9496556d775dd9f9d8b9 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Sun, 9 Feb 2020 17:19:02 +0100 Subject: [PATCH 5/9] Update Appveyor-CI - Add Ruby-head version - Remove outdated ruby versions - Decrease number of ruby versions, so that tests run faster - Run all tests, even when a test fails --- appveyor.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ac4d1ab1..76197d7f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,5 @@ init: - SET PATH=C:\Ruby%ruby_version%\bin;%PATH% - - SET PATH=C:\MinGW\msys\1.0\bin;%PATH% - SET RAKEOPT=-rdevkit - SET TESTOPTS='-v' - SET MAKE=make V=1 @@ -8,10 +7,15 @@ clone_depth: 5 skip_tags: true skip_branch_with_pr: true matrix: - fast_finish: true + fast_finish: false install: # Output debugging info - ps: Update-AppveyorBuild -Version "$(Get-Content $env:appveyor_build_folder\VERSION).$env:appveyor_build_number" + - ps: | + if ($env:ruby_version -like "*head*") { + $(new-object net.webclient).DownloadFile("https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-$env:ruby_version.exe", "$pwd/ruby-setup.exe") + cmd /c ruby-setup.exe /verysilent /dir=C:/Ruby$env:ruby_version + } - perl --version - ruby --version - gem --version @@ -43,13 +47,9 @@ environment: TINYTDS_UNIT_AZURE_PASS: secure: fYKSKV4v+36OFQp2nZdX4DfUpgmy5cm0wuR73cgdmEk= matrix: - - ruby_version: "23-x64" - - ruby_version: "23" - - ruby_version: "24-x64" - ruby_version: "24" - ruby_version: "25-x64" - - ruby_version: "25" - - ruby_version: "26-x64" - ruby_version: "26" + - ruby_version: "head-x64" on_failure: - find -name compile.log | xargs cat From 6299be6a755e6565a8baa0c89a83ccff239c8ee5 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Sun, 9 Feb 2020 17:19:02 +0100 Subject: [PATCH 6/9] Update Appveyor-CI - Add Ruby-head version - Remove outdated ruby versions - Decrease number of ruby versions, so that tests run faster - Run all tests, even when a test fails - Make use of Appveyors dual core CPUs --- appveyor.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ac4d1ab1..47580197 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,17 +1,21 @@ init: - SET PATH=C:\Ruby%ruby_version%\bin;%PATH% - - SET PATH=C:\MinGW\msys\1.0\bin;%PATH% - SET RAKEOPT=-rdevkit - SET TESTOPTS='-v' - - SET MAKE=make V=1 + - SET MAKE=make V=1 -j2 clone_depth: 5 skip_tags: true skip_branch_with_pr: true matrix: - fast_finish: true + fast_finish: false install: # Output debugging info - ps: Update-AppveyorBuild -Version "$(Get-Content $env:appveyor_build_folder\VERSION).$env:appveyor_build_number" + - ps: | + if ($env:ruby_version -like "*head*") { + $(new-object net.webclient).DownloadFile("https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-$env:ruby_version.exe", "$pwd/ruby-setup.exe") + cmd /c ruby-setup.exe /verysilent /dir=C:/Ruby$env:ruby_version + } - perl --version - ruby --version - gem --version @@ -43,13 +47,9 @@ environment: TINYTDS_UNIT_AZURE_PASS: secure: fYKSKV4v+36OFQp2nZdX4DfUpgmy5cm0wuR73cgdmEk= matrix: - - ruby_version: "23-x64" - - ruby_version: "23" - - ruby_version: "24-x64" - ruby_version: "24" - ruby_version: "25-x64" - - ruby_version: "25" - - ruby_version: "26-x64" - ruby_version: "26" + - ruby_version: "head-x64" on_failure: - find -name compile.log | xargs cat From a18a275558625e6c29dcb8dae670e0c71e3cb676 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Sun, 9 Feb 2020 18:11:24 +0100 Subject: [PATCH 7/9] Update rake to fix compat with ruby-head --- tiny_tds.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tiny_tds.gemspec b/tiny_tds.gemspec index b9ba6a14..e67513be 100644 --- a/tiny_tds.gemspec +++ b/tiny_tds.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 2.0.0' s.metadata['msys2_mingw_dependencies'] = 'freetds' s.add_development_dependency 'mini_portile2', '~> 2.0' - s.add_development_dependency 'rake', '~> 10.4' + s.add_development_dependency 'rake', '~> 13.0' s.add_development_dependency 'rake-compiler', '~> 1.0' s.add_development_dependency 'rake-compiler-dock', '~> 1.0' s.add_development_dependency 'minitest', '~> 5.6' From 42f90a701e0d37cedd2a84ecdc604f07b66eb1a4 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Sun, 9 Feb 2020 18:11:45 +0100 Subject: [PATCH 8/9] Fix cross build for binary Windows gems --- ext/tiny_tds/extconf.rb | 30 +++++++++++++++++------------- tasks/ports.rake | 10 +++++----- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/ext/tiny_tds/extconf.rb b/ext/tiny_tds/extconf.rb index 84040c2d..b05d4040 100644 --- a/ext/tiny_tds/extconf.rb +++ b/ext/tiny_tds/extconf.rb @@ -22,35 +22,39 @@ def do_help # Make sure to check the ports path for the configured host host = RbConfig::CONFIG['host'] -project_dir = File.join(['..']*4) +project_dir = File.expand_path("../../..", __FILE__) freetds_ports_dir = File.join(project_dir, 'ports', host, 'freetds', FREETDS_VERSION) freetds_ports_dir = File.expand_path(freetds_ports_dir) # Add all the special path searching from the original tiny_tds build -# order is important here! First in, last searched. +# order is important here! First in, first searched. DIRS = %w( - /usr/local /opt/local + /usr/local ) +# Add the ports directory if it exists for local developer builds +DIRS.unshift(freetds_ports_dir) if File.directory?(freetds_ports_dir) + # Grab freetds environment variable for use by people on services like # Heroku who they can't easily use bundler config to set directories -DIRS.push(ENV['FREETDS_DIR']) if ENV.has_key?('FREETDS_DIR') - -# Add the ports directory if it exists for local developer builds -DIRS.push(freetds_ports_dir) if File.directory?(freetds_ports_dir) +DIRS.unshift(ENV['FREETDS_DIR']) if ENV.has_key?('FREETDS_DIR') # Add the search paths for freetds configured above -DIRS.each do |path| - idir = "#{path}/include" +ldirs = DIRS.flat_map do |path| ldir = "#{path}/lib" + [ldir, "#{ldir}/freetds"] +end - dir_config('freetds', - [idir, "#{idir}/freetds"], - [ldir, "#{ldir}/freetds"] - ) +idirs = DIRS.flat_map do |path| + idir = "#{path}/include" + [idir, "#{idir}/freetds"] end +puts "looking for freetds headers in the following directories:\n#{idirs.map{|a| " - #{a}\n"}.join}" +puts "looking for freetds library in the following directories:\n#{ldirs.map{|a| " - #{a}\n"}.join}" +dir_config('freetds', idirs, ldirs) + have_dependencies = [ find_header('sybfront.h'), find_header('sybdb.h'), diff --git a/tasks/ports.rake b/tasks/ports.rake index 0f22e7fe6..86ee1e91 100644 --- a/tasks/ports.rake +++ b/tasks/ports.rake @@ -12,6 +12,8 @@ namespace :ports do freetds = Ports::Freetds.new(FREETDS_VERSION) directory "ports" + CLEAN.include "ports/*mingw32*" + CLEAN.include "ports/*.installed" task :openssl, [:host] do |task, args| args.with_defaults(host: RbConfig::CONFIG['host']) @@ -69,15 +71,13 @@ namespace :ports do task 'cross' do require 'rake_compiler_dock' - # make sure to install our bundle - build = ['bundle'] - # build the ports for all our cross compile hosts GEM_PLATFORM_HOSTS.each do |gem_platform, host| + # make sure to install our bundle + build = ['bundle'] build << "rake ports:compile[#{host}] MAKE='make -j`nproc`'" + RakeCompilerDock.sh build.join(' && '), platform: gem_platform end - - RakeCompilerDock.sh build.join(' && ') end end From a35ac895c1c4d390884b5bfb2df36857519b5753 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Sun, 9 Feb 2020 20:06:06 +0100 Subject: [PATCH 9/9] Prevent freetds to link to wrong ws2_32 lib on i686-w64-mingw32 This fixes broken 32 bit build on Appveyor-CI. Also print config.log to ease debugging. --- appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 47580197..2411758b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,6 +20,8 @@ install: - ruby --version - gem --version + # prevent freetds to link to wrong ws2_32 lib on i686-w64-mingw32 + - c:/msys64/usr/bin/rm /usr/lib/w32api/libws2_32.a # Set up project prerequisits - bundle install - bundle exec rake ports @@ -52,4 +54,5 @@ environment: - ruby_version: "26" - ruby_version: "head-x64" on_failure: + - find -name config.log | xargs cat - find -name compile.log | xargs cat