Permalink
Browse files

always use different extension dirs for ruby 1.8 and 1.9

This removes special case for win32-gems
  • Loading branch information...
1 parent 33a3bf3 commit 3b8c8375cf3049629d70634b0689a113adb38a26 @larskanis committed Jan 7, 2011
Showing with 7 additions and 10 deletions.
  1. +3 −1 Rakefile
  2. +4 −9 lib/pkcs11.rb
View
@@ -20,7 +20,7 @@ hoe = Hoe.spec 'pkcs11' do
developer('Lars Kanis', 'kanis@comcard.de')
extra_dev_deps << ['yard', '>= 0.6']
extra_dev_deps << ['rake-compiler', '>= 0.7']
-
+
self.url = 'http://github.com/larskanis/pkcs11'
self.summary = 'PKCS#11 binding for Ruby'
self.description = 'This module allows Ruby programs to interface with "RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki)".'
@@ -39,7 +39,9 @@ end
ENV['RUBY_CC_VERSION'] = '1.8.6:1.9.2'
Rake::ExtensionTask.new('pkcs11_ext', hoe.spec) do |ext|
+ major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
ext.ext_dir = 'ext'
+ ext.lib_dir = "lib/#{major_minor}"
ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
ext.cross_platform = ['i386-mswin32', 'i386-mingw32'] # forces the Windows platform instead of the default one
end
View
@@ -1,12 +1,7 @@
#!/usr/bin/env ruby
-# Load the correct version if it's a Windows binary gem
-if RUBY_PLATFORM =~/(mswin|mingw)/i
- major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
- raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
- require "#{major_minor}/pkcs11_ext"
-else
- require 'pkcs11_ext'
-end
-
+# Load the extension, depending of the ruby version
+major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
+ raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
+require "#{major_minor}/pkcs11_ext"
require 'pkcs11/extensions'

0 comments on commit 3b8c837

Please sign in to comment.