Merge remote-tracking branch 'origin/notification-service'
[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/gtest $sourcedir/tmp/extlibs
34 cp -R ./extlibs/tinydtls $sourcedir/tmp/extlibs
35 cp -LR ./extlibs/sqlite3 $sourcedir/tmp/extlibs
36 cp -R ./extlibs/timer $sourcedir/tmp/extlibs
37 cp -R ./extlibs/rapidxml $sourcedir/tmp/extlibs
38 cp -R ./resource $sourcedir/tmp
39 cp -R ./service $sourcedir/tmp
40 cp ./extra_options.scons $sourcedir/tmp
41 cp ./tools/tizen/*.spec ./tmp/packaging
42 cp ./tools/tizen/*.manifest ./tmp/packaging
43 cp ./SConstruct ./tmp
44 cp ./LICENSE.md ./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
52 cp -R $sourcedir/iotivity.pc.in $sourcedir/tmp
53
54 cd $sourcedir/tmp
55
56 echo `pwd`
57 rm -rf ./extlibs/tinycbor/tinycbor/.git*
58
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 -B ~/GBS-ROOT-OIC --include-all --repository ./"
70 echo $gbscommand
71 if eval $gbscommand; then
72     echo "Build is successful"
73 else
74     echo "Build failed!"
75     exit 1
76 fi
77
78 rm -rf tmp
79 cd $sourcedir
80 rm -rf $sourcedir/tmp
81
82 exit 0