Android Base API merge to master
[platform/upstream/iotivity.git] / resource / csdk / connectivity / build / tizen / gbsbuild.sh
1 #!/bin/sh
2
3 spec=`ls build/tizen/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=oicca
10
11 echo $1
12 export TARGET_TRANSPORT=$1
13
14 echo $2
15 export BUILD_SAMPLE=$2
16
17 echo $TARGET_TRANSPORT
18 echo $BUILD_SAMPLE
19
20 rm -rf $name-$version
21
22 builddir=`pwd`
23 sourcedir=`pwd`
24
25 echo `pwd`
26
27 mkdir ./tmp
28 mkdir ./tmp/con/
29 cp -R ./* $sourcedir/tmp/con
30 cp -R ./SConscript $sourcedir/tmp/con
31 cp -R ./src/wifi_adapter/SConscript $sourcedir/tmp/con/src/wifi_adapter/
32 cp -R ./src/bt_le_adapter/SConscript $sourcedir/tmp/con/src/bt_le_adapter/
33 cp -R ./src/bt_edr_adapter/SConscript $sourcedir/tmp/con/src/bt_edr_adapter/
34 cp -R ./common/SConscript $sourcedir/tmp/con/common/
35 cp -R ./lib/libcoap-4.1.1/SConscript $sourcedir/tmp/con/lib/libcoap-4.1.1/
36 cp -R ./samples/tizen/ $sourcedir/tmp/con/sample/
37 mkdir -p $sourcedir/tmp/con/sample/lib/tizen/ble/libs
38 cp -R ./lib/tizen/ble/libs/* $sourcedir/tmp/con/sample/lib/tizen/ble/libs/
39
40 cd $sourcedir/build/tizen
41
42 cp -R ./* $sourcedir/tmp/
43 cp SConscript $sourcedir/tmp/
44 cp SConstruct $sourcedir/tmp/
45 cp scons/SConscript $sourcedir/tmp/scons/
46 cd $sourcedir/tmp
47
48 echo `pwd`
49
50 whoami
51 # Initialize Git repository
52 if [ ! -d .git ]; then
53    git init ./
54    git config user.email "you@example.com"
55    git config user.name "Your Name"
56    git add ./
57    git commit -m "Initial commit"
58 fi
59
60 echo "Calling core gbs build command"
61 gbscommand="gbs build -A armv7l --include-all --define 'TARGET_TRANSPORT $1' --define 'RELEASE $3'"
62 echo $gbscommand
63 if eval $gbscommand; then
64    echo "Core build is successful"
65 else
66    echo "Core build failed. Try 'sudo find . -type f -exec dos2unix {} \;' in the 'connectivity/' folder"
67    cd $sourcedir
68    rm -rf $sourcedir/tmp
69    exit
70 fi
71
72 if echo $BUILD_SAMPLE|grep -qi '^ON$'; then
73    cd con/sample
74    echo `pwd`
75    # Initialize Git repository
76    if [ ! -d .git ]; then
77       git init ./
78       git config user.email "you@example.com"
79       git config user.name "Your Name"
80       git add ./
81       git commit -m "Initial commit"
82    fi
83    echo "Calling sample gbs build command"
84    gbscommand="gbs build -A armv7l --include-all --define 'TARGET_TRANSPORT $1'"
85    echo $gbscommand
86    if eval $gbscommand; then
87       echo "Sample build is successful"
88    else
89       echo "Sample build is failed. Try 'sudo find . -type f -exec dos2unix {} \;' in the 'connectivity/' folder"
90    fi
91 fi
92
93
94 cd $sourcedir
95 rm -rf $sourcedir/tmp
96