Repository navigation
Expand file tree
/
Copy pathsakefile.rb
More file actions
195 lines (157 loc) · 4.74 KB
/
Copy pathsakefile.rb
File metadata and controls
195 lines (157 loc) · 4.74 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# -*- ruby -*-
# sake variant sake3
require 'sake3/component'
def try_load file
begin
load file
rescue LoadError; end
end
$uid_v8 = 0x08440034
$basename = "pytwink"
$proj = Sake::Project.new(:basename => $basename,
:name => "pytwink lib for PyS60",
:version => [3, 1],
# This is a test UID.
:uid => Sake::Uid.v8($uid_v8),
:vendor => "HIIT")
class <<$proj
def pkg_in_file
group_dir + ("module.pkg.in")
end
end
$pyd = Sake::Component.new(:project => $proj,
:target_type => :pyd,
:basename => $basename,
:bin_basename => $basename,
:uid3 => Sake::Uid.v8($uid_v8),
:caps => Sake::ALL_CAPS)
class <<$pyd
def mmp_in_file
group_dir + ("module.mmp.in")
end
end
$comp_list = [$pyd].compact
if $sake_op[:kits]
$kits = Sake::DevKits::get_exact_set($sake_op[:kits].strip.split(/,/))
else
$kits = Sake::DevKits::get_all
end
$kits.delete_if do |kit|
!kit.supports_python?
end
if $sake_op[:comps]
comps = $sake_op[:comps].strip.split(/,/)
$comp_list.delete_if do |comp|
!comps.include?(comp.basename)
end
end
$builds = $kits.map do |kit|
build = Sake::ProjBuild.new(:project => $proj,
:devkit => kit)
build.abld_platform = (build.v9? ? "gcce" : "armi")
build.abld_build = ($sake_op[:udeb] ? "udeb" : "urel")
if $sake_op[:udeb]
build.handle = (build.handle + "_udeb")
end
build
end
# For any v9 builds, configure certificate info for signing.
try_load('local/signing.rb')
$builds.delete_if do |build|
# Only v9 builds supported, actually.
# Maybe even not all of them, due to the SWInst API instability.
!build.v9? or (build.sign and !build.cert_file)
end
if $sake_op[:builds]
blist = $sake_op[:builds]
$builds.delete_if do |build|
!blist.include?(build.handle)
end
end
desc "Prints a list of possible builds."
task :builds do
for build in $builds
puts build.handle
end
end
desc "Prints info about possible builds."
task :build_info do
for build in $builds
puts "#{build.handle}:"
puts " project name #{build.project.name}"
puts " basename #{build.project.basename}"
puts " target #{build.target.handle}"
puts " devkit #{build.devkit.handle}"
puts " abld platform #{build.abld_platform}"
puts " abld build #{build.abld_build}"
puts " sign SIS? #{build.sign}"
puts " cert file #{build.cert_file}"
puts " privkey file #{build.key_file}"
puts " cert caps #{build.max_caps.inspect}"
puts " components #{build.comp_builds.map {|x| x.component.basename}.inspect}"
end
end
class HexNum
def initialize num
@num = num
end
def to_s
"0x%08x" % @num
end
end
$exeb = Hash.new
for build in $builds
map = build.trait_map
# To define __UID__ for header files.
if build.uid
map[:uid] = HexNum.new(build.uid.number)
end
# NDEBUG controls whether asserts are to be compiled in (NDEBUG is
# defined in UDEB builds). Normally an assert results in something
# being printed to the console. To also have the errors logged, you
# will want to enable logging by setting "logging=true". Without
# this setting, there will be no dependency on the (deprecated) file
# logger API, and errors are still displayed on the console (if you
# have one and have time to read it). "logging=true" has no effect
# if your SDK does not have the required API.
if $sake_op[:logging] and map[:has_flogger]
map[:do_logging] = :define
end
# Each build variant shall have all of the components.
build.comp_builds = $comp_list.map do |comp|
b = Sake::CompBuild.new(:proj_build => build,
:component => comp)
$exeb[build] = b
b
end
end
task :default => [:bin, :sis]
require 'sake3/tasks'
Sake::Tasks::def_list_devices_tasks(:builds => $builds)
Sake::Tasks::def_makefile_tasks(:builds => $builds)
Sake::Tasks::def_binary_tasks(:builds => $builds)
Sake::Tasks::def_sis_tasks(:builds => $builds)
Sake::Tasks::def_clean_tasks(:builds => $builds)
task :all => [:makefiles, :bin, :sis]
$doc_build = $builds.last
# Configure any rules related to releasing and uploading and such
# things. Probably at least involves copying or uploading the
# distribution files somewhere.
try_load('local/releasing.rb')
Sake::Tasks::force_uncurrent_on_op_change
def sis_info opt
for build in $builds
if build.short_sisx_file.exist?
sh("sisinfo -f #{build.short_sisx_file} #{opt}")
end
end
end
task :sis_ls do
sis_info "-i"
end
task :sis_cert do
sis_info "-c"
end
task :sis_struct do
sis_info "-s"
end