forked from MoSync/MoSync
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathworkfile.rb
executable file
·238 lines (200 loc) · 5.88 KB
/
workfile.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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#!/usr/bin/ruby
# File.expand_path is used here to ensure the files are really only loaded once.
require File.expand_path('rules/githooks.rb')
require File.expand_path('rules/host.rb')
require File.expand_path('rules/work.rb')
require File.expand_path('rules/subdir.rb')
require File.expand_path('rules/mosync_util.rb')
require File.expand_path('rules/mosync_exe.rb')
require File.expand_path('rules/cCompile.rb')
enforceGithooks
if(HOST == :win32) then
INTLIB_PLATFORM = "windows"
PLATFORM_TOOLS = ["tools/makesis-2.0.0", "tools/makesis-4",
"tools/MoSyncUpdater"]
elsif(HOST == :darwin)
INTLIB_PLATFORM = "linux"
PLATFORM_TOOLS = ["tools/makesis-2.0.0_unix", "tools/makesis-4_unix",
]
else
INTLIB_PLATFORM = HOST
# todo: add lcab
PLATFORM_TOOLS = [
'tools/MoCab', 'tools/makesis-2.0.0_unix', 'tools/makesis-4_unix',
]
end
PRE_DIRS = [
"intlibs/idl-common",
"intlibs/filelist",
"intlibs/helpers/platforms/#{INTLIB_PLATFORM}",
]
MORE_DIRS = [
"intlibs/bluetooth",
"intlibs/demangle",
"intlibs/dll",
"intlibs/sqlite",
"intlibs/gsm_amr",
"intlibs/net",
"intlibs/stabs",
"intlibs/dgles-0.5",
"intlibs/profiledb",
"runtimes/cpp/platforms/sdl",
"runtimes/cpp/platforms/sdl/mosynclib",
"runtimes/cpp/platforms/sdl/MoRE"
]
BASE_DIRS = MORE_DIRS + PLATFORM_TOOLS
PIPE_DIRS = ['tools/elfStabSld',
"tools/protobuild", "tools/pipe-tool", "tools/DefaultSkinGenerator"]
EXAM_DIRS = ["tests/unitTest", "examples"]
TOOL_DIRS = [
'tools/ReleasePackageBuild',
'intlibs/mustache',
"tools/FontGenerator", "tools/PanicDoc", "tools/Bundle",
"tests/unitTestServer", "tools/iphone-builder", "tools/icon-injector", "tools/e32hack",
"tools/winphone-builder",
"tools/mx-invoker",
"tools/mx-config",
"tools/profiledb", "tools/rescomp",
"tools/mifconv", "tools/rcomp", "tools/package", "tools/uidcrc",
"tools/nbuild",
]
MAIN_DIRS = BASE_DIRS + TOOL_DIRS + PIPE_DIRS
ALL_DIRS = MAIN_DIRS + EXAM_DIRS
LIB_DIRS = ['libs']
SKINS = CopyDirTask.new(mosyncdir, 'skins')
RULES = CopyDirTask.new(mosyncdir, 'rules')
class GenOpcodesTask < FileTask
def initialize(mode, name)
@mode = mode
@gen = 'runtimes/cpp/core/gen-opcodes.rb'
@prerequisites ||= []
@prerequisites << FileTask.new(@gen)
@prerequisites << DirTask.new(File.dirname(name))
super(name)
end
def fileExecute
sh "ruby #{@gen} #{@mode} #{@NAME}"
end
end
GEN_OPCODES = GenOpcodesTask.new('ccore', 'runtimes/cpp/core/gen-opcodes.h')
GEN_CS_OPCODES = GenOpcodesTask.new('cscore', 'runtimes/csharp/windowsphone/mosync/mosyncRuntime/Source/gen-core.cs')
GEN_JAVA_OPCODES = GenOpcodesTask.new('jcore', 'runtimes/java/Shared/generated/gen-opcodes.h')
def extensionIncludes
extIncDir = mosyncdir + '/ext-include'
d = DirTask.new(extIncDir)
sources = [
'runtimes/cpp/core/extensionCommon.h',
'runtimes/cpp/core/ext/invoke-extension.h',
'runtimes/cpp/core/ext/extension.h',
'runtimes/cpp/core/syscall_arguments.h',
'runtimes/cpp/core/CoreCommon.h',
'intlibs/helpers/cpp_defs.h',
'intlibs/helpers/maapi_defs.h',
]
sources.each do |src|
CopyFileTask.new("#{extIncDir}/#{File.basename(src)}",
FileTask.new(src), [d])
end
end
Works.run(false)
target :nil do
end
target :base do
Works.invoke_subdirs(PRE_DIRS)
#Works.invoke_subdir("tools/WrapperGenerator", "compile")
Works.invoke_subdir("tools/idl2", "compile")
extensionIncludes
end
target :main => :base do
Works.invoke_subdirs(MAIN_DIRS)
end
target :default => :main do
Works.invoke_subdirs_ex(true, LIB_DIRS)
end
target :libs => :base do
Works.invoke_subdir('tools/DefaultSkinGenerator')
Works.invoke_subdirs_ex(true, LIB_DIRS)
end
target :examples => :default do
Works.invoke_subdirs_ex(true, EXAM_DIRS)
end
target :all => :examples do
end
target :more => :base do
Works.invoke_subdirs(MORE_DIRS)
end
target :version do
rev = open('|git rev-parse --verify HEAD').read.strip
mod = open('|git status --porcelain').read.strip
mod = 'mod ' if(mod.length > 0)
fn = "#{mosyncdir}/bin/version.dat"
open(fn, 'w') do |file|
file.puts("Developer local build")
file.puts(Time.new.strftime('%Y%m%d-%H%M'))
file.puts(mod+rev)
end
puts "Wrote #{fn}:"
puts open(fn).read.strip
end
target :clean_more do
verbose_rm_rf("build")
Works.invoke_subdirs(PRE_DIRS, "clean")
Works.invoke_subdir("tools/idl2", "clean")
Works.invoke_subdirs(MORE_DIRS, "clean")
end
target :clean do
verbose_rm_rf("build")
Works.invoke_subdirs(PRE_DIRS, "clean")
Works.invoke_subdir("tools/idl2", "clean")
Works.invoke_subdirs(MAIN_DIRS, "clean")
end
target :clean_examples do
Works.invoke_subdirs_ex(true, EXAM_DIRS, "clean")
end
target :clean_all => :clean do
Works.invoke_subdirs_ex(true, LIB_DIRS, "clean")
Works.invoke_subdirs_ex(true, EXAM_DIRS, "clean")
end
target :check_libs => :base do
Works.invoke_subdirs(PIPE_DIRS)
Works.invoke_subdir_ex(true, 'libs/MAStd') unless(USE_NEWLIB)
Works.invoke_subdir_ex(true, 'libs/newlib') if(USE_NEWLIB)
Works.invoke_subdir_ex(true, 'libs/MAUtil')
end
target :check => :check_libs do
Works.invoke_subdirs(MORE_DIRS)
Works.invoke_subdir_ex(true, 'testPrograms/gcc-torture')
end
# non-native only. don't modify; used by build system.
def all_configs(target)
Works.invoke_subdir('.', target)
Works.invoke_subdir('.', target, 'CONFIG=debug')
Works.invoke_subdir('.', target, 'USE_NEWLIB=')
Works.invoke_subdir('.', target, 'CONFIG=debug', 'USE_NEWLIB=')
end
def bb10_configs(target)
Works.invoke_subdir('.', target, 'MODE=bb10', 'BB10_ARCH=arm')
Works.invoke_subdir('.', target, 'MODE=bb10', 'BB10_ARCH=x86')
Works.invoke_subdir('.', target, 'MODE=bb10', 'BB10_ARCH=arm', 'CONFIG=debug')
Works.invoke_subdir('.', target, 'MODE=bb10', 'BB10_ARCH=x86', 'CONFIG=debug')
end
target :all_configs do
all_configs('')
end
target :all_libs do
all_configs('libs')
end
target :all_check do
all_configs('check_libs')
all_configs('check')
end
target :bb10_libs do
bb10_configs('libs')
end
target :all_ex do
all_configs('examples')
end
target :bb10_ex do
bb10_configs('examples')
end
Works.run