-
Notifications
You must be signed in to change notification settings - Fork 37
/
build.rb
executable file
·64 lines (55 loc) · 1.42 KB
/
build.rb
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
#!/usr/bin/env ruby
require 'nokogiri'
require 'fileutils'
VER = "0.9.0"
FLAGS = {
'R' => 'PIV_SUPPORT_RSA',
'E' => 'PIV_SUPPORT_EC',
'e' => 'PIV_SUPPORT_ECCP384',
'S' => 'PIV_STRICT_CONTACTLESS',
'A' => 'YKPIV_ATTESTATION',
'x' => 'APPLET_EXTLEN',
'L' => 'APPLET_LOW_TRANSIENT',
'a' => 'PIV_SUPPORT_AES',
'D' => 'PIV_SUPPORT_3DES'
}
$xmlbase = Nokogiri::XML(File.open('build.xml'))
FLAGS.each do |_,fl|
a = $xmlbase.xpath("//property[@name='#{fl}']")
a[0]['value'] = 'false'
end
def setup_config(jcver, flags)
buildxml = $xmlbase.dup
flags.split('').each do |flabbr|
fl = FLAGS[flabbr]
a = buildxml.xpath("//property[@name='#{fl}']")
a[0]['value'] = 'true'
end
f = File.open('build.xml', 'w')
f.write(buildxml.to_s)
f.close()
ENV['JC_HOME'] = ENV['JC_SDKS'] + "/#{jcver}_kit"
end
def build(ver, jcver, flags)
setup_config(jcver, flags)
`ant clean`
`ant`
FileUtils.mv('bin/PivApplet.cap', "dist/PivApplet-#{ver}-#{jcver}-#{flags}.cap")
end
`rm -fr dist`
`mkdir dist`
build(VER, 'jc221', 'RSaD')
build(VER, 'jc221', 'RSAaD')
build(VER, 'jc221', 'RSLaD')
build(VER, 'jc221', 'RSLD')
build(VER, 'jc222', 'RSAaD')
build(VER, 'jc222', 'RSAxaD')
build(VER, 'jc222', 'RAxaD')
build(VER, 'jc222', 'RSxLD')
build(VER, 'jc304', 'ESxLaD')
build(VER, 'jc304', 'RSxLaD')
build(VER, 'jc304', 'REeSAa')
build(VER, 'jc304', 'REeSAaD')
build(VER, 'jc304', 'REeSAxa')
build(VER, 'jc304', 'REeSAxaD')
build(VER, 'jc304', 'REeAxaD')