aed61458c49eabbe33eb718506f44fafa1975dd8
[contrib/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 BUILD_SAMPLE=$2
18
19 echo $TARGET_TRANSPORT
20 echo $BUILD_SAMPLE
21
22 rm -rf $name-$version
23
24 builddir=`pwd`
25 sourcedir=`pwd`
26
27 echo `pwd`
28
29 mkdir ./tmp
30 mkdir ./tmp/con/
31 cp -R $cur_dir/* $sourcedir/tmp/con
32 cp -R $cur_dir/SConscript $sourcedir/tmp/con
33 cp -R $cur_dir/src/ip_adapter/SConscript $sourcedir/tmp/con/src/ip_adapter/
34 cp -R $cur_dir/src/bt_le_adapter/SConscript $sourcedir/tmp/con/src/bt_le_adapter/
35 cp -R $cur_dir/src/bt_edr_adapter/SConscript $sourcedir/tmp/con/src/bt_edr_adapter/
36 cp -R $cur_dir/common/SConscript $sourcedir/tmp/con/common/
37 cp -R $cur_dir/lib/libcoap-4.1.1/SConscript $sourcedir/tmp/con/lib/libcoap-4.1.1/
38 cp -R $cur_dir/samples/tizen/ $sourcedir/tmp/con/sample/
39 mkdir -p $sourcedir/tmp/con/sample/lib/tizen/ble/libs
40 cp -R $cur_dir/lib/tizen/ble/libs/* $sourcedir/tmp/con/sample/lib/tizen/ble/libs/
41
42 mkdir -p $sourcedir/tmp/iotivityconfig
43 cd $sourcedir/build_common/
44 cp -R ./iotivityconfig/* $sourcedir/tmp/iotivityconfig/
45 cp -R ./SConscript $sourcedir/tmp/
46
47 cd $sourcedir
48 cd $cur_dir/build/tizen
49
50 cp -R ./* $sourcedir/tmp/
51 cp SConscript $sourcedir/tmp/
52 cp SConstruct $sourcedir/tmp/
53 cp scons/SConscript $sourcedir/tmp/scons/
54 cd $sourcedir/tmp
55
56 echo `pwd`
57
58 whoami
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 --include-all --define 'TARGET_TRANSPORT $1' --define 'RELEASE $3'"
70 echo $gbscommand
71 if eval $gbscommand; then
72    echo "Core build is successful"
73 else
74    echo "Core build failed. Try 'sudo find . -type f -exec dos2unix {} \;' in the 'connectivity/' folder"
75    cd $sourcedir
76    rm -rf $sourcedir/tmp
77    exit
78 fi
79
80 if echo $BUILD_SAMPLE|grep -qi '^ON$'; then
81    cd con/sample
82    echo `pwd`
83    # Initialize Git repository
84    if [ ! -d .git ]; then
85       git init ./
86       git config user.email "you@example.com"
87       git config user.name "Your Name"
88       git add ./
89       git commit -m "Initial commit"
90    fi
91    echo "Calling sample gbs build command"
92    gbscommand="gbs build -A armv7l --include-all --define 'TARGET_TRANSPORT $1'"
93    echo $gbscommand
94    if eval $gbscommand; then
95       echo "Sample build is successful"
96    else
97       echo "Sample build is failed. Try 'sudo find . -type f -exec dos2unix {} \;' in the 'connectivity/' folder"
98    fi
99 fi
100
101
102 cd $sourcedir
103 rm -rf $sourcedir/tmp
104