Merge "Fixed server crash on empty client payload"
[platform/upstream/iotivity.git] / auto_build.sh
1 #! /bin/bash
2
3 function clean()
4 {
5         echo "*********** Clean build *************"
6         scons -c
7         rm -rf out
8 }
9
10 function build()
11 {
12         if [ $(uname -s) = "Linux" ]
13         then
14                 echo "*********** Build for linux *************"
15                 scons RELEASE=$3
16         fi
17
18         # Note: for android, as oic-resource uses C++11 feature stoi and to_string,
19         # it requires gcc-4.9, currently only android-ndk-r10(for linux)
20         # and windows android-ndk-r10(64bit target version) support these features.
21
22         echo "*********** Build for android x86 *************"
23         scons TARGET_OS=android TARGET_ARCH=x86 ANDROID_NDK=$1 RELEASE=$3
24
25         echo "*********** Build for android armeabi *************"
26         scons TARGET_OS=android TARGET_ARCH=armeabi ANDROID_NDK=$1 RELEASE=$3
27
28         echo "*********** Build for android armeabi-v7a *************"
29         scons TARGET_OS=android TARGET_ARCH=armeabi-v7a ANDROID_NDK=$1 RELEASE=$3
30
31         echo "*********** Build for android armeabi-v7a-hard *************"
32         scons TARGET_OS=android TARGET_ARCH=armeabi-v7a-hard ANDROID_NDK=$1 RELEASE=$3
33
34         echo "*********** Build for arduino avr *************"
35         scons TARGET_OS=arduino TARGET_ARCH=avr ARDUINO_HOME=$2 RELEASE=$3
36
37         echo "*********** Build for arduino arm *************"
38         scons TARGET_OS=arduino TARGET_ARCH=arm ARDUINO_HOME=$2 RELEASE=$3
39
40         if [ $(uname -s) = "Darwin" ]
41         then
42                 echo "*********** Build for OSX *************"
43                 scons TARGET_OS=darwin SYS_VERSION=10.9 RELEASE=$3
44
45                 echo "*********** Build for IOS i386 *************"
46                 scons TARGET_OS=ios TARGET_ARCH=i386 SYS_VERSION=7.0 RELEASE=$3
47
48                 echo "*********** Build for IOS x86_64 *************"
49                 scons TARGET_OS=ios TARGET_ARCH=x86_64 SYS_VERSION=7.0 RELEASE=$3
50
51                 echo "*********** Build for IOS armv7 *************"
52                 scons TARGET_OS=ios TARGET_ARCH=armv7 SYS_VERSION=7.0 RELEASE=$3
53
54                 echo "*********** Build for IOS armv7s *************"
55                 scons TARGET_OS=ios TARGET_ARCH=armv7s SYS_VERSION=7.0 RELEASE=$3
56
57                 echo "*********** Build for IOS arm64 *************"
58                 scons TARGET_OS=ios TARGET_ARCH=arm64 SYS_VERSION=7.0 RELEASE=$3
59         fi
60 }
61
62 function  help()
63 {
64         echo "Usage:"
65         echo "  build:"
66         echo "     `basename $0` <path-to-android-ndk> <path-to-arduino-home>"
67         echo "  clean:"
68         echo "     `basename $0` -c"
69 }
70
71 if [ $# -eq 1 ]
72 then
73         if [ $1 = '-c' ]
74         then
75                 clean
76                 exit 0
77         else
78                 help
79                 exit -1
80         fi
81 elif [ $# -ne 2 ]
82 then
83         help
84         exit -1
85 fi
86
87 # Suppress "Reading ..." message and enable parallel build
88 export SCONSFLAGS="-Q -j 8"
89 build $1 $2 true
90 build $1 $2 false
91 echo "===================== done ====================="