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