Permalink
Browse files

Make TinyTDS cross compile, enjoy

With this code, cross compiling is a matter of issuing:

  rake cross compile

But remember you need to have the cross-compiled versions of Ruby
installed and RUBY_CC_VERSION configured to those versions.

Example, if you installed both 1.8.7-p334 and 1.9.2-p180, do:

  export RUBY_CC_VERSION=1.8.7:1.9.2
  • Loading branch information...
1 parent ea2f768 commit ef163c530e7bf1d52e55bd986367bce66527d912 @luislavena luislavena committed with metaskills Apr 7, 2011
Showing with 13 additions and 0 deletions.
  1. +13 −0 Rakefile
View
@@ -42,6 +42,19 @@ task :compile => ["ports:freetds"] unless ENV['TINYTDS_SKIP_PORTS']
Rake::ExtensionTask.new('tiny_tds', gemspec) do |ext|
ext.lib_dir = 'lib/tiny_tds'
ext.config_options << "--enable-iconv" unless ENV['TINYTDS_SKIP_PORTS']
+
+ # automatically add build options to avoid need of manual input
+ if RUBY_PLATFORM =~ /mswin|mingw/ then
+ # define target for extension (supporting fat binaries)
+ RUBY_VERSION =~ /(\d+\.\d+)/
+ ext.lib_dir = "lib/tiny_tds/#{$1}"
+ else
+ ext.cross_compile = true
+ ext.cross_platform = ['i386-mingw32']
+ ext.cross_config_options << "--disable-lookup"
+ ext.cross_config_options << "--with-iconv-dir=#{$recipes[:libiconv].path}"
+ ext.cross_config_options << "--with-freetds-dir=#{$recipes[:freetds].path}"
+ end
end
task :build => [:clean, :compile]

0 comments on commit ef163c5

Please sign in to comment.