summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortduehr <tduehr@gmail.com>2014-10-03 16:20:39 -0500
committertduehr <tduehr@gmail.com>2014-10-06 16:04:11 -0500
commit7c3748340da0c59436d3a48dbf19bb9291ba1136 (patch)
tree7410ec438258aae295e05e81a6ea08e02f5a1245
parent1e90d28632d6f30b38c52ec8d2b9250cf6c15771 (diff)
downloadffi-7c3748340da0c59436d3a48dbf19bb9291ba1136.tar.gz
windows support for ruby 2.1
-rw-r--r--Rakefile19
-rw-r--r--lib/ffi.rb2
-rw-r--r--spec/ffi/spec_helper.rb1
3 files changed, 16 insertions, 6 deletions
diff --git a/Rakefile b/Rakefile
index 9b7056b..66b7059 100644
--- a/Rakefile
+++ b/Rakefile
@@ -150,11 +150,6 @@ task 'spec:specdoc' => TEST_DEPS
task :default => :specs
-task 'gem:win32' do
- sh("rake cross native gem RUBY_CC_VERSION='1.8.7:1.9.3:2.0.0:2.1.3'") || raise("win32 build failed!")
-end
-
-
namespace 'java' do
java_gem_spec = Gem::Specification.new do |s|
@@ -190,11 +185,23 @@ if USE_RAKE_COMPILER
ext.cross_platform = %w[i386-mingw32 x64-mingw32] # forces the Windows platform instead of the default one
end
- ENV['RUBY_CC_VERSION'].to_s.split(':').each do |ruby_version|
+ task 'gem:win32' => ['gem:win32-x64', 'gem:win32-i386']
+
+ task 'gem:win32-x86' do
+ sh("rake cross native:i386-mingw32 gem RUBY_CC_VERSION='1.8.7:1.9.3:2.0.0:2.1.3'") || raise("win32-i386 build failed!")
+ end
+
+ task 'gem:win32-x64' do
+ sh("rake cross native:x64-mingw32 gem RUBY_CC_VERSION='2.0.0:2.1.3'") || raise("win32-x64 build failed!")
+ end
+
+ (ENV['RUBY_CC_VERSION'] || '1.8.7:1.9.3:2.0.0:2.1.3' ).to_s.split(':').each do |ruby_version|
task "copy:ffi_c:i386-mingw32:#{ruby_version}" do |t|
sh "i686-w64-mingw32-strip -S #{BUILD_DIR}/i386-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so"
end
+ end
+ (ENV['RUBY_CC_VERSION'] || '2.0.0:2.1.3' ).to_s.split(':').each do |ruby_version|
task "copy:ffi_c:x64-mingw32:#{ruby_version}" do |t|
sh "x86_64-w64-mingw32-strip -S #{BUILD_DIR}/x64-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so"
end
diff --git a/lib/ffi.rb b/lib/ffi.rb
index e23e772..d55d007 100644
--- a/lib/ffi.rb
+++ b/lib/ffi.rb
@@ -7,6 +7,8 @@ if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
require '1.9/ffi_c'
elsif RUBY_VERSION =~ /2.0/
require '2.0/ffi_c'
+ elsif RUBY_VERSION =~ /2.1/
+ require '2.1/ffi_c'
else
require 'ffi_c'
end
diff --git a/spec/ffi/spec_helper.rb b/spec/ffi/spec_helper.rb
index cda739f..00c43ec 100644
--- a/spec/ffi/spec_helper.rb
+++ b/spec/ffi/spec_helper.rb
@@ -4,6 +4,7 @@
#
require 'rbconfig'
+require 'fileutils'
require 'ffi'
CPU = case RbConfig::CONFIG['host_cpu'].downcase