Enable auto connect while calling bt_gatt_connect
[platform/upstream/iotivity.git] / build-im-sc-ios.sh
1 #!/bin/bash
2
3 ###### Please specify below ######
4 CLEAN_CMD="scons -c"
5 BUILD_CMD="scons TARGET_OS=ios TARGET_ARCH=arm64 TARGET_TRANSPORT=IP WITH_TCP=yes WITH_CLOUD=yes MULTIPLE_OWNER=0 SECURED=1 LOGGING=1 RELEASE=1"
6 REMOVE_CMD="rm -rf out"
7 REMOVE_THIRDPARTY_CMD="rm service/third_party_libs.scons"
8 CONF_CMD=""
9 SPEC_CMD=""
10 BOOST_BUILD_CMD="chmod 755 extlibs/boost/boost_ios.sh; extlibs/boost/boost_ios.sh"
11
12 # For Git
13 CLONE_CMD="git clone http://suprem.sec.samsung.net/gerrit/IoTivity samsung_iotivity"
14 FETCH_CMD="git fetch -p"
15 CHECKOUT_CMD="git checkout -f "
16 CHERRYPICK_PREFIX="git fetch http://suprem.sec.samsung.net/gerrit/IoTivity"
17 CHERRYPICK_CMD="git cherry-pick FETCH_HEAD"
18
19 msg_hello()
20 {
21     echo "***********************************************************************"
22     echo "*                                                                     *"
23     echo "*                         IoTivity Build Start.                       *"
24     echo "*                                                                     *"
25     echo "***********************************************************************"
26 }
27
28 msg_error()
29 {
30     echo ---------------------------------------------------------------------
31     echo "Fail to Build, Check Last Step. [$_STEP]"
32     echo ---------------------------------------------------------------------
33     exit 2
34 }
35
36 error_check()
37 {
38     if [ $? != 0 ]
39     then
40        msg_error
41     fi
42 }
43
44 # Check commit_info
45 _STEP=COMMIT
46 if [ "" = "$1" ];then
47     msg_error
48 fi
49 COMMIT_ID=$(awk '/^commit_id:/{print $2}' "$1")
50 echo COMMIT ID is $COMMIT_ID
51 error_check
52 if [ 0 == ${#COMMIT_ID} ];then
53     msg_error
54 fi
55
56 # Cherry pick_info
57 _STEP=CHERRYPICK
58 CHERRYPICK_ID=$(awk '/^cherrypick_cmd_id:/{print $5}' "$1")
59 for cherry_pic_arr in $CHERRYPICK_ID
60 do
61     echo CHERRY_PICK_ID is $cherry_pic_arr
62     error_check
63 done
64
65 # Check Source Code
66 _STEP=INIT
67 msg_hello
68 if [ ! -d resource/csdk ];then
69     if [ ! -d samsung_iotivity ];then
70         echo $CLONE_CMD
71         $CLONE_CMD
72         error_check
73     fi
74     cd ./samsung_iotivity
75 fi
76 error_check
77
78 _STEP=FETCH
79 echo $FETCH_CMD
80 $FETCH_CMD
81 error_check
82
83 _STEP=CLEAN
84 if [ -d out ]; then
85     echo $REMOVE_THIRDPARTY_CMD
86     $REMOVE_THIRDPARTY_CMD
87     echo $CLEAN_CMD
88     $CLEAN_CMD
89     error_check
90     echo $REMOVE_CMD
91     $REMOVE_CMD
92     error_check
93 fi
94
95 _STEP=CHECKOUT
96 echo $CHECKOUT_CMD $COMMIT_ID
97 $CHECKOUT_CMD $COMMIT_ID
98 error_check
99
100 _STEP=CHERRYPICK
101 for arr_cherry_pick_cmd in $CHERRYPICK_ID; do
102     echo $CHERRYPICK_PREFIX $arr_cherry_pick_cmd
103     $CHERRYPICK_PREFIX $arr_cherry_pick_cmd
104     error_check
105     echo $CHERRYPICK_CMD
106     $CHERRYPICK_CMD
107     error_check
108 done
109
110
111 _STEP=CONF
112 echo $CONF_CMD
113 $CONF_CMD
114 echo $SPEC_CMD
115 $SPEC_CMD
116 error_check
117
118 _STEP=BOOST_BUILD
119 echo $BOOST_BUILD_CMD
120 eval $BOOST_BUILD_CMD
121 error_check
122
123 _STEP=BUILD
124 echo $BUILD_CMD
125 $BUILD_CMD
126 error_check