/
Rakefile
72 lines (61 loc) · 2.94 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# -*- coding: utf-8 -*-
# -*- ruby -*-
require 'rubygems'
require 'hoe'
require 'rake/extensiontask'
require 'rbconfig'
CLEAN.include 'ext/pk11_struct_def.inc'
CLEAN.include 'ext/pk11_struct_impl.inc'
CLEAN.include 'ext/pk11_const_def.inc'
CLEAN.include 'ext/pk11_thread_funcs.h'
CLEAN.include 'ext/pk11_thread_funcs.c'
CLEAN.include 'lib/pkcs11_ext.so'
CLEAN.include 'tmp'
hoe = Hoe.spec 'pkcs11' do
developer('Ryosuke Kutsuna', 'ryosuke@deer-n-horse.jp')
developer('GOTOU Yuuzou', 'gotoyuzo@notwork.org')
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)".'
self.readme_file = 'README.rdoc'
self.extra_rdoc_files << self.readme_file << 'ext/pk11.c'
spec_extras[:extensions] = 'ext/extconf.rb'
spec_extras[:files] = File.read_utf("Manifest.txt").split(/\r?\n\r?/)
spec_extras[:files] << 'ext/pk11_struct_impl.inc'
spec_extras[:files] << 'ext/pk11_struct_def.inc'
spec_extras[:files] << 'ext/pk11_const_def.inc'
spec_extras[:files] << 'ext/pk11_thread_funcs.h'
spec_extras[:files] << 'ext/pk11_thread_funcs.c'
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
file 'ext/extconf.rb' => ['ext/pk11_struct_def.inc', 'ext/pk11_thread_funcs.c']
file 'ext/pk11_struct_def.inc' => 'ext/generate_structs.rb' do
sh "#{Config::CONFIG['ruby_install_name']} ext/generate_structs.rb --def ext/pk11_struct_def.inc --impl ext/pk11_struct_impl.inc --const ext/pk11_const_def.inc --doc ext/pk11_struct.doc ext/include/pkcs11t.h"
end
file 'ext/pk11_struct_impl.inc' => 'ext/pk11_struct_def.inc'
file 'ext/pk11.c' => 'ext/pk11_struct_def.inc'
file 'ext/pk11_const.c' => 'ext/pk11_struct_def.inc'
file 'ext/pk11_thread_funcs.h' => 'ext/generate_thread_funcs.rb' do
sh "#{Config::CONFIG['ruby_install_name']} ext/generate_thread_funcs.rb --impl ext/pk11_thread_funcs.c --decl ext/pk11_thread_funcs.h ext/include/pkcs11f.h"
end
file 'ext/pk11_thread_funcs.c' => 'ext/pk11_thread_funcs.h'
file 'ext/pk11.h' => 'ext/pk11_thread_funcs.h'
# RDoc-upload task for github (currently on rubyforge)
#
# require 'grancher/task'
# Grancher::Task.new do |g|
# g.branch = 'gh-pages' # alternatively, g.refspec = 'ghpages:/refs/heads/ghpages'
# g.push_to = 'origin'
# g.directory 'doc'
# end
# vim: syntax=ruby