Skip to content

Commit 6728435

Browse files
committed
Call RakeCompilerDock.sh twice, once for 32-bit and once for 64-bit
This is a workaround for a 32-bit vendor/libmysql.dll ending up in the 64-bit platform's gem build. The issue seems to be that rake-compiler unwinds the package dependency graph once after compiling all of the targets, so an output file that varies per target doesn't work. was: Local changes used to cross-compile the 0.3.19 gem
1 parent 99c57e9 commit 6728435

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tasks/compile.rake

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Rake::ExtensionTask.new("mysql2", gemspec) do |ext|
1717
ext.config_options = [ "--with-mysql-dir=#{connector_dir}" ]
1818
else
1919
ext.cross_compile = true
20-
ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60', 'x64-mingw32']
20+
ext.cross_platform = ENV['CROSS_PLATFORMS'] ? ENV['CROSS_PLATFORMS'].split(':') : ['x86-mingw32', 'x86-mswin32-60', 'x64-mingw32']
2121
ext.cross_config_options << {
2222
'x86-mingw32' => "--with-mysql-dir=" + File.expand_path("../../vendor/#{vendor_mysql_dir('x86')}", __FILE__),
2323
'x86-mswin32-60' => "--with-mysql-dir=" + File.expand_path("../../vendor/#{vendor_mysql_dir('x86')}", __FILE__),
@@ -87,11 +87,19 @@ else
8787
end
8888
end
8989

90-
desc "Build the windows binary gems per rake-compiler-dock"
90+
desc "Build binary gems for Windows with rake-compiler-dock"
9191
task 'gem:windows' do
9292
require 'rake_compiler_dock'
9393
RakeCompilerDock.sh <<-EOT
94-
bundle install "--without=test benchmarks development rbx" &&
95-
rake cross native gem
94+
bundle install
95+
rake clean
96+
rm vendor/libmysql.dll
97+
rake cross native gem CROSS_PLATFORMS=x86-mingw32:x86-mswin32-60
98+
EOT
99+
RakeCompilerDock.sh <<-EOT
100+
bundle install
101+
rake clean
102+
rm vendor/libmysql.dll
103+
rake cross native gem CROSS_PLATFORMS=x64-mingw32
96104
EOT
97105
end

0 commit comments

Comments
 (0)