From 7787f25f3f2c7039ebbe27954f4da8d6c1a1429a Mon Sep 17 00:00:00 2001 From: Luis Lavena Date: Sun, 26 Sep 2010 17:26:05 -0300 Subject: [PATCH] Attempt to enable static linking for Windows --- ext/mysql2/extconf.rb | 3 ++- tasks/compile.rake | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/mysql2/extconf.rb b/ext/mysql2/extconf.rb index c8806d0..5bf8371 100644 --- a/ext/mysql2/extconf.rb +++ b/ext/mysql2/extconf.rb @@ -26,7 +26,8 @@ GLOB = "{#{dirs.join(',')}}/{mysql_config,mysql_config5}" if RUBY_PLATFORM =~ /mswin|mingw/ inc, lib = dir_config('mysql') - exit 1 unless have_library("libmysql") + library = enable_config('static') ? 'mysqlclient' : 'libmysql' + exit 1 unless have_library(library) elsif mc = (with_config('mysql-config') || Dir[GLOB].first) then mc = Dir[GLOB].first if mc == true cflags = `#{mc} --cflags`.chomp diff --git a/tasks/compile.rake b/tasks/compile.rake index d46766c..cc92b99 100644 --- a/tasks/compile.rake +++ b/tasks/compile.rake @@ -15,7 +15,8 @@ Rake::ExtensionTask.new("mysql2", gemspec) do |ext| # DRY options feed into compile or cross-compile process windows_options = [ "--with-mysql-include=#{mysql_lib}/include", - "--with-mysql-lib=#{mysql_lib}/lib/opt" + "--with-mysql-lib=#{mysql_lib}/lib/opt", + '--enable-static' ] # automatically add build options to avoid need of manual input