-#!/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
-rm -rf ./extlibs/tinycbor/tinycbor/.git*
+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 [[ "$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`
+ # Prepare mbedTLS dependency
+ $SHELL ./extlibs/mbedtls/prep.sh
+fi
+
+# Prepare TinyCBOR dependency
+$SHELL ./extlibs/tinycbor/prep.sh
# Initialize Git repositoryㅣ
if [ ! -d .git ]; then
git commit -m "Initial commit"
fi
-withtcp=0
-withcloud=0
-withproxy=0
-if [ "WITH_TCP" = "$1" ] || [ "WITH_TCP" = "$2" ] || [ "WITH_TCP" = "$3" ];then
- withtcp=1
-fi
-if [ "WITH_CLOUD" = "$1" ] || [ "WITH_CLOUD" = "$2" ] || [ "WITH_CLOUD" = "$3" ];then
- withcloud=1
-fi
-if [ "WITH_PROXY" = "$1" ] || [ "WITH_PROXY" = "$2" ] || [ "WITH_PROXY" = "$3" ];then
- withproxy=1
-fi
-
echo "Calling core gbs build command"
-gbscommand="gbs build -A armv7l --define 'WITH_TCP $withtcp' --define 'WITH_CLOUD $withcloud' --define 'WITH_PROXY $withproxy' -B ~/GBS-ROOT-OIC --include-all --repository ./"
echo $gbscommand
if eval $gbscommand; then
echo "Build is successful"