b00216ebd67a8242beecf182a39b704421aa9994
[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
34 cp -R ./extlibs/cjson $sourcedir/tmp/extlibs
35 cp -R ./extlibs/mbedtls $sourcedir/tmp/extlibs
36 cp -R ./extlibs/gtest $sourcedir/tmp/extlibs
37 cp -LR ./extlibs/sqlite3 $sourcedir/tmp/extlibs
38 cp -R ./extlibs/timer $sourcedir/tmp/extlibs
39 cp -R ./extlibs/rapidxml $sourcedir/tmp/extlibs
40 cp -R ./extlibs/libcoap $sourcedir/tmp/extlibs
41 cp -R ./resource $sourcedir/tmp
42 cp -R ./service $sourcedir/tmp
43 cp ./extra_options.scons $sourcedir/tmp
44 cp ./tools/tizen/*.spec ./tmp/packaging
45 cp ./tools/tizen/*.manifest ./tmp/packaging
46 cp ./SConstruct ./tmp
47 cp ./LICENSE.md ./tmp
48
49 # copy dependency RPMs and conf files for tizen build
50 cp ./tools/tizen/*.rpm ./tmp
51 cp ./tools/tizen/.gbs.conf ./tmp
52 cp ./tools/tizen/*.rpm $sourcedir/tmp/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample
53 cp ./tools/tizen/.gbs.conf ./tmp/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample
54
55 cp -R $sourcedir/iotivity.pc.in $sourcedir/tmp
56
57 cd $sourcedir/tmp
58
59 echo `pwd`
60 # Prepare mbedTLS dependency
61 $SHELL ./extlibs/mbedtls/prep.sh
62
63 # Prepare TinyCBOR dependency
64 $SHELL ./extlibs/tinycbor/prep.sh
65
66 # Build IoTivity
67 # Initialize Git repository
68 if [ ! -d .git ]; then
69    git init ./
70    git config user.email "you@example.com"
71    git config user.name "Your Name"
72    git add ./
73    git commit -m "Initial commit"
74 fi
75
76 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"
77 echo "Calling core gbs build command"
78 gbscommand="gbs build -A armv7l -B ~/GBS-ROOT-OIC $buildoption --include-all --repository ./"
79 echo $gbscommand
80 if eval $gbscommand; then
81    echo "Core build is successful"
82 else
83    echo "Core build failed."
84    cd $sourcedir
85    rm -rf $sourcedir/tmp
86    exit 1
87 fi
88
89 # Build Enrollee Sample App
90 cd service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample
91 echo `pwd`
92 # Initialize Git repository
93 if [ ! -d .git ]; then
94   git init ./
95   git config user.email "you@example.com"
96   git config user.name "Your Name"
97   git add ./
98   git commit -m "Initial commit"
99 fi
100 echo "Calling sample gbs build command"
101 gbscommand="gbs build -A armv7l -B ~/GBS-ROOT-OIC $buildoption --include-all --repository ./"
102 echo $gbscommand
103 if eval $gbscommand; then
104   echo "Sample build is successful"
105 else
106   echo "Sample build is failed."
107   exit 1
108 fi
109 rm -rf tmp
110 cd $sourcedir
111 rm -rf $sourcedir/tmp
112
113 exit 0