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