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
+withmq=OFF
+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
+done
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 ./"
+gbscommand="gbs build -A armv7l --define 'WITH_TCP $withtcp' --define 'WITH_CLOUD $withcloud' --define 'WITH_PROXY $withproxy' --define 'WITH_MQ $withmq' -B ~/GBS-ROOT-OIC --include-all --repository ./"
echo $gbscommand
if eval $gbscommand; then
echo "Build is successful"
help_vars.Add(EnumVariable('ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP')))
help_vars.Add(EnumVariable('BUILD_SAMPLE', 'Build with sample', 'ON', allowed_values=('ON', 'OFF')))
help_vars.Add(BoolVariable('WITH_TCP', 'Enable TCP', False))
+help_vars.Add(ListVariable('WITH_MQ', 'Build with MQ publisher/subscriber/broker', 'OFF', ['OFF', 'SUB', 'PUB', 'BROKER']))
help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device', 'OIC-DEVICE', None, None),)
help_vars.Add(EnumVariable('SECURED', 'Build with DTLS', '0', allowed_values=('0', '1')))
help_vars.Add(EnumVariable('ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP')))
help_vars.Add(BoolVariable('WITH_PROXY', 'CoAP-HTTP Proxy', False)) # set to 'no', 'false' or 0 for debug
+help_vars.Add(ListVariable('WITH_MQ', 'Build with MQ publisher/subscriber/broker', 'OFF', ['OFF', 'SUB', 'PUB', 'BROKER']))
######################################################################
# Platform(build target) specific options: SDK/NDK & toolchain
%build
scons TARGET_OS=tizen -c
-scons TARGET_OS=tizen TARGET_TRANSPORT=%{TARGET_TRANSPORT} SECURED=%{SECURED} RELEASE=%{RELEASE} ROUTING=%{ROUTING} WITH_TCP=%{WITH_TCP} WITH_PROXY=%{WITH_PROXY}
+scons TARGET_OS=tizen TARGET_TRANSPORT=%{TARGET_TRANSPORT} SECURED=%{SECURED} RELEASE=%{RELEASE} ROUTING=%{ROUTING} WITH_TCP=%{WITH_TCP} WITH_PROXY=%{WITH_PROXY} WITH_MQ=%{WITH_MQ}
%install
transport = env.get('TARGET_TRANSPORT')
secured = env.get('SECURED')
routing = env.get('ROUTING')
+with_mq = env.get('WITH_MQ')
OIC_LIB = 'oic'
root_dir = env.get('ROOT_DIR')
build_dir = env.get('BUILD_DIR')
sample_dir = build_dir
+print "MQ flag is %s" % with_mq
+
env.AppendUnique(CPPFLAGS = ['-std=c++0x', '-fPIC', '-D__TIZEN__','-DWITH_POSIX', '-Wall', '-DSLP_SDK_LOG', '-g','-D_GNU_SOURCE','-DTIZEN_DEBUG_ENABLE', '-DTB_LOG','`pkg-config', '--cflags', '--libs','dlog', 'com.oic.ri', 'capi-network-wifi',
'gobject-2.0','glib-2.0`'])
else:
env.AppendUnique(CPPDEFINES = ['NO_TCP_ADAPTER'])
+if 'SUB' in with_mq:
+ env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
+ print "MQ SUB support"
+
+if 'PUB' in with_mq:
+ env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
+ print "MQ PUB support"
+
+if 'BROKER' in with_mq:
+ env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
+ print "MQ Broker support"
+
#ri_sample_src = [sample_dir + '/occlient.cpp']
#print " ri sample src %s" % ri_sample_src
routing = env.get('ROUTING')
with_proxy = env.get('WITH_PROXY')
with_tcp = env.get('WITH_TCP')
+with_mq = env.get('WITH_MQ')
with_upstream_libcoap = env.get('WITH_UPSTREAM_LIBCOAP')
if with_upstream_libcoap == '1':
print "Given Transport is %s" % transport
print "Given OS is %s" % target_os
+print "Given MQ is %s" % with_mq
if target_os == 'tizen':
- command = "sh resource/csdk/stack/samples/tizen/build/gbsbuild.sh %s %s %s %s %s %s %s %s" % (transport, secured, buildsample, release_mode, logging, routing, with_tcp, with_proxy)
+ command = "sh resource/csdk/stack/samples/tizen/build/gbsbuild.sh %s %s %s %s %s %s %s %s %s" % (transport, secured, buildsample, release_mode, logging, routing, with_tcp, with_proxy, with_mq)
print "Created Command is %s" % command
gbs_script = env.Command('gbs_build', None, command)
AlwaysBuild ('gbs_script')
\ No newline at end of file
echo $8
export WITH_PROXY=$8
+echo $9
+export WITH_MQ=$9
+
echo $TARGET_TRANSPORT
echo $BUILD_SAMPLE
+echo $WITH_MQ
rm -rf $name-$version
fi
echo "Calling core gbs build command"
-gbscommand="gbs build -A armv7l -B ~/GBS-ROOT-RI-OIC --include-all --repository ./ --define 'TARGET_TRANSPORT $1' --define 'SECURED $2' --define 'RELEASE $4' --define 'LOGGING $5' --define 'ROUTING $6' --define 'WITH_TCP $7' --define 'WITH_PROXY $8'"
+gbscommand="gbs build -A armv7l -B ~/GBS-ROOT-RI-OIC --include-all --repository ./ --define 'TARGET_TRANSPORT $1' --define 'SECURED $2' --define 'RELEASE $4' --define 'LOGGING $5' --define 'ROUTING $6' --define 'WITH_TCP $7' --define 'WITH_PROXY $8' --define 'WITH_MQ $9'"
echo $gbscommand
if eval $gbscommand; then
echo "Core build is successful"
git commit -m "Initial commit"
fi
echo "Calling sample gbs build command"
- gbscommand="gbs build -A armv7l -B ~/GBS-ROOT-RI-OIC --include-all --repository ./ --define 'TARGET_TRANSPORT $1' --define 'SECURED $2' --define 'RELEASE $4' --define 'LOGGING $5' --define 'ROUTING $6' --define 'WITH_TCP $7' --define 'WITH_PROXY $8'"
+ gbscommand="gbs build -A armv7l -B ~/GBS-ROOT-RI-OIC --include-all --repository ./ --define 'TARGET_TRANSPORT $1' --define 'SECURED $2' --define 'RELEASE $4' --define 'LOGGING $5' --define 'ROUTING $6' --define 'WITH_TCP $7' --define 'WITH_PROXY $8' --define 'WITH_MQ $9'"
echo $gbscommand
if eval $gbscommand; then
echo "Sample build is successful"
echo %{ROOTDIR}
scons TARGET_OS=tizen -c
-scons TARGET_OS=tizen TARGET_TRANSPORT=%{TARGET_TRANSPORT} SECURED=%{SECURED} RELEASE=%{RELEASE} LOGGING=%{LOGGING} ROUTING=%{ROUTING} WITH_TCP=%{WITH_TCP} WITH_PROXY=%{WITH_PROXY}
+scons TARGET_OS=tizen TARGET_TRANSPORT=%{TARGET_TRANSPORT} SECURED=%{SECURED} RELEASE=%{RELEASE} LOGGING=%{LOGGING} ROUTING=%{ROUTING} WITH_TCP=%{WITH_TCP} WITH_PROXY=%{WITH_PROXY} WITH_MQ=%{WITH_MQ}
%install
mkdir -p %{DEST_INC_DIR}
target_os = env.get('TARGET_OS')
transport = env.get('TARGET_TRANSPORT')
+with_mq = env.get('WITH_MQ')
print "Given Transport is %s" % transport
else:
env.AppendUnique(CPPDEFINES = ['NO_TCP_ADAPTER'])
+if 'SUB' in with_mq:
+ env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
+ print "MQ SUB support"
+
+if 'PUB' in with_mq:
+ env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
+ print "MQ PUB support"
+
+if 'BROKER' in with_mq:
+ env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
+ print "MQ Broker support"
+
env.SConscript(['../resource/SConscript'])
%{!?WITH_CLOUD: %define WITH_CLOUD 0}
%{!?WITH_TCP: %define WITH_TCP 0}
%{!?WITH_PROXY: %define WITH_PROXY 0}
+%{!?WITH_MQ: %define WITH_MQ OFF}
%{!?ES_TARGET_ENROLLEE: %define ES_TARGET_ENROLLEE tizen}
%{!?VERBOSE: %define VERBOSE 1}
scons %{JOB} --prefix=%{_prefix} \
VERBOSE=%{VERBOSE} \
TARGET_OS=tizen TARGET_ARCH=%{RPM_ARCH} TARGET_TRANSPORT=%{TARGET_TRANSPORT} \
- RELEASE=%{RELEASE} SECURED=%{SECURED} WITH_TCP=%{WITH_TCP} WITH_CLOUD=%{WITH_CLOUD} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \
+ RELEASE=%{RELEASE} SECURED=%{SECURED} WITH_TCP=%{WITH_TCP} WITH_CLOUD=%{WITH_CLOUD} WITH_MQ=%{WITH_MQ} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \
ES_TARGET_ENROLLEE=%{ES_TARGET_ENROLLEE} LIB_INSTALL_DIR=%{_libdir} WITH_PROXY=%{WITH_PROXY}
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} WITH_TCP=%{WITH_TCP} WITH_CLOUD=%{WITH_CLOUD} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \
+ RELEASE=%{RELEASE} SECURED=%{SECURED} WITH_TCP=%{WITH_TCP} WITH_CLOUD=%{WITH_CLOUD} WITH_MQ=%{WITH_MQ} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \
ES_TARGET_ENROLLEE=%{ES_TARGET_ENROLLEE} LIB_INSTALL_DIR=%{_libdir} WITH_PROXY=%{WITH_PROXY}