Imported Upstream version 0.9.1
[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
29 echo $TARGET_TRANSPORT
30 echo $BUILD_SAMPLE
31
32 rm -rf $name-$version
33
34 builddir=`pwd`
35 sourcedir=`pwd`
36
37 echo `pwd`
38
39 mkdir ./tmp
40 mkdir ./tmp/con/
41 cp -R $cur_dir/* $sourcedir/tmp/con
42 cp -R $cur_dir/SConscript $sourcedir/tmp/con
43 cp -R $cur_dir/src/ip_adapter/SConscript $sourcedir/tmp/con/src/ip_adapter/
44 cp -R $cur_dir/src/bt_le_adapter/SConscript $sourcedir/tmp/con/src/bt_le_adapter/
45 cp -R $cur_dir/src/bt_edr_adapter/SConscript $sourcedir/tmp/con/src/bt_edr_adapter/
46 cp -R $cur_dir/common/SConscript $sourcedir/tmp/con/common/
47 cp -R $cur_dir/lib/libcoap-4.1.1/SConscript $sourcedir/tmp/con/lib/libcoap-4.1.1/
48 cp -R $cur_dir/samples/tizen/ $sourcedir/tmp/con/sample/
49 mkdir -p $sourcedir/tmp/con/sample/lib/tizen/ble/libs
50 cp -R $cur_dir/lib/tizen/ble/libs/* $sourcedir/tmp/con/sample/lib/tizen/ble/libs/
51
52 cd $sourcedir
53 cd $cur_dir/build/tizen
54
55 cp -R ./* $sourcedir/tmp/
56 rm -f $sourcedir/tmp/SConscript
57 cp SConstruct $sourcedir/tmp/
58 cp scons/SConscript $sourcedir/tmp/scons/
59
60 mkdir -p $sourcedir/tmp/iotivityconfig
61 cd $sourcedir/build_common/
62 cp -R ./iotivityconfig/* $sourcedir/tmp/iotivityconfig/
63 cp -R ./SConscript $sourcedir/tmp/
64
65 cd $sourcedir/tmp
66
67 echo `pwd`
68
69 whoami
70 # Initialize Git repository
71 if [ ! -d .git ]; then
72    git init ./
73    git config user.email "you@example.com"
74    git config user.name "Your Name"
75    git add ./
76    git commit -m "Initial commit"
77 fi
78
79 echo "Calling core gbs build command"
80 gbscommand="gbs build -A armv7l --include-all --define 'TARGET_TRANSPORT $1' --define 'SECURED $2' --define 'RELEASE $4' --define 'LOGGING $5' --repository ./"
81 echo $gbscommand
82 if eval $gbscommand; then
83    echo "Core build is successful"
84 else
85    echo "Core build failed. Try 'sudo find . -type f -exec dos2unix {} \;' in the 'connectivity/' folder"
86    cd $sourcedir
87    rm -rf $sourcedir/tmp
88    exit
89 fi
90
91 if echo $BUILD_SAMPLE|grep -qi '^ON$'; then
92    cd con/sample
93    echo `pwd`
94    # Initialize Git repository
95    if [ ! -d .git ]; then
96       git init ./
97       git config user.email "you@example.com"
98       git config user.name "Your Name"
99       git add ./
100       git commit -m "Initial commit"
101    fi
102    echo "Calling sample gbs build command"
103    gbscommand="gbs build -A armv7l --include-all --define 'TARGET_TRANSPORT $1' --define 'SECURED $2' --define 'LOGGING $5' --repository ./"
104    echo $gbscommand
105    if eval $gbscommand; then
106       echo "Sample build is successful"
107    else
108       echo "Sample build is failed. Try 'sudo find . -type f -exec dos2unix {} \;' in the 'connectivity/' folder"
109    fi
110 else
111         echo "Sample build is not enabled"
112 fi
113
114
115 cd $sourcedir
116 rm -rf $sourcedir/tmp
117