#! /bin/bash
+# Ideally we will capture the exit code of each step and try them all before failing
+# the build script. For now, use set -e and fail the build at first failure.
+set -e
+
function clean()
{
echo "*********** Clean build *************"
# it requires gcc-4.9, currently only android-ndk-r10(for linux)
# and windows android-ndk-r10(64bit target version) support these features.
- echo "*********** Build for android x86 *************"
- scons TARGET_OS=android TARGET_ARCH=x86 ANDROID_NDK=$1 RELEASE=$3
+ if [ "$BUILD_FOR_ANDROID" = "true" ]
+ then
+
+ echo "*********** Build for android x86 *************"
+ scons TARGET_OS=android TARGET_ARCH=x86 ANDROID_NDK=$1 RELEASE=$3
- echo "*********** Build for android armeabi *************"
- scons TARGET_OS=android TARGET_ARCH=armeabi ANDROID_NDK=$1 RELEASE=$3
+ echo "*********** Build for android armeabi *************"
+ scons TARGET_OS=android TARGET_ARCH=armeabi ANDROID_NDK=$1 RELEASE=$3
- echo "*********** Build for android armeabi-v7a *************"
- scons TARGET_OS=android TARGET_ARCH=armeabi-v7a ANDROID_NDK=$1 RELEASE=$3
+ echo "*********** Build for android armeabi-v7a *************"
+ scons TARGET_OS=android TARGET_ARCH=armeabi-v7a ANDROID_NDK=$1 RELEASE=$3
- echo "*********** Build for android armeabi-v7a-hard *************"
- scons TARGET_OS=android TARGET_ARCH=armeabi-v7a-hard ANDROID_NDK=$1 RELEASE=$3
+ echo "*********** Build for android armeabi-v7a-hard *************"
+ scons TARGET_OS=android TARGET_ARCH=armeabi-v7a-hard ANDROID_NDK=$1 RELEASE=$3
+ fi
echo "*********** Build for arduino avr *************"
scons TARGET_OS=arduino TARGET_ARCH=avr ARDUINO_HOME=$2 RELEASE=$3
target_arch = env.get('TARGET_ARCH')
src_dir = env.get('SRC_DIR')
-# Add 'OIC_UTILS' build option for user to set oic-utilities project path
-if target_os not in ['linux', 'darwin', 'arduino']:
- default_dir = os.environ.get('OIC_UTILS')
- if not default_dir:
- default_dir = os.path.abspath(src_dir + '/../oic-utilities')
- else:
- default_dir = os.path.abspath(default_dir)
-
- if not os.path.exists(default_dir):
- default_dir = None
-
- help_vars = Variables()
- help_vars.Add(PathVariable('OIC_UTILS', 'oic-utilities project path', default_dir))
- help_vars.Update(env)
- Help(help_vars.GenerateHelpText(env))
-
- utils_path = env.get('OIC_UTILS', default_dir)
- if utils_path:
- utils_path = os.path.abspath(utils_path)
-
- if not utils_path or not os.path.exists(utils_path):
- print '''
-*********************************** Error: ************************************
-* oic-utilities project directory isn't set properly, please set enviornment*
-* variable OIC_UTILS or set it in command line: *
-* # scons OIC_UTILS=<path to oic-utilities> ... *
-*******************************************************************************
-'''
- Exit(1)
-
if target_os == 'arduino':
# Add 'NET' build option, let user select board network connection type
vars = Variables()
coap_block_t rcvdBlock2;
memset(&rcvdBlock1, COAP_BLOCK_FILL_VALUE, sizeof(coap_block_t));
memset(&rcvdBlock2, COAP_BLOCK_FILL_VALUE, sizeof(coap_block_t));
- size_t rcvdSize1 = 0;
+ uint16_t rcvdSize1 = 0;
coap_pdu_t * rcvdPdu = rcvdRequest->pdu;
coap_pdu_t * sendPdu = NULL;
coap_send_flags_t sendFlag;
target_arch = env.get('TARGET_ARCH')
src_dir = env.get('SRC_DIR')
-if target_os not in ['linux', 'darwin']:
- utils_path = env.get('OIC_UTILS')
######################################################################
# Check dependent packages (Linux only)
conf.Finish()
-######################################################################
-# The 'include' path of third party libraries
-######################################################################
-if target_os == 'android':
- lib_env.AppendUnique(CPPPATH = [utils_path + '/android/boost/include'])
######################################################################
# The path of third party libraries binary
*******************************************************************************
'''
else:
- lib_env.AppendUnique(LIBPATH = [utils_path + '/android/boost/libs/' + target_arch])
# Too much boost warning, suppress the warning
lib_env.AppendUnique(CCFLAGS = ['-w'])
elif target_os == 'ios':
- lib_env.AppendUnique(FRAMEWORKPATH = [utils_path + '/ios/frameworks/'])
lib_env.AppendUnique(FRAMEWORKS = ['boost'])
elif target_os == 'darwin':
lib_env.AppendUnique(CPPPATH = ['/usr/local/include'])
target_arch = env.get('TARGET_ARCH')
src_dir = env.get('SRC_DIR')
-if target_os not in ['linux', 'darwin']:
- utils_path = env.get('OIC_UTILS')
-
resource_path = src_dir + '/resource'
######################################################################
])
######################################################################
-# The 'include' path of third party libraries
-######################################################################
-if target_os == 'android':
- lib_env.AppendUnique(CPPPATH = [
- utils_path + '/android/boost/include',
- utils_path + '/android/expat/include/expat/',
- utils_path + '/android/openssl/include',
- ])
-
-######################################################################
# The path of third party libraries binary
######################################################################
if target_os == 'android':
*******************************************************************************
'''
else:
- lib_env.AppendUnique(LIBPATH = [
- utils_path + '/android/boost/libs/' + target_arch,
- utils_path + '/android/expat/lib/' + target_arch,
- utils_path + '/android/openssl/lib/' + target_arch,
- ])
# Too much boost warning, suppress the warning
lib_env.AppendUnique(CCFLAGS = ['-w'])
elif target_os == 'ios':
- lib_env.AppendUnique(FRAMEWORKPATH = [utils_path + '/ios/frameworks/'])
lib_env.AppendUnique(FRAMEWORKS = ['boost', 'expat', 'openssl'])
elif target_os == 'darwin':
lib_env.AppendUnique(CPPPATH = ['/usr/local/include'])