target_os = env.get('TARGET_OS')
root_dir = env.get('SRC_DIR')
mbedtls_dir = os.path.join(root_dir, 'extlibs','mbedtls','mbedtls/')
-libs_list = ['libmbedcrypto','libmbedtls','libmbedx509']
-
-def run(cmd):
- """Run a command and decipher the return code. Exit by default."""
- res = os.system(cmd)
- # Assumes that if a process doesn't call exit, it was successful
- if (os.WIFEXITED(res)):
- code = os.WEXITSTATUS(res)
- if code != 0:
- print "Error: return code: " + str(code)
- if SCons.Script.keep_going_on_error == 0:
- sys.exit(code)
-
if not os.path.exists(mbedtls_dir):
print '''
'''
Exit(1)
#Apply patch to enable TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256 ciphersuite and server identity hint
-start_dir = os.getcwd()
-os.chdir(mbedtls_dir)
-cmd = 'git reset --hard ad249f509fd62a3bbea7ccd1fef605dbd482a7bd && git apply ../ocf.patch'
-run(cmd)
-os.chdir(start_dir)
+#For tizen platform patch is applied by gbsbuild script
+if target_os != 'tizen':
+ start_dir = os.getcwd()
+ os.chdir(mbedtls_dir)
+ cmd = 'git reset --hard ad249f509fd62a3bbea7ccd1fef605dbd482a7bd && git apply ../ocf.patch'
+ os.system(cmd)
+ os.chdir(start_dir)
mbedtls_env = env.Clone()
mbedtls_env.AppendUnique(LIBS = ['mbedx509', 'mbedcrypto'])
static_libmbedtls = mbedtls_env.StaticLibrary('mbedtls', mbedtls_src)
mbedtls_env.InstallTarget(static_libmbedtls, 'mbedtls')
-
rm -rf $sourcedir/tmp/extlibs/tinycbor/tinycbor/.git
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
cd $sourcedir/tmp
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
rm -rf ./extlibs/tinycbor/tinycbor/.git*
+
# Initialize Git repository
if [ ! -d .git ]; then
git init ./
git commit -m "Initial commit"
fi
+withtcp=0
+withcloud=0
+if [ "WITH_TCP" = "$1" ] || [ "WITH_TCP" = "$2" ];then
+ withtcp=1
+fi
+if [ "WITH_CLOUD" = "$1" ] || [ "WITH_CLOUD" = "$2" ];then
+ withcloud=1
+fi
+
echo "Calling core gbs build command"
-gbscommand="gbs build -A armv7l -B ~/GBS-ROOT-OIC --include-all --repository ./"
+gbscommand="gbs build -A armv7l --define 'WITH_TCP $withtcp' --define 'WITH_CLOUD $withcloud' -B ~/GBS-ROOT-OIC --include-all --repository ./"
echo $gbscommand
if eval $gbscommand; then
echo "Build is successful"
exit 1
fi
+
rm -rf tmp
cd $sourcedir
rm -rf $sourcedir/tmp
if ca_os == 'android':
lib_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libconnectivity_abstraction.so'])
+
if ca_os in ['android', 'tizen']:
lib_env.AppendUnique(LIBS = ['coap'])
if lib_env.get('SECURED') == '1':
lib_env.AppendUnique(LIBS = ['timer'])
if ca_os != 'android':
lib_env.AppendUnique(LIBS = ['rt'])
+ if ((lib_env.get('SECURED') == '1') and ((lib_env.get('WITH_TCP')) or (lib_env.get('WITH_CLOUD')))):
+ lib_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
calib = lib_env.SharedLibrary('connectivity_abstraction', env.get('CA_SRC'))
elif ca_os in ['msys_nt', 'windows']:
lib_env.AppendUnique(LIBS = ['coap', 'mswsock', 'ws2_32', 'iphlpapi', 'logger'])
scons -j2 --prefix=%{_prefix} \
VERBOSE=%{VERBOSE} \
TARGET_OS=tizen TARGET_ARCH=%{RPM_ARCH} TARGET_TRANSPORT=%{TARGET_TRANSPORT} \
- RELEASE=%{RELEASE} SECURED=%{SECURED} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \
+ RELEASE=%{RELEASE} SECURED=%{SECURED} WITH_TCP=%{WITH_TCP} WITH_CLOUD=%{WITH_CLOUD} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \
ES_TARGET_ENROLLEE=%{ES_TARGET_ENROLLEE} LIB_INSTALL_DIR=%{_libdir}
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ;
scons install --install-sandbox=%{buildroot} --prefix=%{_prefix} \
TARGET_OS=tizen TARGET_ARCH=%{RPM_ARCH} TARGET_TRANSPORT=%{TARGET_TRANSPORT} \
- RELEASE=%{RELEASE} SECURED=%{SECURED} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \
+ RELEASE=%{RELEASE} SECURED=%{SECURED} WITH_TCP=%{WITH_TCP} WITH_CLOUD=%{WITH_CLOUD} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \
ES_TARGET_ENROLLEE=%{ES_TARGET_ENROLLEE} LIB_INSTALL_DIR=%{_libdir}