Permalink
Browse files

Adding "fat gem" compatible loader, set the default RUBY_CC_VERSION

bugfix: Compile extension when installing source gem
  • Loading branch information...
1 parent 9713aa5 commit dce3a0c4846cd058202a9dd829dfb1287a220935 Kanis-Küche committed May 4, 2010
View
@@ -4,17 +4,18 @@ MIT-LICENSE
Manifest.txt
README.rdoc
Rakefile
-ext/pkcs11/extconf.rb
-ext/pkcs11/include/cryptoki.h
-ext/pkcs11/include/ct-kip.h
-ext/pkcs11/include/otp-pkcs11.h
-ext/pkcs11/include/pkcs-11v2-20a3.h
-ext/pkcs11/include/pkcs11.h
-ext/pkcs11/include/pkcs11f.h
-ext/pkcs11/include/pkcs11t.h
-ext/pkcs11/pk11.c
-ext/pkcs11/pk11.h
-ext/pkcs11/pk11_const.c
+ext/extconf.rb
+ext/include/cryptoki.h
+ext/include/ct-kip.h
+ext/include/otp-pkcs11.h
+ext/include/pkcs-11v2-20a3.h
+ext/include/pkcs11.h
+ext/include/pkcs11f.h
+ext/include/pkcs11t.h
+ext/pk11.c
+ext/pk11.h
+ext/pk11_const.c
+lib/pkcs11.rb
sample/firefox_certs.rb
sample/nssckbi.rb
test/test_pkcs11.rb
View
@@ -63,7 +63,7 @@ Download and cross compile ruby for win32:
Download and cross compile pkcs11 for win32:
- rake cross native gem RUBY_CC_VERSION=1.8.6
+ rake cross native gem
If everything works, there should be pkcs11-VERSION-x86-mswin32.gem in the pkg
directory.
View
@@ -12,9 +12,13 @@ hoe = Hoe.spec 'pkcs11' do
self.readme_file = 'README.rdoc'
self.extra_rdoc_files << self.readme_file
+ spec_extras[:extensions] = 'ext/extconf.rb'
end
-Rake::ExtensionTask.new('pkcs11', hoe.spec) do |ext|
+ENV['RUBY_CC_VERSION'] = '1.8.6:1.9.1'
+
+Rake::ExtensionTask.new('pkcs11_ext', hoe.spec) do |ext|
+ ext.ext_dir = 'ext'
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
@@ -3,4 +3,4 @@
basedir = File.dirname(__FILE__)
$CPPFLAGS += " -I \"#{basedir}/include\""
have_func("rb_str_set_len")
-create_makefile("pkcs11");
+create_makefile("pkcs11_ext");
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1459,7 +1459,7 @@ cCK_MECHANISM_set_pParameter(VALUE self, VALUE value)
} while(0)
void
-Init_pkcs11()
+Init_pkcs11_ext()
{
sNEW = rb_intern("new");
cPKCS11 = rb_define_class("PKCS11", rb_cObject);
@@ -19,7 +19,7 @@
} while(0)
#endif
-void Init_pkcs11();
+void Init_pkcs11_ext();
void Init_pkcs11_const(VALUE);
/* unix defns for pkcs11.h */
File renamed without changes.
View
@@ -0,0 +1,10 @@
+#!/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

0 comments on commit dce3a0c

Please sign in to comment.