3 # Ideally we will capture the exit code of each step and try them all before failing
4 # the build script. For now, use set -e and fail the build at first failure.
7 # maybe overridden in user's shell
12 if [ $(uname -s) = "Linux" ]
14 build_linux_unsecured $1 $2
15 build_linux_secured $1 $2
16 build_linux_unsecured_with_ra $1 $2
17 build_linux_secured_with_ra $1 $2
18 build_linux_unsecured_with_rm $1 $2
19 build_linux_unsecured_with_rd $1 $2
20 build_linux_secured_with_rd $1 $2
30 if [ $(uname -s) = "Darwin" ]
36 function build_linux()
38 build_linux_unsecured $1 $2
40 build_linux_secured $1 $2
43 function build_linux_unsecured()
45 echo "*********** Build for linux ************"
46 scons VERBOSE="$VERBOSE" RELEASE=$1 $2
49 function build_linux_unsecured_with_rm()
51 echo "*********** Build for linux with RoutingManager************"
52 scons VERBOSE="$VERBOSE" ROUTING=GW RELEASE=$1 $2
55 function build_linux_secured()
57 echo "*********** Build for linux with Security *************"
58 scons VERBOSE="$VERBOSE" RELEASE=$1 SECURED=1 $2
61 function build_linux_unsecured_with_ra()
64 echo "*********** Build for linux With Remote Access *************"
65 scons VERBOSE="$VERBOSE" RELEASE=$1 WITH_RA=1 WITH_RA_IBB=1 $2
68 function build_linux_secured_with_ra()
70 echo "*********** Build for linux With Remote Access & Security ************"
71 scons VERBOSE="$VERBOSE" RELEASE=$1 WITH_RA=1 WITH_RA_IBB=1 SECURED=1 $2
74 function build_linux_unsecured_with_rd()
76 echo "*********** Build for linux With Resource Directory *************"
77 scons VERBOSE="$VERBOSE" RELEASE=$1 WITH_RD=1 $2
80 function build_linux_secured_with_rd()
82 echo "*********** Build for linux With Resource Directory & Security ************"
83 scons VERBOSE="$VERBOSE" RELEASE=$1 WITH_RD=1 SECURED=1 $2
86 function build_android()
88 # Note: for android, as oic-resource uses C++11 feature stoi and to_string,
89 # it requires gcc-4.9, currently only android-ndk-r10(for linux)
90 # and windows android-ndk-r10(64bit target version) support these features.
92 build_android_x86 $1 $2
93 build_android_x86_with_rm $1 $2
94 build_android_armeabi $1 $2
95 build_android_armeabi_with_rm $1 $2
98 function build_android_x86()
100 echo "*********** Build for android x86 *************"
101 scons VERBOSE="$VERBOSE" TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=IP $2
102 scons VERBOSE="$VERBOSE" TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=BT $2
103 scons VERBOSE="$VERBOSE" TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=BLE $2
106 function build_android_x86_with_rm()
108 echo "*********** Build for android x86 with Routing Manager *************"
109 scons VERBOSE="$VERBOSE" TARGET_OS=android TARGET_ARCH=x86 ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=IP $2
110 scons VERBOSE="$VERBOSE" TARGET_OS=android TARGET_ARCH=x86 ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BT $2
111 scons VERBOSE="$VERBOSE" TARGET_OS=android TARGET_ARCH=x86 ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BLE $2
114 function build_android_armeabi()
116 echo "*********** Build for android armeabi *************"
117 scons VERBOSE="$VERBOSE" TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=IP $2
118 scons VERBOSE="$VERBOSE" TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=BT $2
119 scons VERBOSE="$VERBOSE" TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=BLE $2
122 function build_android_armeabi_with_rm()
124 echo "*********** Build for android armeabi with Routing Manager*************"
125 scons VERBOSE="$VERBOSE" TARGET_OS=android TARGET_ARCH=armeabi ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=IP $2
126 scons VERBOSE="$VERBOSE" TARGET_OS=android TARGET_ARCH=armeabi ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BT $2
127 scons VERBOSE="$VERBOSE" TARGET_OS=android TARGET_ARCH=armeabi ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BLE $2
130 function build_arduino()
132 echo "*********** Build for arduino avr *************"
133 scons VERBOSE="$VERBOSE" resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=IP SHIELD=ETH RELEASE=$1 $2
134 scons VERBOSE="$VERBOSE" resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=IP SHIELD=WIFI RELEASE=$1 $2
135 scons VERBOSE="$VERBOSE" resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=BLE SHIELD=RBL_NRF8001 RELEASE=$1 $2
137 echo "*********** Build for arduino arm *************"
138 scons VERBOSE="$VERBOSE" resource TARGET_OS=arduino UPLOAD=false BOARD=arduino_due_x TARGET_ARCH=arm TARGET_TRANSPORT=IP SHIELD=ETH RELEASE=$1 $2
139 scons VERBOSE="$VERBOSE" resource TARGET_OS=arduino UPLOAD=false BOARD=arduino_due_x TARGET_ARCH=arm TARGET_TRANSPORT=IP SHIELD=WIFI RELEASE=$1 $2
140 # BLE support for the Arduino Due is currently unavailable.
143 function build_tizen()
145 echo "*********** Build for Tizen *************"
148 echo "*********** Build for Tizen octbstack lib and sample *************"
149 scons VERBOSE="$VERBOSE" -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true RELEASE=$1 $2
151 echo "*********** Build for Tizen octbstack lib and sample with Security*************"
152 scons VERBOSE="$VERBOSE" -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true SECURED=1 RELEASE=$1 $2
154 echo "*********** Build for Tizen octbstack lib and sample with Routing Manager*************"
155 scons VERBOSE="$VERBOSE" -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true ROUTING=GW RELEASE=$1 $2
158 function build_darwin() # Mac OSx and iOS
160 echo "*********** Build for OSX *************"
161 scons VERBOSE="$VERBOSE" TARGET_OS=darwin SYS_VERSION=10.9 RELEASE=$1 $2
163 echo "*********** Build for IOS i386 *************"
164 scons VERBOSE="$VERBOSE" TARGET_OS=ios TARGET_ARCH=i386 SYS_VERSION=7.0 RELEASE=$1 $2
166 echo "*********** Build for IOS x86_64 *************"
167 scons VERBOSE="$VERBOSE" TARGET_OS=ios TARGET_ARCH=x86_64 SYS_VERSION=7.0 RELEASE=$1 $2
169 echo "*********** Build for IOS armv7 *************"
170 scons VERBOSE="$VERBOSE" TARGET_OS=ios TARGET_ARCH=armv7 SYS_VERSION=7.0 RELEASE=$1 $2
172 echo "*********** Build for IOS armv7s *************"
173 scons VERBOSE="$VERBOSE" TARGET_OS=ios TARGET_ARCH=armv7s SYS_VERSION=7.0 RELEASE=$1 $2
175 echo "*********** Build for IOS arm64 *************"
176 scons VERBOSE="$VERBOSE" TARGET_OS=ios TARGET_ARCH=arm64 SYS_VERSION=7.0 RELEASE=$1 $2
179 function build_simulator()
181 echo "*********** Build for simulator plugin *************"
182 scons VERBOSE="$VERBOSE" SIMULATOR=1 RELEASE=$1 $2
185 function unit_tests()
187 echo "*********** Unit test Start *************"
188 scons VERBOSE="$VERBOSE" resource RELEASE=false -c
189 scons VERBOSE="$VERBOSE" resource LOGGING=false RELEASE=false
190 scons VERBOSE="$VERBOSE" resource TEST=1 RELEASE=false
191 echo "*********** Unit test Stop *************"
198 echo " `basename $0` <target_build>"
199 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, simulator darwin"
200 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\"."
201 echo " Any selection will build both debug and release versions of all available targets in the scope you've"
202 echo " selected. To choose any specific command, please use the SCons commandline directly. Please refer"
203 echo " to [IOTIVITY_REPO]/Readme.scons.txt."
205 echo " `basename $0` -c"
208 # Suppress "Reading ..." message and enable parallel build
209 export SCONSFLAGS="-Q -j 4"
223 elif [ $1 = 'linux' ]
227 elif [ $1 = 'linux_unsecured' ]
229 build_linux_unsecured true
230 build_linux_unsecured false
231 build_linux_unsecured_with_rm true
232 build_linux_unsecured_with_rm false
233 elif [ $1 = 'linux_secured' ]
235 build_linux_secured true
236 build_linux_secured false
237 elif [ $1 = 'linux_unsecured_with_ra' ]
239 build_linux_unsecured_with_ra true
240 build_linux_unsecured_with_ra false
241 elif [ $1 = 'linux_secured_with_ra' ]
243 build_linux_secured_with_ra true
244 build_linux_secured_with_ra false
245 elif [ $1 = 'linux_unsecured_with_rd' ]
247 build_linux_unsecured_with_rd true
248 build_linux_unsecured_with_rd false
249 elif [ $1 = 'linux_secured_with_rd' ]
251 build_linux_secured_with_rd true
252 build_linux_secured_with_rd false
253 elif [ $1 = 'android' ]
257 elif [ $1 = 'android_x86' ]
259 build_android_x86 true
260 build_android_x86 false
261 build_android_x86_with_rm true
262 build_android_x86_with_rm false
263 elif [ $1 = 'android_armeabi' ]
265 build_android_armeabi true
266 build_android_armeabi false
267 build_android_armeabi_with_rm true
268 build_android_armeabi_with_rm false
269 elif [ $1 = 'arduino' ]
273 elif [ $1 = 'tizen' ]
277 elif [ $1 = 'simulator' ]
280 build_simulator false
281 elif [ $1 = 'darwin' ]
285 elif [ $1 = 'unit_tests' ]
302 echo "===================== done ====================="