[IOT-1511] Update mbedTLS to use 2.4.0 release tagged version
[platform/upstream/iotivity.git] / resource / csdk / stack / samples / tizen / build / gbsbuild.sh
1 #!/bin/sh
2
3 spec=`ls ./resource/csdk/stack/samples/tizen/build/packaging/*.spec`
4 version=`rpm --query --queryformat '%{version}\n' --specfile $spec`
5
6 name=`echo $name|cut -d" " -f 1`
7 version=`echo $version|cut -d" " -f 1`
8
9 name=oicri
10
11 echo $1
12 export TARGET_TRANSPORT=$1
13
14 echo $2
15 export SECURED=$2
16
17 echo $3
18 export BUILD_SAMPLE=$3
19
20 echo $4
21 export RELEASE=$4
22
23 echo $5
24 export LOGGING=$5
25
26 echo $6
27 export ROUTING=$6
28
29 echo $7
30 export WITH_TCP=$7
31
32 echo $8
33 export WITH_PROXY=$8
34
35 echo $9
36 export WITH_MQ=$9
37
38 echo $TARGET_TRANSPORT
39 echo $BUILD_SAMPLE
40 echo $WITH_MQ
41
42 rm -rf $name-$version
43
44 builddir=`pwd`
45 sourcedir=`pwd`
46
47 echo `pwd`
48
49 rm -rf ./tmp
50 mkdir ./tmp
51 mkdir ./tmp/extlibs/
52 mkdir ./tmp/packaging
53 cp -LR ./extlibs/tinycbor $sourcedir/tmp/extlibs
54 rm -rf $sourcedir/tmp/extlibs/tinycbor/tinycbor/.git
55 cp -Rf ./extlibs/mbedtls $sourcedir/tmp/extlibs
56 cp -R ./extlibs/cjson $sourcedir/tmp/extlibs
57 cp -R ./extlibs/tinydtls $sourcedir/tmp/extlibs
58 cp -R ./extlibs/timer $sourcedir/tmp/extlibs
59 cp -R ./extlibs/rapidxml $sourcedir/tmp/extlibs
60 cp -R ./extlibs/libcoap $sourcedir/tmp/extlibs
61 cp -LR ./extlibs/sqlite3 $sourcedir/tmp/extlibs
62 cp -R ./resource/csdk/stack/samples/tizen/build/packaging/*.spec $sourcedir/tmp/packaging
63 cp -R ./resource $sourcedir/tmp/
64 cp -R ./build_common/external_libs.scons $sourcedir/tmp/
65 mkdir -p $sourcedir/tmp/build_common/
66 cp -a ./build_common/*.scons $sourcedir/tmp/build_common/
67
68 # copy dependency RPMs and conf files for tizen build
69 cp ./tools/tizen/*.rpm $sourcedir/tmp
70 cp ./tools/tizen/*.rpm $sourcedir/tmp/resource/csdk/stack/samples/tizen/SimpleClientServer
71 cp ./tools/tizen/.gbs.conf ./tmp
72 cp ./tools/tizen/.gbs.conf ./tmp/resource/csdk/stack/samples/tizen/SimpleClientServer
73
74 cd $sourcedir
75 cd ./resource/csdk/stack/samples/tizen/build/
76
77 cp -R ./* $sourcedir/tmp/
78 rm -f $sourcedir/tmp/SConscript
79 cp SConstruct $sourcedir/tmp/
80 cp scons/SConscript $sourcedir/tmp/scons/
81
82 mkdir -p $sourcedir/tmp/iotivityconfig
83 cd $sourcedir/build_common/
84 cp -R ./iotivityconfig/* $sourcedir/tmp/iotivityconfig/
85 cp -R ./SConscript $sourcedir/tmp/
86
87 cp -R $sourcedir/iotivity.pc.in $sourcedir/tmp/
88
89 cd $sourcedir/tmp
90
91 echo `pwd`
92 # Prepare mbedTLS dependency
93 $SHELL ./extlibs/mbedtls/prep.sh
94
95 whoami
96 # Initialize Git repository
97 if [ ! -d .git ]; then
98    git init ./
99    git config user.email "you@example.com"
100    git config user.name "Your Name"
101    git add ./
102    git commit -m "Initial commit"
103 fi
104
105 echo "Calling core gbs build command"
106 gbscommand="gbs build -A armv7l -B ~/GBS-ROOT-RI-OIC --include-all --repository ./ --define 'TARGET_TRANSPORT $1' --define 'SECURED $2' --define 'RELEASE $4' --define 'LOGGING $5' --define 'ROUTING $6' --define 'WITH_TCP $7' --define 'WITH_PROXY $8' --define 'WITH_MQ $9'"
107 echo $gbscommand
108 if eval $gbscommand; then
109    echo "Core build is successful"
110 else
111    echo "Core build failed. Try 'find . -type f -exec dos2unix {} \;' in the 'connectivity/' folder"
112    cd $sourcedir
113    rm -rf $sourcedir/tmp
114    exit 1
115 fi
116
117 if echo $BUILD_SAMPLE|grep -qi '^ON$'; then
118    cd resource/csdk/stack/samples/tizen/SimpleClientServer
119    echo `pwd`
120    # Initialize Git repository
121    if [ ! -d .git ]; then
122       git init ./
123       git config user.email "you@example.com"
124       git config user.name "Your Name"
125       git add ./
126       git commit -m "Initial commit"
127    fi
128    echo "Calling sample gbs build command"
129    gbscommand="gbs build -A armv7l -B ~/GBS-ROOT-RI-OIC --include-all --repository ./ --define 'TARGET_TRANSPORT $1' --define 'SECURED $2' --define 'RELEASE $4' --define 'LOGGING $5' --define 'ROUTING $6' --define 'WITH_TCP $7' --define 'WITH_PROXY $8' --define 'WITH_MQ $9'"
130    echo $gbscommand
131    if eval $gbscommand; then
132       echo "Sample build is successful"
133    else
134       echo "Sample build is failed. Try 'find . -type f -exec dos2unix {} \;' in the 'connectivity/' folder"
135       exit 1
136    fi
137 else
138         echo "Sample build is not enabled"
139 fi
140
141 cd $sourcedir
142 rm -rf $sourcedir/tmp
143
144 exit 0