[IOT-1511] Update mbedTLS to use 2.4.0 release tagged version
[platform/upstream/iotivity.git] / service / easy-setup / sampleapp / enrollee / tizen-sdb / EnrolleeSample / build / tizen / gbsbuild.sh
1 #!/bin/sh
2
3 cur_dir="./service/easy-setup"
4 spec=`ls ./service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/packaging/*.spec`
5 version=`rpm --query --queryformat '%{version}\n' --specfile $spec`
6
7 name=`echo $name|cut -d" " -f 1`
8 version=`echo $version|cut -d" " -f 1`
9
10 name=iotivity
11
12 rm -rf $name-$version
13
14 builddir=`pwd`
15 sourcedir=`pwd`
16
17 echo `pwd`
18
19 # Clean tmp directory.
20 rm -rf ./tmp
21
22 # Create directory structure for GBS Build
23 mkdir ./tmp
24 mkdir ./tmp/con/
25 mkdir ./tmp/extlibs/
26 mkdir ./tmp/packaging
27 mkdir ./tmp/logger
28 cp -R ./build_common $sourcedir/tmp
29 cp -R ./examples $sourcedir/tmp
30
31 # tinycbor is available as soft-link, so copying with 'dereference' option.
32 cp -LR ./extlibs/tinycbor $sourcedir/tmp/extlibs
33 rm -rf $sourcedir/tmp/extlibs/tinycbor/tinycbor/.git
34
35 cp -R ./extlibs/cjson $sourcedir/tmp/extlibs
36 cp -R ./extlibs/mbedtls $sourcedir/tmp/extlibs
37 cp -R ./extlibs/gtest $sourcedir/tmp/extlibs
38 cp -R ./extlibs/tinydtls $sourcedir/tmp/extlibs
39 cp -LR ./extlibs/sqlite3 $sourcedir/tmp/extlibs
40 cp -R ./extlibs/timer $sourcedir/tmp/extlibs
41 cp -R ./extlibs/rapidxml $sourcedir/tmp/extlibs
42 cp -R ./extlibs/libcoap $sourcedir/tmp/extlibs
43 cp -R ./resource $sourcedir/tmp
44 cp -R ./service $sourcedir/tmp
45 cp ./extra_options.scons $sourcedir/tmp
46 cp ./tools/tizen/*.spec ./tmp/packaging
47 cp ./tools/tizen/*.manifest ./tmp/packaging
48 cp ./SConstruct ./tmp
49 cp ./LICENSE.md ./tmp
50
51 # copy dependency RPMs and conf files for tizen build
52 cp ./tools/tizen/*.rpm ./tmp
53 cp ./tools/tizen/.gbs.conf ./tmp
54 cp ./tools/tizen/*.rpm $sourcedir/tmp/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample
55 cp ./tools/tizen/.gbs.conf ./tmp/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample
56
57 cp -R $sourcedir/iotivity.pc.in $sourcedir/tmp
58
59 cd $sourcedir/tmp
60
61 echo `pwd`
62 # Prepare mbedTLS dependency
63 $SHELL ./extlibs/mbedtls/prep.sh
64
65 rm -rf ./extlibs/tinycbor/tinycbor/.git*
66
67 # Build IoTivity
68 # Initialize Git repository
69 if [ ! -d .git ]; then
70    git init ./
71    git config user.email "you@example.com"
72    git config user.name "Your Name"
73    git add ./
74    git commit -m "Initial commit"
75 fi
76
77 buildoption="--define 'TARGET_TRANSPORT '$1 --define 'SECURED '$2 --define 'ROUTING '$3 --define 'RELEASE '$4 --define 'LOGGING '$5 --define 'ES_TARGET_ENROLLEE '$6 --define 'WITH_TCP '$7 --define 'WITH_CLOUD '$8" 
78 echo "Calling core gbs build command"
79 gbscommand="gbs build -A armv7l -B ~/GBS-ROOT-OIC $buildoption --include-all --repository ./"
80 echo $gbscommand
81 if eval $gbscommand; then
82    echo "Core build is successful"
83 else
84    echo "Core build failed."
85    cd $sourcedir
86    rm -rf $sourcedir/tmp
87    exit 1
88 fi
89
90 # Build Enrollee Sample App
91 cd service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample
92 echo `pwd`
93 # Initialize Git repository
94 if [ ! -d .git ]; then
95   git init ./
96   git config user.email "you@example.com"
97   git config user.name "Your Name"
98   git add ./
99   git commit -m "Initial commit"
100 fi
101 echo "Calling sample gbs build command"
102 gbscommand="gbs build -A armv7l -B ~/GBS-ROOT-OIC $buildoption --include-all --repository ./"
103 echo $gbscommand
104 if eval $gbscommand; then
105   echo "Sample build is successful"
106 else
107   echo "Sample build is failed."
108   exit 1
109 fi
110 rm -rf tmp
111 cd $sourcedir
112 rm -rf $sourcedir/tmp
113
114 exit 0