-
Notifications
You must be signed in to change notification settings - Fork 7
/
Rakefile
executable file
·166 lines (139 loc) · 4.39 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
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
task :default => :build
def has_distcc
if ENV['DISABLE_DISTCC']
false
else
system("which distcc")
end
end
def has_ccache
system('which ccache')
end
def compiler_prefix
if has_ccache
"ccache "
elsif has_distcc
"distcc "
else
""
end
end
def cmake_cmd(arch)
marvell_cc = "/usr/local/arm/arm-marvell-linux-gnueabi/bin/arm-linux-gcc"
marvell_cxx = "/usr/local/arm/arm-marvell-linux-gnueabi/bin/arm-linux-g++"
arm_cc = "/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-linux-gcc"
arm_cxx = "/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-linux-g++"
if arch == :arm
"CC='#{compiler_prefix}#{arm_cc}' CXX='#{compiler_prefix}#{arm_cxx}' cmake "
elsif arch == :marvell
"CC='#{compiler_prefix}#{marvell_cc}' CXX='#{compiler_prefix}#{marvell_cxx}' cmake "
elsif arch == :x86
"CC='#{compiler_prefix}gcc' CXX='#{compiler_prefix}g++' cmake "
else
raise "Invalid machine type: #{arch}"
end
end
def make_cmd(arch)
if has_distcc
"make -j18"
else
"make -j5"
end
end
desc "Update submodules from repository"
task :update do
sh "git submodule update --init --recursive"
end
desc "Remove the build directory."
task :clean do
sh 'rm -rf build' # Remove compilation targets and cmake output.
end
directory "build/arm"
directory "build/x86"
directory "build/marvell"
task :shared_env do
if has_distcc
ENV['CCACHE_PREFIX'] = 'distcc'
end
end
task :arm_env do
path = ENV['PATH']
ENV['PATH'] = "/opt/onyx/arm/bin:/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/:#{path}"
ENV['ONYX_SDK_ROOT'] = '/opt/onyx/arm'
ENV['PKG_CONFIG_PATH'] = '/opt/onyx/arm/lib/pkgconfig/'
ENV['QMAKESPEC'] = '/opt/onyx/arm/mkspecs/qws/linux-arm-g++/'
end
task :marvell_env do
path = ENV['PATH']
ENV['PATH'] = "/opt/onyx/arm/bin:/usr/local/arm/arm-marvell-linux-gnueabi/bin:#{path}"
ENV['ONYX_SDK_ROOT'] = '/opt/onyx/arm'
ENV['PKG_CONFIG_PATH'] = '/opt/onyx/arm/lib/pkgconfig/'
ENV['QMAKESPEC'] = '/opt/onyx/arm/mkspecs/qws/linux-arm-g++/'
end
namespace :config do
namespace :x86 do
task :static => ["build/x86", :shared_env] do
sh "cd build/x86 && #{cmake_cmd :x86} -DONYX_BUILD_STATIC_LIB:BOOL=ON ../.."
end
task :default => ["build/x86", :shared_env] do
sh "cd build/x86 && #{cmake_cmd :x86} ../.."
end
end
namespace :arm do
task :static => [:shared_env, :arm_env, "build/arm"] do
sh "cd build/arm && #{cmake_cmd :arm} -DONYX_BUILD_STATIC_LIB:BOOL=ON -DBUILD_FOR_ARM:BOOL=ON ../.."
end
task :default => [:shared_env, :arm_env, "build/arm"] do
sh "cd build/arm && #{cmake_cmd :arm} -DBUILD_FOR_ARM:BOOL=ON ../.."
end
end
task :marvell => [:shared_env, :marvell_env, "build/marvell"]do
sh "cd build/marvell && #{cmake_cmd :marvell} -DBUILD_FOR_ARM:BOOL=ON ../.."
end
end
namespace :build do
namespace :x86 do
desc "Build the SDK (x86)."
task :sdk => "config:x86:static" do
sh "cd build/x86 && #{make_cmd :x86} -C sdk_readonly"
end
desc "Build all packages."
task :all => "config:x86:default" do
sh "cd build/x86 && #{make_cmd :x86} -j12"
end
end
namespace :arm do
desc "Build the ARM version of the SDK."
task :sdk => ["config:arm:static", :arm_env] do
sh "cd build/arm && #{make_cmd :arm} -C sdk_readonly"
end
desc "Build the ARM version of all packages."
task :all => ["config:arm:default", :arm_env] do
sh "cd build/arm && #{make_cmd :arm}"
end
end
task :marvell => ["config:marvell", :marvell_env] do
sh "cd build/marvell && #{make_cmd :marvell}"
end
desc "Build the SDK (x86 and arm)"
task :sdk => ["build:x86:sdk", "build:arm:sdk"]
end
desc "Build all packages (native compiling)."
task :build => "build:x86:all"
desc "Run all tests."
task :test => :build do
sh "killall -q -9 Xvfb || true"
sh "cd build/x86 && xvfb-run -a -w 3 make test"
end
languages = [:en_US, :fr_FR, :de_DE, :de_DE, :zh_CN, :zh_TW, :fi_FI, :es_ES, :it_IT,
:pl_PL, :sv_SE, :nl_NL, :ru_RU, :gr_GR, :ja_JP, :he_IL, :el_GR, :ko_KR,
:pt_PT, :pl_PL, :hu_HU, :he_IL, :nb_NO]
ts_files = languages.map {|lang| "translations/onyx_#{lang}.ts"}
desc "Update translation files."
task :lupdate do
sh "lupdate -recursive . -ts #{ts_files.join ' '}"
end
desc "Generate pm files"
task :lrelease do
sh "lrelease #{ts_files.join ' '}"
end