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