Merge remote-tracking branch 'origin/notification-service'
[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 rm -rf ./tmp
20
21 # Create directory structure for GBS Build
22 mkdir ./tmp
23 mkdir ./tmp/con/
24 mkdir ./tmp/extlibs/
25 mkdir ./tmp/packaging
26 mkdir ./tmp/logger
27 cp -R ./build_common $sourcedir/tmp
28 cp -R ./examples $sourcedir/tmp
29
30 # tinycbor is available as soft-link, so copying with 'dereference' option.
31 cp -LR ./extlibs/tinycbor $sourcedir/tmp/extlibs
32 rm -rf $sourcedir/tmp/extlibs/tinycbor/tinycbor/.git
33
34 cp -R ./extlibs/cjson $sourcedir/tmp/extlibs
35 cp -R ./extlibs/gtest $sourcedir/tmp/extlibs
36 cp -R ./extlibs/tinydtls $sourcedir/tmp/extlibs
37 cp -R ./extlibs/sqlite3 $sourcedir/tmp/extlibs
38 cp -R ./extlibs/timer $sourcedir/tmp/extlibs
39 cp -R ./extlibs/rapidxml $sourcedir/tmp/extlibs
40 cp -R ./resource $sourcedir/tmp
41 cp -R ./service $sourcedir/tmp
42 cp ./extra_options.scons $sourcedir/tmp
43 cp ./tools/tizen/*.spec ./tmp/packaging
44 cp ./tools/tizen/*.manifest ./tmp/packaging
45 cp ./SConstruct ./tmp
46 cp ./LICENSE.md ./tmp
47
48 # copy dependency RPMs and conf files for tizen build
49 cp ./tools/tizen/*.rpm ./tmp
50 cp ./tools/tizen/.gbs.conf ./tmp
51 cp ./tools/tizen/*.rpm $sourcedir/tmp/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample
52 cp ./tools/tizen/.gbs.conf ./tmp/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample
53 cp -R $sourcedir/iotivity.pc.in $sourcedir/tmp
54
55 cd $sourcedir/tmp
56
57 echo `pwd`
58 rm -rf ./extlibs/tinycbor/tinycbor/.git*
59
60 whoami
61
62 # Build IoTivity
63 # Initialize Git repository
64 if [ ! -d .git ]; then
65    git init ./
66    git config user.email "you@example.com"
67    git config user.name "Your Name"
68    git add ./
69    git commit -m "Initial commit"
70 fi
71
72 buildoption="--define 'TARGET_TRANSPORT '$1 --define 'SECURED '$2 --define 'ROUTING '$3 --define 'RELEASE '$4 --define 'LOGGING '$5 --define 'ES_TARGET_ENROLLEE '$6"
73 echo "Calling core gbs build command"
74 gbscommand="gbs build -A armv7l -B ~/GBS-ROOT-OIC $buildoption --include-all --repository ./"
75 echo $gbscommand
76 if eval $gbscommand; then
77    echo "Core build is successful"
78 else
79    echo "Core build failed."
80    cd $sourcedir
81    rm -rf $sourcedir/tmp
82    exit 1
83 fi
84
85 # Build Enrollee Sample App
86 cd service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample
87 echo `pwd`
88 # Initialize Git repository
89 if [ ! -d .git ]; then
90   git init ./
91   git config user.email "you@example.com"
92   git config user.name "Your Name"
93   git add ./
94   git commit -m "Initial commit"
95 fi
96 echo "Calling sample gbs build command"
97 gbscommand="gbs build -A armv7l -B ~/GBS-ROOT-OIC $buildoption --include-all --repository ./"
98 echo $gbscommand
99 if eval $gbscommand; then
100   echo "Sample build is successful"
101 else
102   echo "Sample build is failed."
103   exit 1
104 fi
105 rm -rf tmp
106 cd $sourcedir
107 rm -rf $sourcedir/tmp
108
109 exit 0