Skip to content

Commit 7fb8580

Browse files
authored
Merge pull request #456 from larskanis/sync-cross-compile-and-ci-config
Update cross build, Travis and Appveyor-CI
2 parents f2fceb2 + a35ac89 commit 7fb8580

File tree

10 files changed

+51
-56
lines changed

10 files changed

+51
-56
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ env:
88
- TESTOPTS="-v"
99
- TINYTDS_UNIT_HOST=localhost
1010
rvm:
11-
- 2.3.8
1211
- 2.4.5
1312
- 2.5.3
1413
- 2.6.1
14+
- 2.7.0
1515
before_install:
1616
- docker info
1717
- sudo ./test/bin/install-openssl.sh

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## (unreleased)
2+
3+
* Removed old/unused appveyor config
4+
* Remove old Rubies from CI & cross compile list
5+
* Add Ruby 2.6 and 2.7 to the cross compile list
6+
17
## 2.1.2
28

39
* Use Kernel.BigDecimal vs BigDecimal.new. Fixes #409.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ $ apt-get install wget
3838
$ apt-get install build-essential
3939
$ apt-get install libc6-dev
4040

41-
$ wget http://www.freetds.org/files/stable/freetds-1.1.6.tar.gz
42-
$ tar -xzf freetds-1.1.6.tar.gz
43-
$ cd freetds-1.1.6
41+
$ wget http://www.freetds.org/files/stable/freetds-1.1.24.tar.gz
42+
$ tar -xzf freetds-1.1.24.tar.gz
43+
$ cd freetds-1.1.24
4444
$ ./configure --prefix=/usr/local --with-tdsver=7.3
4545
$ make
4646
$ make install
@@ -401,7 +401,7 @@ The default is true and since FreeTDS v1.0 would do this as well.
401401

402402
## Compiling Gems for Windows
403403

404-
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.
404+
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.
405405

406406
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:
407407

appveyor.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
init:
22
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
3-
- SET PATH=C:\MinGW\msys\1.0\bin;%PATH%
43
- SET RAKEOPT=-rdevkit
54
- SET TESTOPTS='-v'
6-
- SET MAKE=make V=1
5+
- SET MAKE=make V=1 -j2
76
clone_depth: 5
87
skip_tags: true
98
skip_branch_with_pr: true
109
matrix:
11-
fast_finish: true
10+
fast_finish: false
1211
install:
1312
# Output debugging info
1413
- ps: Update-AppveyorBuild -Version "$(Get-Content $env:appveyor_build_folder\VERSION).$env:appveyor_build_number"
14+
- ps: |
15+
if ($env:ruby_version -like "*head*") {
16+
$(new-object net.webclient).DownloadFile("https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-$env:ruby_version.exe", "$pwd/ruby-setup.exe")
17+
cmd /c ruby-setup.exe /verysilent /dir=C:/Ruby$env:ruby_version
18+
}
1519
- perl --version
1620
- ruby --version
1721
- gem --version
1822

23+
# prevent freetds to link to wrong ws2_32 lib on i686-w64-mingw32
24+
- c:/msys64/usr/bin/rm /usr/lib/w32api/libws2_32.a
1925
# Set up project prerequisits
2026
- bundle install
2127
- bundle exec rake ports
@@ -43,13 +49,10 @@ environment:
4349
TINYTDS_UNIT_AZURE_PASS:
4450
secure: fYKSKV4v+36OFQp2nZdX4DfUpgmy5cm0wuR73cgdmEk=
4551
matrix:
46-
- ruby_version: "23-x64"
47-
- ruby_version: "23"
48-
- ruby_version: "24-x64"
4952
- ruby_version: "24"
5053
- ruby_version: "25-x64"
51-
- ruby_version: "25"
52-
- ruby_version: "26-x64"
5354
- ruby_version: "26"
55+
- ruby_version: "head-x64"
5456
on_failure:
57+
- find -name config.log | xargs cat
5558
- find -name compile.log | xargs cat

ext/tiny_tds/extconf.rb

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,39 @@ def do_help
2222

2323
# Make sure to check the ports path for the configured host
2424
host = RbConfig::CONFIG['host']
25-
project_dir = File.join(['..']*4)
25+
project_dir = File.expand_path("../../..", __FILE__)
2626
freetds_ports_dir = File.join(project_dir, 'ports', host, 'freetds', FREETDS_VERSION)
2727
freetds_ports_dir = File.expand_path(freetds_ports_dir)
2828

2929
# Add all the special path searching from the original tiny_tds build
30-
# order is important here! First in, last searched.
30+
# order is important here! First in, first searched.
3131
DIRS = %w(
32-
/usr/local
3332
/opt/local
33+
/usr/local
3434
)
3535

36+
# Add the ports directory if it exists for local developer builds
37+
DIRS.unshift(freetds_ports_dir) if File.directory?(freetds_ports_dir)
38+
3639
# Grab freetds environment variable for use by people on services like
3740
# Heroku who they can't easily use bundler config to set directories
38-
DIRS.push(ENV['FREETDS_DIR']) if ENV.has_key?('FREETDS_DIR')
39-
40-
# Add the ports directory if it exists for local developer builds
41-
DIRS.push(freetds_ports_dir) if File.directory?(freetds_ports_dir)
41+
DIRS.unshift(ENV['FREETDS_DIR']) if ENV.has_key?('FREETDS_DIR')
4242

