Skip to content

Commit a8e617e

Browse files
committed
Merge branch 'sync-cross-compile-and-ci-config' of github.com:larskanis/tiny_tds into sync-cross-compile-and-ci-config
2 parents 6299be6 + 42f90a7 commit a8e617e

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

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'),

tasks/ports.rake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ namespace :ports do
1212
freetds = Ports::Freetds.new(FREETDS_VERSION)
1313

1414
directory "ports"
15+
CLEAN.include "ports/*mingw32*"
16+
CLEAN.include "ports/*.installed"
1517

1618
task :openssl, [:host] do |task, args|
1719
args.with_defaults(host: RbConfig::CONFIG['host'])
@@ -69,15 +71,13 @@ namespace :ports do
6971
task 'cross' do
7072
require 'rake_compiler_dock'
7173

72-
# make sure to install our bundle
73-
build = ['bundle']
74-
7574
# build the ports for all our cross compile hosts
7675
GEM_PLATFORM_HOSTS.each do |gem_platform, host|
76+
# make sure to install our bundle
77+
build = ['bundle']
7778
build << "rake ports:compile[#{host}] MAKE='make -j`nproc`'"
79+
RakeCompilerDock.sh build.join(' && '), platform: gem_platform
7880
end
79-
80-
RakeCompilerDock.sh build.join(' && ')
8181
end
8282
end
8383

tiny_tds.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ 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'
2626
s.add_development_dependency 'rake-compiler-dock', '~> 1.0'
2727
s.add_development_dependency 'minitest', '~> 5.6'

0 commit comments

Comments
 (0)