-#!/bin/sh
+#!/bin/bash -e
spec=`ls tools/tizen/*.spec`
version=`rpm --query --queryformat '%{version}\n' --specfile $spec`
cp -R ./extlibs/cjson $sourcedir/tmp/extlibs
cp -R ./extlibs/mbedtls $sourcedir/tmp/extlibs
cp -R ./extlibs/gtest $sourcedir/tmp/extlibs
-cp -R ./extlibs/tinydtls $sourcedir/tmp/extlibs
cp -LR ./extlibs/sqlite3 $sourcedir/tmp/extlibs
-cp -R ./extlibs/timer $sourcedir/tmp/extlibs
cp -R ./extlibs/rapidxml $sourcedir/tmp/extlibs
cp -R ./extlibs/libcoap $sourcedir/tmp/extlibs
cp -R ./resource $sourcedir/tmp
cd $sourcedir/tmp
-withtcp=0
-withcloud=0
-withproxy=0
-withmq=OFF
-rdmode=CLIENT
-secured=0
+secured=1
+gbscommand="gbs build -A armv7l "
+nproc=$(expr 1 + $(expr `nproc --ignore=1` / 2 ) )
+gbscommand=$gbscommand" --define '_smp_mflags -j$nproc'"
+
for ARGUMENT_VALUE in $*
do
echo $ARGUMENT_VALUE
- if [ "WITH_TCP" = $ARGUMENT_VALUE ];then
- withtcp=1
- fi
-
- if [ "WITH_CLOUD" = $ARGUMENT_VALUE ];then
- withcloud=1
- fi
-
- if [ "WITH_PROXY" = $ARGUMENT_VALUE ];then
- withproxy=1
- fi
-
- if [ "WITH_MQ" = $ARGUMENT_VALUE ];then
- withmq=PUB,SUB,BROKER
- fi
-
- if [ "RD_MODE" = $ARGUMENT_VALUE ];then
- rdmode=CLIENT,SERVER
- fi
-
- if [ "SECURED" = $ARGUMENT_VALUE ];then
- secured=1
+ if [[ "$ARGUMENT_VALUE" = *"="* ]]; then
+ optionname=$(echo $ARGUMENT_VALUE | cut -f1 -d=)
+ optionvalue=$(echo $ARGUMENT_VALUE | cut -f2 -d=)
+ echo -- "# $optionname $optionvalue"
+ gbscommand=${gbscommand}" --define '$optionname $optionvalue'"
+
+ if [ "SECURED" = "$optionname" ]; then
+ secured=$optionvalue
+ fi
+ else
+ echo "'$ARGUMENT_VALUE' does not contain '='";
fi
done
+gbscommand="${gbscommand} -B ~/GBS-ROOT-OIC --include-all --repository ./"
+
if [ $secured -eq 1 ];then
echo `pwd`
- if [ -d ./extlibs/mbedtls/mbedtls ];then
- cd ./extlibs/mbedtls/mbedtls
- git reset --hard ad249f509fd62a3bbea7ccd1fef605dbd482a7bd ; git apply ../ocf.patch
- cd -
- rm -rf ./extlibs/mbedtls/mbedtls/.git*
-
- else
- echo ""
- echo "*********************************** Error: ****************************************"
- echo "* Please download mbedtls using the following command: *"
- echo "* $ git clone https://github.com/ARMmbed/mbedtls.git extlibs/mbedtls/mbedtls *"
- echo "***********************************************************************************"
- echo ""
- exit
- fi
+ # Prepare mbedTLS dependency
+ $SHELL ./extlibs/mbedtls/prep.sh
fi
-rm -rf ./extlibs/tinycbor/tinycbor/.git*
+# Prepare TinyCBOR dependency
+$SHELL ./extlibs/tinycbor/prep.sh
# Initialize Git repositoryㅣ
if [ ! -d .git ]; then
fi
echo "Calling core gbs build command"
-gbscommand="gbs build -A armv7l --define 'WITH_TCP $withtcp' --define 'WITH_CLOUD $withcloud' --define 'WITH_PROXY $withproxy' --define 'WITH_MQ $withmq' --define 'RD_MODE $rdmode' --define 'SECURED $secured' -B ~/GBS-ROOT-OIC --include-all --repository ./"
echo $gbscommand
if eval $gbscommand; then
echo "Build is successful"