Dry windows configuration options
This commit is contained in:
parent
553c9a77c3
commit
685538ce52
@ -12,15 +12,19 @@ Rake::ExtensionTask.new("mysql2", gemspec) do |ext|
|
|||||||
# reference where the vendored MySQL got extracted
|
# reference where the vendored MySQL got extracted
|
||||||
mysql_lib = File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', "mysql-#{MYSQL_VERSION}-win32"))
|
mysql_lib = File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', "mysql-#{MYSQL_VERSION}-win32"))
|
||||||
|
|
||||||
|
# DRY options feed into compile or cross-compile process
|
||||||
|
windows_options = [
|
||||||
|
"--with-mysql-include=#{mysql_lib}/include",
|
||||||
|
"--with-mysql-lib=#{mysql_lib}/lib/opt"
|
||||||
|
]
|
||||||
|
|
||||||
# automatically add build options to avoid need of manual input
|
# automatically add build options to avoid need of manual input
|
||||||
if RUBY_PLATFORM =~ /mswin|mingw/ then
|
if RUBY_PLATFORM =~ /mswin|mingw/ then
|
||||||
ext.config_options << "--with-mysql-include=#{mysql_lib}/include"
|
ext.config_options = windows_options
|
||||||
ext.config_options << "--with-mysql-lib=#{mysql_lib}/lib/opt"
|
|
||||||
else
|
else
|
||||||
ext.cross_compile = true
|
ext.cross_compile = true
|
||||||
ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
|
ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
|
||||||
ext.cross_config_options << "--with-mysql-include=#{mysql_lib}/include"
|
ext.cross_config_options = windows_options
|
||||||
ext.cross_config_options << "--with-mysql-lib=#{mysql_lib}/lib/opt"
|
|
||||||
|
|
||||||
# inject 1.8/1.9 pure-ruby entry point when cross compiling only
|
# inject 1.8/1.9 pure-ruby entry point when cross compiling only
|
||||||
ext.cross_compiling do |spec|
|
ext.cross_compiling do |spec|
|
||||||
|
Loading…
Reference in New Issue
Block a user