Development of CoAP-HTTP Proxy
[platform/upstream/iotivity.git] / resource / csdk / stack / samples / tizen / build / gbsbuild.sh
1 #!/bin/sh
2
3 spec=`ls ./resource/csdk/stack/samples/tizen/build/packaging/*.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=oicri
10
11 echo $1
12 export TARGET_TRANSPORT=$1
13
14 echo $2
15 export SECURED=$2
16
17 echo $3
18 export BUILD_SAMPLE=$3
19
20 echo $4
21 export RELEASE=$4
22
23 echo $5
24 export LOGGING=$5
25
26 echo $6
27 export ROUTING=$6
28
29 echo $7
30 export WITH_TCP=$7
31
32 echo $8
33 export WITH_PROXY=$8
34
35 echo $TARGET_TRANSPORT
36 echo $BUILD_SAMPLE
37
38 rm -rf $name-$version
39
40 builddir=`pwd`
41 sourcedir=`pwd`
42
43 echo `pwd`
44
45 rm -rf ./tmp
46 mkdir ./tmp
47 mkdir ./tmp/extlibs/
48 mkdir ./tmp/packaging
49 cp -LR ./extlibs/tinycbor $sourcedir/tmp/extlibs
50 rm -rf $sourcedir/tmp/extlibs/tinycbor/tinycbor/.git
51 cp -R ./extlibs/cjson $sourcedir/tmp/extlibs
52 cp -R ./extlibs/tinydtls $sourcedir/tmp/extlibs
53 cp -R ./extlibs/timer $sourcedir/tmp/extlibs
54 cp -R ./extlibs/rapidxml $sourcedir/tmp/extlibs
55 cp -LR ./extlibs/sqlite3 $sourcedir/tmp/extlibs
56 cp -R ./resource/csdk/stack/samples/tizen/build/packaging/*.spec $sourcedir/tmp/packaging
57 cp -R ./resource $sourcedir/tmp/
58 cp -R ./build_common/external_libs.scons $sourcedir/tmp/
59 mkdir -p $sourcedir/tmp/build_common/
60 cp -a ./build_common/*.scons $sourcedir/tmp/build_common/
61
62 # copy dependency RPMs and conf files for tizen build
63 cp ./tools/tizen/*.rpm $sourcedir/tmp
64 cp ./tools/tizen/*.rpm $sourcedir/tmp/resource/csdk/stack/samples/tizen/SimpleClientServer
65 cp ./tools/tizen/.gbs.conf ./tmp
66 cp ./tools/tizen/.gbs.conf ./tmp/resource/csdk/stack/samples/tizen/SimpleClientServer
67
68 cd $sourcedir
69 cd ./resource/csdk/stack/samples/tizen/build/
70
71 cp -R ./* $sourcedir/tmp/
72 rm -f $sourcedir/tmp/SConscript
73 cp SConstruct $sourcedir/tmp/
74 cp scons/SConscript $sourcedir/tmp/scons/
75
76 mkdir -p $sourcedir/tmp/iotivityconfig
77 cd $sourcedir/build_common/
78 cp -R ./iotivityconfig/* $sourcedir/tmp/iotivityconfig/
79 cp -R ./SConscript $sourcedir/tmp/
80
81 cp -R $sourcedir/iotivity.pc.in $sourcedir/tmp/
82
83 cd $sourcedir/tmp
84
85 echo `pwd`
86
87 whoami
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
97 echo "Calling core gbs build command"
98 gbscommand="gbs build -A armv7l -B ~/GBS-ROOT-RI-OIC --include-all --repository ./ --define 'TARGET_TRANSPORT $1' --define 'SECURED $2' --define 'RELEASE $4' --define 'LOGGING $5' --define 'ROUTING $6' --define 'WITH_TCP $7' --define 'WITH_PROXY $8'"
99 echo $gbscommand
100 if eval $gbscommand; then
101    echo "Core build is successful"
102 else
103    echo "Core build failed. Try 'find . -type f -exec dos2unix {} \;' in the 'connectivity/' folder"
104    cd $sourcedir
105    rm -rf $sourcedir/tmp
106    exit 1
107 fi
108
109 if echo $BUILD_SAMPLE|grep -qi '^ON$'; then
110    cd resource/csdk/stack/samples/tizen/SimpleClientServer
111    echo `pwd`
112    # Initialize Git repository
113    if [ ! -d .git ]; then
114       git init ./
115       git config user.email "you@example.com"
116       git config user.name "Your Name"
117       git add ./
118       git commit -m "Initial commit"
119    fi
120    echo "Calling sample gbs build command"
121    gbscommand="gbs build -A armv7l -B ~/GBS-ROOT-RI-OIC --include-all --repository ./ --define 'TARGET_TRANSPORT $1' --define 'SECURED $2' --define 'RELEASE $4' --define 'LOGGING $5' --define 'ROUTING $6' --define 'WITH_TCP $7' --define 'WITH_PROXY $8'"
122    echo $gbscommand
123    if eval $gbscommand; then
124       echo "Sample build is successful"
125    else
126       echo "Sample build is failed. Try 'find . -type f -exec dos2unix {} \;' in the 'connectivity/' folder"
127       exit 1
128    fi
129 else
130         echo "Sample build is not enabled"
131 fi
132
133 cd $sourcedir
134 rm -rf $sourcedir/tmp
135
136 exit 0