Imported Upstream version 1.1.0
[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
5 spec=`ls ./service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/packaging/*.spec`
6 version=`rpm --query --queryformat '%{version}\n' --specfile $spec`
7
8 name=`echo $name|cut -d" " -f 1`
9 version=`echo $version|cut -d" " -f 1`
10
11 name=iotivity
12
13 rm -rf $name-$version
14
15 builddir=`pwd`
16 sourcedir=`pwd`
17
18 echo `pwd`
19
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 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/tinydtls $sourcedir/tmp/extlibs
36 cp -R ./extlibs/sqlite3 $sourcedir/tmp/extlibs
37 cp -R ./extlibs/timer $sourcedir/tmp/extlibs
38 cp -R ./extlibs/rapidxml $sourcedir/tmp/extlibs
39 cp -R ./resource $sourcedir/tmp
40 cp -R ./service $sourcedir/tmp
41 cp ./extra_options.scons $sourcedir/tmp
42 cp ./tools/tizen/*.spec ./tmp/packaging
43 cp ./tools/tizen/*.manifest ./tmp/packaging
44 cp ./SConstruct ./tmp
45 cp ./LICENSE.md ./tmp
46
47 # copy dependency RPMs and conf files for tizen build
48 cp ./tools/tizen/*.rpm ./tmp
49 cp ./tools/tizen/.gbs.conf ./tmp
50 cp ./tools/tizen/*.rpm $sourcedir/tmp/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample
51 cp ./tools/tizen/.gbs.conf ./tmp/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample
52 cp -R $sourcedir/iotivity.pc.in $sourcedir/tmp
53
54 cd $sourcedir/tmp
55
56 echo `pwd`
57
58 whoami
59 # Initialize Git repository
60 if [ ! -d .git ]; then
61    git init ./
62    git config user.email "you@example.com"
63    git config user.name "Your Name"
64    git add ./
65    git commit -m "Initial commit"
66 fi
67
68 echo "Calling core gbs build command"
69 gbscommand="gbs build -A armv7l --include-all  --repository ./ --define 'TARGET_TRANSPORT $1' --define 'SECURED $2' --define 'RELEASE $5' --define 'LOGGING $6' --define 'ES_ROLE $7' --define 'ES_TARGET_ENROLLEE $8' --define 'ES_SOFTAP_MODE $9'"
70 echo $gbscommand
71 if eval $gbscommand; then
72    echo "Core build is successful"
73 else
74    echo "Core build failed."
75    cd $sourcedir
76    rm -rf $sourcedir/tmp
77    exit 1
78 fi
79
80 cd service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample
81 echo `pwd`
82 # Initialize Git repository
83 if [ ! -d .git ]; then
84   git init ./
85   git config user.email "you@example.com"
86   git config user.name "Your Name"
87   git add ./
88   git commit -m "Initial commit"
89 fi
90 echo "Calling sample gbs build command"
91 gbscommand="gbs build -A armv7l -B ~/GBS-ROOT --include-all --repository ./ --define 'TARGET_TRANSPORT $1' --define 'SECURED $2' --define 'ROUTING $4' --define 'RELEASE $5' --define 'LOGGING $6' --define 'ES_ROLE $7' --define 'ES_TARGET_ENROLLEE $8' --define 'ES_SOFTAP_MODE $9'"
92 echo $gbscommand
93 if eval $gbscommand; then
94   echo "Sample build is successful"
95 else
96   echo "Sample build is failed."
97   exit 1
98 fi
99 rm -rf tmp
100 cd $sourcedir
101 rm -rf $sourcedir/tmp
102
103 exit 0