forked from rails-sqlserver/tiny_tds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
55 lines (44 loc) · 1.3 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# encoding: UTF-8
require 'rake'
require "rake/clean"
require 'rbconfig'
require 'rake/testtask'
require 'rake/extensiontask'
require "rubygems/package_task"
# My notes for cross compile native Windows gem.
# gcla ; bundle install ; rake compile ; rake cross compile ; rake cross native gem
def test_libs
['lib','test']
end
def test_files
Dir.glob("test/**/*_test.rb").sort
end
def gemspec
@clean_gemspec ||= eval(File.read(File.expand_path('../tiny_tds.gemspec', __FILE__)))
end
Rake::TestTask.new do |t|
t.libs = test_libs
t.test_files = test_files
t.verbose = true
end
Gem::PackageTask.new(gemspec) do |pkg|
pkg.need_tar = false
pkg.need_zip = false
end
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']
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"
end
end
task :build => [:clean, :compile]
task :default => [:build, :test]
Dir["tasks/*.rake"].sort.each { |f| load f }