Skip to content

Commit ab58bc3

Browse files
committed
Merge pull request #578 from sodabrew/vendor_mysql_cross
Three fixes to Windows build errors since #473
2 parents c32f0f3 + 1fcc1e9 commit ab58bc3

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

appveyor.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ install:
77
- gem --version
88
- gem install bundler --quiet --no-ri --no-rdoc
99
- bundler --version
10-
- bundle install --without benchmarks
10+
- bundle install --without benchmarks --path vendor/bundle
1111
build_script:
1212
- bundle exec rake compile
1313
test_script:
@@ -31,13 +31,5 @@ environment:
3131
- ruby_version: "21-x64"
3232
cache:
3333
- vendor
34-
- C:\Ruby200\lib\ruby\gems\2.0.0
35-
- C:\Ruby200\bin
36-
- C:\Ruby200-x64\lib\ruby\gems\2.0.0
37-
- C:\Ruby200-x64\bin
38-
- C:\Ruby21\lib\ruby\gems\2.1.0
39-
- C:\Ruby21\bin
40-
- C:\Ruby21-x64\lib\ruby\gems\2.1.0
41-
- C:\Ruby21-x64\bin
4234
services:
4335
- mysql

tasks/compile.rake

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,16 @@ Rake::ExtensionTask.new("mysql2", gemspec) do |ext|
1212
CLEAN.include "#{ext.lib_dir}/*.#{RbConfig::CONFIG['DLEXT']}"
1313

1414
if RUBY_PLATFORM =~ /mswin|mingw/ then
15-
Rake::Task['vendor:mysql'].invoke
1615
# Expand the path because the build dir is 3-4 levels deep in tmp/platform/version/
1716
connector_dir = File.expand_path("../../vendor/#{vendor_mysql_dir}", __FILE__)
1817
ext.config_options = [ "--with-mysql-dir=#{connector_dir}" ]
1918
else
20-
Rake::Task['vendor:mysql'].invoke('x86')
21-
Rake::Task['vendor:mysql'].invoke('x64')
2219
ext.cross_compile = true
2320
ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60', 'x64-mingw32']
24-
ext.cross_config_options = {
25-
'x86-mingw32' => [ "--with-mysql-dir=" + File.expand_path("../../vendor/#{vendor_mysql_dir('x86')}", __FILE__) ],
26-
'x86-mswin32-60' => [ "--with-mysql-dir=" + File.expand_path("../../vendor/#{vendor_mysql_dir('x86')}", __FILE__) ],
27-
'x64-mingw32' => [ "--with-mysql-dir=" + File.expand_path("../../vendor/#{vendor_mysql_dir('x64')}", __FILE__) ],
21+
ext.cross_config_options << {
22+
'x86-mingw32' => "--with-mysql-dir=" + File.expand_path("../../vendor/#{vendor_mysql_dir('x86')}", __FILE__),
23+
'x86-mswin32-60' => "--with-mysql-dir=" + File.expand_path("../../vendor/#{vendor_mysql_dir('x86')}", __FILE__),
24+
'x64-mingw32' => "--with-mysql-dir=" + File.expand_path("../../vendor/#{vendor_mysql_dir('x64')}", __FILE__),
2825
}
2926

3027
ext.cross_compiling do |spec|
@@ -76,4 +73,8 @@ end
7673
if RUBY_PLATFORM =~ /mingw|mswin/ then
7774
Rake::Task['compile'].prerequisites.unshift 'vendor:mysql'
7875
Rake::Task['compile'].prerequisites.unshift 'devkit'
76+
else
77+
if Rake::Task.tasks.map {|t| t.name }.include? 'cross'
78+
Rake::Task['cross'].prerequisites.unshift 'vendor:mysql:cross'
79+
end
7980
end

tasks/vendor_mysql.rake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ def vendor_mysql_url(*args)
2121
end
2222

2323
# vendor:mysql
24+
task "vendor:mysql:cross" do |t|
25+
# When cross-compiling, grab both 32 and 64 bit connectors
26+
Rake::Task['vendor:mysql'].invoke('x86')
27+
Rake::Task['vendor:mysql'].invoke('x64')
28+
end
29+
2430
task "vendor:mysql", [:platform] do |t, args|
2531
puts "vendor:mysql for #{vendor_mysql_dir(args[:platform])}"
2632

0 commit comments

Comments
 (0)