Fixes for scan in VD
[platform/upstream/iotivity.git] / build-im-sc-android.sh
1 #!/bin/bash
2
3 ###### Please specify below ######
4 CLEAN_CMD="scons -c"
5 BUILD_CMD="scons TARGET_OS=android TARGET_ARCH=armeabi TARGET_TRANSPORT=IP,BLE WITH_TCP=1 WITH_CLOUD=1 SECURED=1 LOGGING=1 RELEASE=1 ANDROID_HOME=$ANDROID_HOME"
6 CONF_CMD=""
7 SPEC_CMD=""
8
9 # For Git
10 CLONE_CMD="git clone http://suprem.sec.samsung.net/gerrit/IoTivity samsung_iotivity"
11 FETCH_CMD="git fetch -p"
12 CHECKOUT_CMD="git checkout -f "
13
14 msg_hello()
15 {
16     echo "***********************************************************************"
17     echo "*                                                                     *"
18     echo "*                         IoTivity Build Start.                       *"
19     echo "*                                                                     *"
20     echo "***********************************************************************"
21 }
22
23 msg_error()
24 {
25     echo ---------------------------------------------------------------------
26     echo "Fail to Build, Check Last Step. [$_STEP]"
27     echo ---------------------------------------------------------------------
28     exit 2
29 }
30
31 error_check()
32 {
33     if [ $? != 0 ]
34     then
35        msg_error
36     fi
37 }
38
39 # Check commit_info
40 _STEP=COMMIT
41 if [ "" = "$1" ];then
42     msg_error
43 fi
44 COMMIT_ID=$(awk '/^commit_id:/{print $2}' "$1")
45 echo COMMIT ID is $COMMIT_ID
46 error_check
47 if [ 0 == ${#COMMIT_ID} ];then
48     msg_error
49 fi
50
51 # Check Source Code
52 _STEP=INIT
53 msg_hello
54 if [ ! -d resource/csdk ];then
55     if [ ! -d samsung_iotivity ];then
56         echo $CLONE_CMD
57         $CLONE_CMD
58         error_check
59     fi
60     cd ./samsung_iotivity
61 fi
62 error_check
63
64 _STEP=FETCH
65 echo $FETCH_CMD
66 $FETCH_CMD
67 error_check
68
69 _STEP=CHECKOUT
70 echo $CHECKOUT_CMD $COMMIT_ID
71 $CHECKOUT_CMD $COMMIT_ID
72 error_check
73
74 _STEP=CONF
75 echo $CONF_CMD
76 $CONF_CMD
77 echo $SPEC_CMD
78 $SPEC_CMD
79 error_check
80
81 _STEP=CLEAN
82 rm -rf out
83 echo $CLEAN_CMD
84 $CLEAN_CMD
85 error_check
86
87 _STEP=BUILD
88 echo $BUILD_CMD
89 if [ $ANDROID_HOME ];then
90     $BUILD_CMD
91     error_check
92 else
93     echo "Please add ANDROID_HOME in .bashrc file."
94     msg_error
95 fi