4343
# Add the search paths for freetds configured above
44-
DIRS.each do |path|
45-
idir = "#{path}/include"
44+
ldirs = DIRS.flat_map do |path|
4645
ldir = "#{path}/lib"
46+
[ldir, "#{ldir}/freetds"]
47+
end
4748

48-
dir_config('freetds',
49-
[idir, "#{idir}/freetds"],
50-
[ldir, "#{ldir}/freetds"]
51-
)
49+
idirs = DIRS.flat_map do |path|
50+
idir = "#{path}/include"
51+
[idir, "#{idir}/freetds"]
5252
end
5353

54+
puts "looking for freetds headers in the following directories:\n#{idirs.map{|a| " - #{a}\n"}.join}"
55+
puts "looking for freetds library in the following directories:\n#{ldirs.map{|a| " - #{a}\n"}.join}"
56+
dir_config('freetds', idirs, ldirs)
57+
5458
have_dependencies = [
5559
find_header('sybfront.h'),
5660
find_header('sybdb.h'),

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.15"
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.1.0j'
5+
OPENSSL_VERSION = ENV['TINYTDS_OPENSSL_VERSION'] || '1.1.1d'
66
OPENSSL_SOURCE_URI = "https://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz"
77

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

tasks/native_gem.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ task 'gem:windows' => ['ports:cross'] do
88
build = ['bundle']
99

1010
# and finally build the native gem
11-
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`"'
11+
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`"'
1212

1313
RakeCompilerDock.sh build.join(' && ')
1414
end

tasks/ports.rake

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ require_relative 'ports/openssl'
66
require_relative 'ports/freetds'
77
require_relative '../ext/tiny_tds/extconsts'
88

9-
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE if defined? OpenSSL
10-
119
namespace :ports do
1210
openssl = Ports::Openssl.new(OPENSSL_VERSION)
1311
libiconv = Ports::Libiconv.new(ICONV_VERSION)
1412
freetds = Ports::Freetds.new(FREETDS_VERSION)
1513

1614
directory "ports"
15+
CLEAN.include "ports/*mingw32*"
16+
CLEAN.include "ports/*.installed"
1717

1818
task :openssl, [:host] do |task, args|
1919
args.with_defaults(host: RbConfig::CONFIG['host'])
@@ -71,15 +71,13 @@ namespace :ports do
7171
task 'cross' do
7272
require 'rake_compiler_dock'
7373

74-
# make sure to install our bundle
75-
build = ['bundle']
76-
7774
# build the ports for all our cross compile hosts
7875
GEM_PLATFORM_HOSTS.each do |gem_platform, host|
76+
# make sure to install our bundle
77+
build = ['bundle']
7978
build << "rake ports:compile[#{host}] MAKE='make -j`nproc`'"
79+
RakeCompilerDock.sh build.join(' && '), platform: gem_platform
8080
end
81-
82-
RakeCompilerDock.sh build.join(' && ')
8381
end
8482
end
8583

tasks/ports/openssl.rb

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,11 @@ def install
2727

2828
private
2929

30-
def execute(action, command, options={})
31-
# OpenSSL Requires Perl >= 5.10, while the Ruby devkit uses MSYS1 with Perl 5.8.8.
32-
# To overcome this, prepend Git's usr/bin to the PATH.
33-
# It has MSYS2 with a recent version of perl.
34-
prev_path = ENV['PATH']
35-
if host =~ /mingw/ && IO.popen(["perl", "-e", "print($])"], &:read).to_f < 5.010
36-
git_perl = 'C:/Program Files/Git/usr/bin'
37-
if File.directory?(git_perl)
38-
ENV['PATH'] = "#{git_perl}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
39-
ENV['PERL'] = 'perl'
40-
end
41-
end
42-
43-
super
44-
ENV['PATH'] = prev_path
45-
end
46-
4730
def configure_defaults
4831
opts = [
4932
'shared',
50-
target_arch
33+
target_arch,
34+
"--openssldir=#{path}",
5135
]
5236

5337
if cross_build?

tiny_tds.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ Gem::Specification.new do |s|
2121
s.required_ruby_version = '>= 2.0.0'
2222
s.metadata['msys2_mingw_dependencies'] = 'freetds'
2323
s.add_development_dependency 'mini_portile2', '~> 2.0'
24-
s.add_development_dependency 'rake', '~> 10.4'
24+
s.add_development_dependency 'rake', '~> 13.0'
2525
s.add_development_dependency 'rake-compiler', '~> 1.0'
26-
s.add_development_dependency 'rake-compiler-dock', '~> 0.6.3'
26+
s.add_development_dependency 'rake-compiler-dock', '~> 1.0'
2727
s.add_development_dependency 'minitest', '~> 5.6'
2828
s.add_development_dependency 'connection_pool', '~> 2.2'
2929
end

0 commit comments

Comments
 (0)