[IOT-1333] Enable message queue(MQ) in tizen platform
authorjihwanseo <jihwan.seo@samsung.com>
Wed, 21 Sep 2016 08:10:21 +0000 (17:10 +0900)
committerAshok Babu Channa <ashok.channa@samsung.com>
Thu, 29 Sep 2016 06:52:09 +0000 (06:52 +0000)
Change-Id: Ic35205cbeaaa39108cce970324fa4172a980ba7f
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Signed-off-by: Jaehong Jo <jaehong.jo@samsung.com>
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/12133
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
gbsbuild.sh
resource/csdk/connectivity/build/SConscript
resource/csdk/stack/samples/tizen/SimpleClientServer/SConscript
resource/csdk/stack/samples/tizen/SimpleClientServer/packaging/com.oic.ri.sample.spec
resource/csdk/stack/samples/tizen/SimpleClientServer/scons/SConscript
resource/csdk/stack/samples/tizen/build/SConscript
resource/csdk/stack/samples/tizen/build/gbsbuild.sh
resource/csdk/stack/samples/tizen/build/packaging/com.oic.ri.spec
resource/csdk/stack/samples/tizen/build/scons/SConscript
tools/tizen/iotivity.spec

index 487733bba9347a704b261e0c38a48c692ccc3227..58c2cdf66a4c7531965d31beb6b43762d72ea5e6 100755 (executable)
@@ -69,18 +69,29 @@ 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
+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"
index 5a1c8e6604f4cdcfe914ad96a44c698f9e877e2a..b812feda6ff8594638c2ccee05986e418b54702d 100644 (file)
@@ -66,6 +66,7 @@ help_vars.Add(BoolVariable('UPLOAD', 'Upload binary ? (For Arduino)', require_up
 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),)
 
index 532eb20b8f763e5721d114b4a0f08787ea845a52..5bcb4ec782a16e5c203f658af6ade426a9961669 100644 (file)
@@ -57,6 +57,7 @@ help_vars.Add(EnumVariable('TARGET_ARCH', 'Target architecture', default_arch, o
 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
index 832acf152457cfa936f0e27088bb6b1d498c82d6..03858fff2b03b2549d037ed19ebcf7bb8088fdba 100644 (file)
@@ -31,7 +31,7 @@ OIC RIsample application
 %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
 
index 9ec20c53fdc209e18f48a6228bbf614cd718d5fc..db9ad417bae3b7681da6b24d5e768b3522aed570 100644 (file)
@@ -24,11 +24,14 @@ target_os = env.get('TARGET_OS')
 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`'])
 
@@ -76,6 +79,18 @@ else:
        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
index 3f4efc8916b641bdc4e8dadd1fd5b859f9bd853a..d04f96aff6601f18b6a139b88751d71c22e11fc5 100644 (file)
@@ -15,6 +15,7 @@ logging = env.get('LOGGING')
 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':
@@ -43,9 +44,10 @@ if env.get('WITH_PROXY'):
 
 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
index 72aa019db47ad79172f2713026a853dca1defddc..7f402db4a7ec13dbbaa00a1a3345e65c27bdba1b 100644 (file)
@@ -32,8 +32,12 @@ export WITH_TCP=$7
 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
 
@@ -98,7 +102,7 @@ if [ ! -d .git ]; then
 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"
@@ -121,7 +125,7 @@ if echo $BUILD_SAMPLE|grep -qi '^ON$'; then
       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"
index 0171d1ab6b7ea3d80713d5b0b8eeea6a3bf37aad..018693e50dc04130b779910d743fd564a6055c1b 100644 (file)
@@ -37,7 +37,7 @@ SLP oicri application
 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}
index b9d0bd41275a7a51bd2d21d8ce93a94682baa453..0382f4f86e2b7d2d6099fdda6cab97a30f4eafc3 100644 (file)
@@ -8,6 +8,7 @@ Import('env')
 
 target_os = env.get('TARGET_OS')
 transport = env.get('TARGET_TRANSPORT')
+with_mq = env.get('WITH_MQ')
 
 print "Given Transport is %s" % transport
 
@@ -47,4 +48,16 @@ else:
        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'])
index 56ca9cba535a15d1648334c285aa791058a5e49c..7a484563c68144c40e6e05ab6d0a1766eb66b856 100644 (file)
@@ -43,6 +43,7 @@ Requires(post): /sbin/ldconfig
 %{!?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}
 
@@ -119,7 +120,7 @@ cp %{SOURCE1001} ./%{name}-test.manifest
 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}
 
 
@@ -129,7 +130,7 @@ rm -rf %{buildroot}
 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}