forked from mandeepshetty/iotivity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto_build.sh
executable file
·294 lines (253 loc) · 9.12 KB
/
auto_build.sh
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
#! /bin/bash
# Ideally we will capture the exit code of each step and try them all before failing
# the build script. For now, use set -e and fail the build at first failure.
set -e
function build_all()
{
if [ $(uname -s) = "Linux" ]
then
build_linux_unsecured $1 $2
build_linux_secured $1 $2
build_linux_unsecured_with_ra $1 $2
build_linux_secured_with_ra $1 $2
build_linux_unsecured_with_rm $1 $2
build_linux_unsecured_with_rd $1 $2
build_linux_secured_with_rd $1 $2
fi
build_android $1 $2
build_arduino $1 $2
build_tizen $1 $2
if [ $(uname -s) = "Darwin" ]
then
build_darwin $1 $2
fi
}
function build_linux()
{
build_linux_unsecured $1 $2
build_linux_secured $1 $2
}
function build_linux_unsecured()
{
echo "*********** Build for linux ************"
scons RELEASE=$1 $2
}
function build_linux_unsecured_with_rm()
{
echo "*********** Build for linux with RoutingManager************"
scons ROUTING=GW RELEASE=$1 $2
}
function build_linux_secured()
{
echo "*********** Build for linux with Security *************"
scons RELEASE=$1 SECURED=1 $2
}
function build_linux_unsecured_with_ra()
{
echo "*********** Build for linux With Remote Access *************"
scons RELEASE=$1 WITH_RA=1 WITH_RA_IBB=1 $2
}
function build_linux_secured_with_ra()
{
echo "*********** Build for linux With Remote Access & Security ************"
scons RELEASE=$1 WITH_RA=1 WITH_RA_IBB=1 SECURED=1 $2
}
function build_linux_unsecured_with_rd()
{
echo "*********** Build for linux With Resource Directory *************"
scons RELEASE=$1 WITH_RD=1 $2
}
function build_linux_secured_with_rd()
{
echo "*********** Build for linux With Resource Directory & Security ************"
scons RELEASE=$1 WITH_RD=1 SECURED=1 $2
}
function build_android()
{
# Note: for android, as oic-resource uses C++11 feature stoi and to_string,
# it requires gcc-4.9, currently only android-ndk-r10(for linux)
# and windows android-ndk-r10(64bit target version) support these features.
build_android_x86 $1 $2
build_android_x86_with_rm $1 $2
build_android_armeabi $1 $2
build_android_armeabi_with_rm $1 $2
}
function build_android_x86()
{
echo "*********** Build for android x86 *************"
scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=IP $2
scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=BT $2
scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=BLE $2
}
function build_android_x86_with_rm()
{
echo "*********** Build for android x86 with Routing Manager *************"
scons TARGET_OS=android TARGET_ARCH=x86 ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=IP $2
scons TARGET_OS=android TARGET_ARCH=x86 ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BT $2
scons TARGET_OS=android TARGET_ARCH=x86 ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BLE $2
}
function build_android_armeabi()
{
echo "*********** Build for android armeabi *************"
scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=IP $2
scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=BT $2
scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=BLE $2
}
function build_android_armeabi_with_rm()
{
echo "*********** Build for android armeabi with Routing Manager*************"
scons TARGET_OS=android TARGET_ARCH=armeabi ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=IP $2
scons TARGET_OS=android TARGET_ARCH=armeabi ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BT $2
scons TARGET_OS=android TARGET_ARCH=armeabi ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BLE $2
}
function build_arduino()
{
echo "*********** Build for arduino avr *************"
scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=IP SHIELD=ETH RELEASE=$1 $2
scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=IP SHIELD=WIFI RELEASE=$1 $2
scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=BLE SHIELD=RBL_NRF8001 RELEASE=$1 $2
echo "*********** Build for arduino arm *************"
scons resource TARGET_OS=arduino UPLOAD=false BOARD=arduino_due_x TARGET_ARCH=arm TARGET_TRANSPORT=IP SHIELD=ETH RELEASE=$1 $2
scons resource TARGET_OS=arduino UPLOAD=false BOARD=arduino_due_x TARGET_ARCH=arm TARGET_TRANSPORT=IP SHIELD=WIFI RELEASE=$1 $2
# BLE support for the Arduino Due is currently unavailable.
}
function build_tizen()
{
echo "*********** Build for Tizen *************"
./gbsbuild.sh
echo "*********** Build for Tizen CA lib and sample *************"
scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true RELEASE=$1 $2
echo "*********** Build for Tizen CA lib and sample with Security *************"
scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true SECURED=1 RELEASE=$1 $2
echo "*********** Build for Tizen octbstack lib and sample *************"
scons -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true RELEASE=$1 $2
echo "*********** Build for Tizen octbstack lib and sample with Security*************"
scons -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true SECURED=1 RELEASE=$1 $2
echo "*********** Build for Tizen octbstack lib and sample with Routing Manager*************"
scons -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true ROUTING=GW RELEASE=$1 $2
}
function build_darwin() # Mac OSx and iOS
{
echo "*********** Build for OSX *************"
scons TARGET_OS=darwin SYS_VERSION=10.9 RELEASE=$1 $2
echo "*********** Build for IOS i386 *************"
scons TARGET_OS=ios TARGET_ARCH=i386 SYS_VERSION=7.0 RELEASE=$1 $2
echo "*********** Build for IOS x86_64 *************"
scons TARGET_OS=ios TARGET_ARCH=x86_64 SYS_VERSION=7.0 RELEASE=$1 $2
echo "*********** Build for IOS armv7 *************"
scons TARGET_OS=ios TARGET_ARCH=armv7 SYS_VERSION=7.0 RELEASE=$1 $2
echo "*********** Build for IOS armv7s *************"
scons TARGET_OS=ios TARGET_ARCH=armv7s SYS_VERSION=7.0 RELEASE=$1 $2
echo "*********** Build for IOS arm64 *************"
scons TARGET_OS=ios TARGET_ARCH=arm64 SYS_VERSION=7.0 RELEASE=$1 $2
}
function unit_tests()
{
echo "*********** Unit test Start *************"
scons resource RELEASE=false -c
scons resource LOGGING=false RELEASE=false
scons resource TEST=1 RELEASE=false
echo "*********** Unit test Stop *************"
}
function help()
{
echo "Usage:"
echo " build:"
echo " `basename $0` <target_build>"
echo " Allowed values for <target_build>: all, linux_unsecured, linux_secured, linux_unsecured_with_ra, linux_secured_with_ra, linux_unsecured_with_rd, linux_secured_with_rd, android, arduino, tizen, darwin"
echo " Note: \"linux\" will build \"linux_unsecured\", \"linux_secured\", \"linux_unsecured_with_ra\", \"linux_secured_with_ra\", \"linux_secured_with_rd\" & \"linux_unsecured_with_rd\"."
echo " Any selection will build both debug and release versions of all available targets in the scope you've"
echo " selected. To choose any specific command, please use the SCons commandline directly. Please refer"
echo " to [IOTIVITY_REPO]/Readme.scons.txt."
echo " clean:"
echo " `basename $0` -c"
}
# Suppress "Reading ..." message and enable parallel build
export SCONSFLAGS="-Q -j 4"
if [ $# -eq 1 ]
then
if [ $1 = '-c' ]
then
build_all true $1
build_all false $1
exit 0
elif [ $1 = 'all' ]
then
build_all true
build_all false
unit_tests
elif [ $1 = 'linux' ]
then
build_linux true
build_linux false
elif [ $1 = 'linux_unsecured' ]
then
build_linux_unsecured true
build_linux_unsecured false
build_linux_unsecured_with_rm true
build_linux_unsecured_with_rm false
elif [ $1 = 'linux_secured' ]
then
build_linux_secured true
build_linux_secured false
elif [ $1 = 'linux_unsecured_with_ra' ]
then
build_linux_unsecured_with_ra true
build_linux_unsecured_with_ra false
elif [ $1 = 'linux_secured_with_ra' ]
then
build_linux_secured_with_ra true
build_linux_secured_with_ra false
elif [ $1 = 'linux_unsecured_with_rd' ]
then
build_linux_unsecured_with_rd true
build_linux_unsecured_with_rd false
elif [ $1 = 'linux_secured_with_rd' ]
then
build_linux_secured_with_rd true
build_linux_secured_with_rd false
elif [ $1 = 'android' ]
then
build_android true
build_android false
elif [ $1 = 'android_x86' ]
then
build_android_x86 true
build_android_x86 false
build_android_x86_with_rm true
build_android_x86_with_rm false
elif [ $1 = 'android_armeabi' ]
then
build_android_armeabi true
build_android_armeabi false
build_android_armeabi_with_rm true
build_android_armeabi_with_rm false
elif [ $1 = 'arduino' ]
then
build_arduino true
build_arduino false
elif [ $1 = 'tizen' ]
then
build_tizen true
build_tizen false
elif [ $1 = 'darwin' ]
then
build_darwin true
build_darwin false
elif [ $1 = 'unit_tests' ]
then
unit_tests
else
help
exit -1
fi
elif [ $# -eq 0 ]
then
build_all true
build_all false
unit_tests
else
help
exit -1
fi
echo "===================== done ====================="