Merge branch 'simulator'.
[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
46 # copy dependency RPMs and conf files for tizen build
47 cp ./tools/tizen/*.rpm ./tmp
48 cp ./tools/tizen/.gbs.conf ./tmp
49 cp ./tools/tizen/*.rpm $sourcedir/tmp/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample
50 cp ./tools/tizen/.gbs.conf ./tmp/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample
51 cp -R $sourcedir/iotivity.pc.in $sourcedir/tmp
52
53 cd $sourcedir/tmp
54
55 echo `pwd`
56
57 whoami
58 # Initialize Git repository
59 if [ ! -d .git ]; then
60    git init ./
61    git config user.email "you@example.com"
62    git config user.name "Your Name"
63    git add ./
64    git commit -m "Initial commit"
65 fi
66
67 echo "Calling core gbs build command"
68 gbscommand="gbs build -A armv7l --include-all  --repository ./ --define 'TARGET_TRANSPORT IP' --define 'SECURED 0' --define 'RELEASE 0' --define 'LOGGING true'"
69 echo $gbscommand
70 if eval $gbscommand; then
71    echo "Core build is successful"
72 else
73    echo "Core build failed."
74    cd $sourcedir
75    rm -rf $sourcedir/tmp
76    exit 1
77 fi
78
79 cd service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample
80 echo `pwd`
81 # Initialize Git repository
82 if [ ! -d .git ]; then
83   git init ./
84   git config user.email "you@example.com"
85   git config user.name "Your Name"
86   git add ./
87   git commit -m "Initial commit"
88 fi
89 echo "Calling sample gbs build command"
90 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'"
91 echo $gbscommand
92 if eval $gbscommand; then
93   echo "Sample build is successful"
94 else
95   echo "Sample build is failed."
96   exit 1
97 fi
98 rm -rf tmp
99 cd $sourcedir
100 rm -rf $sourcedir/tmp
101
102 exit 0