-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsakefile.rb
171 lines (134 loc) · 3.5 KB
/
sakefile.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
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
# -*- ruby -*-
# sake variant sake1
# The build tool driving this makefile is a custom one. To get it, you may use the command
#
# svn co https://pdis-miso.svn.sourceforge.net/svnroot/pdis-miso/trunk/sake
# See also makefile.rb, which has useful utilities for reconstructing
# the source code, for instance.
# We could otherwise simply use a 0 value
# (as Python imports should be purely name-based),
# but SIS file prerequisites do require a UID,
# so we are using a UID allocated from Symbian.
COMP_NAME = "pyexpat"
COMP_UID = 0x10206ba2 # allocated from Symbian
require 'sake1/component'
$comp = Sake::Component.new(:target_type => :pyd,
:vendor => "HIIT",
:basename => 'pyexpat',
:name => "xml library for PyS60",
:version => [1, 9],
:uid_v8 => COMP_UID,
:caps => Sake::ALL_CAPS)
class Sake::Component
def group_dir
@dir
end
end
require 'build/with'
def try_load file
begin
load file
rescue LoadError; end
end
if $sake_op[:kits]
$kits = Sake::DevKits::get_exact_set($sake_op[:kits].strip.split(/,/))
else
$kits = Sake::DevKits::get_all
$kits.delete_if do |kit|
!kit.supports_python?
end
end
$builds = $kits.map do |kit|
Sake::CompBuild.new :component => $comp, :devkit => kit
end
# For any v9 builds, configure certificate info for signing. See
# Sake::CompBuild for the attributes to set.
try_load('local/signing.rb')
$builds.delete_if do |build|
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
class HexNum
def initialize num
@num = num
end
def to_s
"0x%08x" % @num
end
end
for build in $builds
# To define __UID__ for header files.
build.trait_map[:uid] = HexNum.new(build.uid3.number)
end
for build in $builds
map = build.trait_map
if $sake_op[:logging] and map[:has_flogger]
map[:do_logging] = :define
end
build.plats = (build.v9? ? "gcce" : "armi")
end
task :default => [:bin, :sis]
require 'sake1/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]
Sake::Tasks::force_uncurrent_on_op_change
class Array
def hjoin
self.join('-')
end
end
def sh_noerr(command)
puts command
system(command)
end
def make_patch(dir, basename, version)
sfile = [basename, version, 'orig'].hjoin
tfile = [basename, version, 'patched'].hjoin
pfile = File.join(dir, ['patch', basename, version].hjoin)
raise unless File.directory?(sfile)
raise unless File.directory?(tfile)
sh_noerr("diff -r -u -N --strip-trailing-cr #{sfile} #{tfile} > #{pfile}")
end
task :patches do
patch_home = "patchfiles"
mkdir_p patch_home
list = Dir['*-*-patched']
list.each do |pdir|
if pdir =~ /(.*)-(.*)-patched/
make_patch(patch_home, $1, $2)
else
raise
end
end
end
task :upload do
ruby("local/upload.rb")
end
task :upload_dry do
ruby("local/upload.rb", "dry")
end
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