revise build scripts and spec file for Tizen 75/5075/3
authorYoungjae Shin <yj99.shin@samsung.com>
Fri, 19 Feb 2016 07:51:42 +0000 (16:51 +0900)
committerUze Choi <uzchoi@samsung.com>
Wed, 24 Feb 2016 01:23:11 +0000 (01:23 +0000)
Change-Id: I33e03cd1a0bbfcdd635d14077a67aff680cf88d5
Signed-off-by: Youngjae Shin <yj99.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/5075
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
19 files changed:
build_common/SConscript
build_common/tizen/SConscript
gbsbuild.sh
iotivity.pc.in
resource/c_common/SConscript
resource/csdk/SConscript
resource/csdk/connectivity/src/SConscript
resource/csdk/security/provisioning/SConscript
resource/csdk/stack/samples/tizen/build/packaging/com.oic.ri.spec
resource/examples/SConscript
resource/oc_logger/SConscript
resource/src/SConscript
resource/third_party_libs.scons
service/resource-container/SConscript
service/resource-directory/SConscript
service/resource-encapsulation/src/common/SConscript
service/resource-encapsulation/src/serverBuilder/SConscript
service/third_party_libs.scons
tools/tizen/iotivity.spec

index aee857e..1bc81d8 100644 (file)
@@ -130,8 +130,11 @@ if target_os in ['android', 'arduino']: # Android/Arduino always uses GNU compil
                        tools = ['gnulink', 'gcc', 'g++', 'ar', 'as', 'textfile']
                        )
 else:
-       env = Environment(variables = help_vars, tools = ['default', 'textfile'], TARGET_ARCH = target_arch, TARGET_OS = target_os, PREFIX = GetOption('prefix'))
-
+       env = Environment(variables = help_vars, tools = ['default', 'textfile'],
+                       TARGET_ARCH = target_arch, TARGET_OS = target_os,
+                       PREFIX = GetOption('prefix'),
+                       LIB_INSTALL_DIR = ARGUMENTS.get('LIB_INSTALL_DIR') #for 64bit build
+                       )
 Help(help_vars.GenerateHelpText(env))
 
 tc_set_msg = '''
@@ -214,7 +217,11 @@ def __install(ienv, targets, name):
 def __installlib(ienv, targets, name):
        user_prefix = env.get('PREFIX')
        if user_prefix:
-               i_n = ienv.Install(user_prefix + '/lib', targets)
+               user_lib = env.get('LIB_INSTALL_DIR')
+               if user_lib:
+                       i_n = ienv.Install(user_lib, targets)
+               else:
+                       i_n = ienv.Install(user_prefix + '/lib', targets)
                ienv.Alias("install", i_n)
 
 def __installbin(ienv, targets, name):
@@ -232,7 +239,11 @@ def __installheader(ienv, targets, dir, name):
 def __installpcfile(ienv, targets, name):
        user_prefix = env.get('PREFIX')
        if user_prefix:
-               i_n = ienv.Install(user_prefix + '/lib/pkgconfig', targets)
+               user_lib = env.get('LIB_INSTALL_DIR')
+               if user_lib:
+                       i_n = ienv.Install(user_lib + '/pkgconfig', targets)
+               else:
+                       i_n = ienv.Install(user_prefix + '/lib/pkgconfig', targets)
                ienv.Alias("install", i_n)
 
 def __append_target(ienv, name, targets = None):
@@ -272,12 +283,30 @@ Export('env')
 ######################################################################
 pc_file = env.get('SRC_DIR') + '/iotivity.pc.in'
 
+if env.get('ROUTING') == 'GW':
+       routing_define = 'ROUTING_GATEWAY'
+elif env.get('ROUTING') == 'EP':
+       routing_define = 'ROUTING_EP'
+
 user_prefix = env.get('PREFIX')
+user_lib = env.get('LIB_INSTALL_DIR')
+if not user_lib:
+       user_lib = '$${prefix}/lib'
 
 if user_prefix:
-       pc_vars = {'\@PREFIX\@': user_prefix, '\@EXEC_PREFIX\@':user_prefix, '\@VERSION\@':'0.9.2'}
+       pc_vars = {'\@PREFIX\@': user_prefix,
+                               '\@EXEC_PREFIX\@':user_prefix,
+                               '\@VERSION\@': '1.0.1',
+                               '\@LIB_INSTALL_DIR\@': user_lib,
+                               '\@ROUTING_DEFINE\@': routing_define
+                               }
 else:
-       pc_vars = {'\@PREFIX\@': env.get('BUILD_DIR'), '\@EXEC_PREFIX\@': env.get('BUILD_DIR'), '\@VERSION\@':'0.9.2'}
+       pc_vars = {'\@PREFIX\@': env.get('BUILD_DIR'),
+                               '\@EXEC_PREFIX\@': env.get('BUILD_DIR'),
+                               '\@VERSION\@': '1.0.1',
+                               '\@LIB_INSTALL_DIR\@': user_lib,
+                               '\@ROUTING_DEFINE\@': routing_define
+                               }
 
 env.Substfile(pc_file, SUBST_DICT = pc_vars)
 
index 69de960..15472b4 100644 (file)
@@ -2,45 +2,27 @@
 # This script set linux specific flags (GNU GCC)
 #
 ##
+import os
+import SCons.Util
+
 Import('env')
 
 print "Reading linux configuration script"
 
 # Set release/debug flags
 if env.get('RELEASE'):
-       env.AppendUnique(CCFLAGS = ['-Os'])
        env.AppendUnique(CPPDEFINES = ['NDEBUG'])
-else:
-       env.AppendUnique(CCFLAGS = ['-g'])
 
 if env.get('LOGGING'):
        env.AppendUnique(CPPDEFINES = ['-DTB_LOG'])
 
+env['CCFLAGS'] = SCons.Util.CLVar(os.environ.get('CFLAGS', ""))
 env.AppendUnique(CPPDEFINES = ['WITH_POSIX', '__linux__'])
 env.AppendUnique(CFLAGS = ['-std=gnu99'])
-env.AppendUnique(CCFLAGS = ['-Wall', '-Wextra', '-fPIC'])
+env.AppendUnique(CCFLAGS = ['-Wextra', '-fPIC'])
 env.AppendUnique(LINKFLAGS = ['-ldl', '-lpthread'])
 
-if env.get('TARGET_OS') == 'tizen':
-    env.AppendUnique(CCFLAGS = ['-D__TIZEN__', '-DSLP_SDK_LOG', '-D_GNU_SOURCE', '-DTIZEN_DEBUG_ENABLE'])
-    env.ParseConfig("pkg-config dlog --cflags --libs")
+env.AppendUnique(CCFLAGS = ['-D__TIZEN__', '-D_GNU_SOURCE', '-DTIZEN_DEBUG_ENABLE'])
+env.ParseConfig("pkg-config dlog --cflags --libs")
 
-# Set arch flags
-target_arch = env.get('TARGET_ARCH')
-if target_arch in ['x86']:
-       env.AppendUnique(CCFLAGS = ['-m32'])
-       env.AppendUnique(LINKFLAGS = ['-m32'])
-elif target_arch in ['x86_64']:
-       env.AppendUnique(CCFLAGS = ['-m64'])
-       env.AppendUnique(LINKFLAGS = ['-m64'])
-elif target_arch in ['arm'] or target_arch.find('v5') > 0:
-       env.AppendUnique(CPPFLAGS = ['-march=armv5te'])
-elif target_arch.find('v7a-hard') > 0:
-       env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
-       env.AppendUnique(CPPFLAGS = ['-mfloat-abi=hard'])
-       env.AppendUnique(CCFLAGS = ['-mfloat-abi=hard'])
-       env.AppendUnique(LINKFLAGS = ['-mfloat-abi=hard'])
-elif target_arch.find('v7a') > 0:
-       env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
-elif target_arch.find('arm64') >= 0:
-       env.AppendUnique(CPPFLAGS = ['-march=armv8-a'])
+# Set arch flags : It will be handled by Tizen build system.
index 577ce0c..9ba4a72 100755 (executable)
@@ -40,6 +40,7 @@ cp ./extra_options.scons $sourcedir/tmp
 cp ./tools/tizen/*.spec ./tmp/packaging
 cp ./tools/tizen/*.manifest ./tmp/packaging
 cp ./SConstruct ./tmp
+cp ./LICENSE.md ./tmp
 
 # copy dependency RPMs and conf files for tizen build
 cp ./tools/tizen/*.rpm ./tmp
index 100de75..59bd6b5 100644 (file)
@@ -2,13 +2,20 @@
 
 prefix=@PREFIX@
 exec_prefix=${prefix}
-libdir=${prefix}/lib
-includedir=${prefix}/include/
+libdir=@LIB_INSTALL_DIR@
+includedir=${prefix}/include
+svcincludedir=${includedir}/service
 
 Name: iotivity
 Description: IoTivity is an open source reference implementation of the OIC standard specifications. This includes the libs for resource c and c++ sdk apis.
 Version: @VERSION@
 URL: https://www.iotivity.org
 Requires:
-Libs: -L${libdir} -loctbstack -loc
-Cflags: -I${includedir}
+Libs: -L${libdir} -loc -loc_logger -loc_logger_core -loctbstack -lconnectivity_abstraction
+Cflags: -I${includedir}/resource \
+                       -I${svcincludedir}/resource-encapsulation \
+                       -I${svcincludedir}/resource-container \
+                       -I${svcincludedir}/resource-hosting \
+                       -I${svcincludedir}/resource-directory \
+                       -I${svcincludedir}/things-manager \
+                       -D@ROUTING_DEFINE@
index 58cee3d..a9285ae 100644 (file)
@@ -60,3 +60,5 @@ common_src = [
 
 commonlib = common_env.StaticLibrary('c_common', common_src)
 common_env.InstallTarget(commonlib, 'c_common')
+common_env.UserInstallTargetLib(commonlib, 'c_common')
+common_env.UserInstallTargetHeader('platform_features.h', 'resource', 'platform_features.h')
index 9249ae4..b6f83ba 100644 (file)
@@ -157,3 +157,5 @@ else:
        liboctbstack_env.UserInstallTargetLib([static_liboctbstack, shared_liboctbstack], 'liboctbstack')
        liboctbstack_env.UserInstallTargetHeader('stack/include/ocstackconfig.h', 'resource', 'ocstackconfig.h')
        liboctbstack_env.UserInstallTargetHeader('stack/include/octypes.h', 'resource', 'octypes.h')
+       liboctbstack_env.UserInstallTargetHeader('stack/include/ocstack.h', 'resource', 'ocstack.h')
+       liboctbstack_env.UserInstallTargetHeader('stack/include/ocpresence.h', 'resource', 'ocpresence.h')
index f5f7f1b..161f937 100644 (file)
@@ -165,3 +165,4 @@ if ca_os in ['android', 'tizen']:
 else:
        calib = env.StaticLibrary('connectivity_abstraction', env.get('CA_SRC'))
 env.InstallTarget(calib, 'libconnectivity_abstraction')
+env.UserInstallTargetLib(calib, 'libconnectivity_abstraction')
index 0fcd36e..0387090 100644 (file)
@@ -47,13 +47,16 @@ provisioning_env.AppendUnique(CPPPATH = [
                '../../connectivity/api',
                '../include',
                '../include/internal',
-               '../../../../extlibs/sqlite3',
-               '../../../../extlibs/tinydtls/ecc',
-               '../../../../extlibs/tinydtls/sha2',
-               '../../../../extlibs/asn1cert',
+               '../../../../extlibs/tinydtls/ecc',
+               '../../../../extlibs/tinydtls/sha2',
+               '../../../../extlibs/asn1cert',
                'ck_manager/include'
                ])
 target_os = env.get('TARGET_OS')
+
+if target_os != 'tizen':
+       provisioning_env.AppendUnique(CPPPATH = ['../../../../extlibs/sqlite3'])
+
 provisioning_env.AppendUnique(CFLAGS = ['-D__WITH_DTLS__'])
 provisioning_env.AppendUnique(CFLAGS = ['-std=c99'])
 if target_os not in ['windows', 'winrt']:
@@ -73,7 +76,10 @@ provisioning_env.AppendUnique(LIBS = ['tinydtls'])
 if env.get('DTLS_WITH_X509') == '1':
        provisioning_env.AppendUnique(LIBS = ['CKManger'])
 
-provisioning_env.ParseConfig('pkg-config --libs glib-2.0');
+provisioning_env.ParseConfig('pkg-config --libs glib-2.0')
+
+if target_os == 'tizen':
+       provisioning_env.ParseConfig('pkg-config --cflags --libs sqlite3')
 
 if target_os == 'android':
        provisioning_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
@@ -96,11 +102,15 @@ provisioning_src = [
        'src/ocprovisioningmanager.c',
        'src/oxmjustworks.c',
        'src/oxmrandompin.c',
-       'src/provisioningdatabasemanager.c',
-       root_dir+'/extlibs/sqlite3/sqlite3.c' ]
+       'src/provisioningdatabasemanager.c' ]
+
+if target_os != 'tizen':
+       provisioning_src = provisioning_src + [root_dir+'/extlibs/sqlite3/sqlite3.c' ]
+
 provisioningserver = provisioning_env.StaticLibrary('ocpmapi', provisioning_src)
 
 provisioning_env.InstallTarget(provisioningserver, 'libocpmapi')
+provisioning_env.UserInstallTargetLib(provisioningserver, 'libocpmapi')
 
 if env.get('DTLS_WITH_X509') == '1':
        SConscript('ck_manager/SConscript')
index 1130682..7e559c1 100644 (file)
@@ -16,6 +16,7 @@ BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(capi-network-wifi)
 BuildRequires: pkgconfig(capi-network-bluetooth)
 BuildRequires: pkgconfig(uuid)
+BuildRequires: pkgconfig(sqlite3)
 BuildRequires: boost-devel
 BuildRequires: boost-thread
 BuildRequires: boost-system
index ffb284a..095bb0e 100644 (file)
@@ -87,6 +87,10 @@ devicediscoveryserver = examples_env.Program('devicediscoveryserver', 'devicedis
 devicediscoveryclient = examples_env.Program('devicediscoveryclient', 'devicediscoveryclient.cpp')
 threadingsample = examples_env.Program('threadingsample', 'threadingsample.cpp')
 
+clientjson = examples_env.Install(env.get('BUILD_DIR') + '/resource/examples/',
+                               env.get('SRC_DIR') + '/resource/examples/' + 'oic_svr_db_client.json')
+serverjson = examples_env.Install(env.get('BUILD_DIR') + '/resource/examples/',
+                               env.get('SRC_DIR') + '/resource/examples/' + 'oic_svr_db_server.json')
 Alias("examples", [simpleserver, simpleclient,
                simpleserverHQ, simpleclientHQ,
                fridgeserver, fridgeclient,
@@ -96,14 +100,7 @@ Alias("examples", [simpleserver, simpleclient,
                groupserver, groupclient,
                lightserver,
                devicediscoveryserver, devicediscoveryclient,
-               threadingsample
+               threadingsample,
+               serverjson, clientjson
      ])
 env.AppendTarget('examples')
-
-src_dir = examples_env.get('SRC_DIR')
-svr_db_src_dir = src_dir + '/resource/examples/'
-svr_db_build_dir = env.get('BUILD_DIR') +'/resource/examples/'
-examples_env.Alias("install", examples_env.Install( svr_db_build_dir,
-                svr_db_src_dir + 'oic_svr_db_client.json'))
-examples_env.Alias("install", examples_env.Install( svr_db_build_dir,
-                svr_db_src_dir + 'oic_svr_db_server.json'))
index 9579835..35ae31c 100644 (file)
@@ -53,6 +53,13 @@ liboc_logger = liboc_logger_env.SharedLibrary('oc_logger',
                ['c/oc_logger.c', 'c/oc_console_logger.c', 'cpp/oc_ostream_logger.cpp'])
 
 liboc_logger_env.InstallTarget([liboc_logger_core, liboc_logger], 'liboc_logger')
+liboc_logger_env.UserInstallTargetLib([liboc_logger_core, liboc_logger], 'liboc_logger')
+liboc_logger_env.UserInstallTargetHeader('include/oc_logger.hpp', 'resource', 'oc_logger.hpp')
+liboc_logger_env.UserInstallTargetHeader('include/oc_logger.h', 'resource', 'oc_logger.h')
+liboc_logger_env.UserInstallTargetHeader('include/oc_logger_types.h', 'resource', 'oc_logger_types.h')
+liboc_logger_env.UserInstallTargetHeader('include/oc_log_stream.hpp', 'resource', 'oc_log_stream.hpp')
+liboc_logger_env.UserInstallTargetHeader('include/targets/oc_console_logger.h', 'resource/targets', 'oc_console_logger.h')
+liboc_logger_env.UserInstallTargetHeader('include/targets/oc_ostream_logger.h', 'resource/targets', 'oc_ostream_logger.h')
 
 if target_os not in ['ios', 'android']:
        SConscript('examples/SConscript')
index b3d92ca..7cdde7b 100644 (file)
@@ -80,14 +80,31 @@ oclib = oclib_env.SharedLibrary('oc', oclib_src)
 oclib_env.InstallTarget(oclib, 'liboc')
 oclib_env.UserInstallTargetLib(oclib, 'liboc')
 
-src_dir = env.get('SRC_DIR')
-
-oclib_env.UserInstallTargetHeader(src_dir + '/resource/include/OCApi.h', 'resource', 'OCApi.h')
-oclib_env.UserInstallTargetHeader(src_dir + '/resource/include/OCPlatform.h', 'resource', 'OCPlatform.h')
-oclib_env.UserInstallTargetHeader(src_dir + '/resource/include/OCRepresentation.h', 'resource', 'OCRepresentation.h')
-oclib_env.UserInstallTargetHeader(src_dir + '/resource/include/OCResource.h', 'resource', 'OCResource.h')
-oclib_env.UserInstallTargetHeader(src_dir + '/resource/include/OCResourceRequest.h', 'resource', 'OCResourceRequest.h')
-oclib_env.UserInstallTargetHeader(src_dir + '/resource/include/OCResourceResponse.h', 'resource', 'OCResourceResponse.h')
+header_dir = env.get('SRC_DIR') + '/resource/include/'
+
+oclib_env.UserInstallTargetHeader(header_dir + 'OCApi.h', 'resource', 'OCApi.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OCHeaderOption.h', 'resource', 'OCHeaderOption.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OCException.h', 'resource', 'OCException.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'StringConstants.h', 'resource', 'StringConstants.h')
+
+oclib_env.UserInstallTargetHeader(header_dir + 'OCPlatform.h', 'resource', 'OCPlatform.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OCPlatform_impl.h', 'resource', 'OCPlatform_impl.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'WrapperFactory.h', 'resource', 'WrapperFactory.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'IClientWrapper.h', 'resource', 'IClientWrapper.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'IServerWrapper.h', 'resource', 'IServerWrapper.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OutOfProcClientWrapper.h', 'resource', 'OutOfProcClientWrapper.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OutOfProcServerWrapper.h', 'resource', 'OutOfProcServerWrapper.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'InProcClientWrapper.h', 'resource', 'InProcClientWrapper.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'InProcServerWrapper.h', 'resource', 'InProcServerWrapper.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'InitializeException.h', 'resource', 'InitializeException.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'ResourceInitException.h', 'resource', 'ResourceInitException.h')
+
+oclib_env.UserInstallTargetHeader(header_dir + 'OCRepresentation.h', 'resource', 'OCRepresentation.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'AttributeValue.h', 'resource', 'AttributeValue.h')
+
+oclib_env.UserInstallTargetHeader(header_dir + 'OCResource.h', 'resource', 'OCResource.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OCResourceRequest.h', 'resource', 'OCResourceRequest.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OCResourceResponse.h', 'resource', 'OCResourceResponse.h')
 
 # Add Provisioning library
 if target_os in ['linux', 'android'] and env.get('SECURED') == '1':
index 46b80bd..94495ba 100644 (file)
@@ -36,7 +36,7 @@ src_dir = env.get('SRC_DIR')
 ######################################################################
 # Check dependent packages (Linux only)
 ######################################################################
-if target_os in ['linux', 'tizen']:
+if target_os in ['linux']:
        if not env.GetOption('help'):
                if not target_arch == platform.machine():
                        print '''
index 2863655..9a27b96 100644 (file)
@@ -120,6 +120,7 @@ res_container_static = resource_container_env.StaticLibrary('rcs_container', res
 res_container_shared = resource_container_env.SharedLibrary('rcs_container', res_container_src)
 
 resource_container_env.InstallTarget([res_container_static,res_container_shared], 'libResContainer')
+resource_container_env.UserInstallTargetLib([res_container_static,res_container_shared], 'libResContainer')
 
 resource_container_env.UserInstallTargetHeader('include/RCSBundleInfo.h', 'service/resource-container', 'RCSBundleInfo.h')
 resource_container_env.UserInstallTargetHeader('include/RCSResourceContainer.h', 'service/resource-container', 'RCSResourceContainer.h')
@@ -140,6 +141,7 @@ if target_os in ['linux', 'tizen', 'android']:
 
     DISensorBundle = DI_sensor_bundle_env.SharedLibrary('DISensorBundle', DI_sensor_bundle_src)
     DI_sensor_bundle_env.InstallTarget(DISensorBundle, 'libDISensorBundle')
+    DI_sensor_bundle_env.UserInstallTargetLib(DISensorBundle, 'libDISensorBundle')
 
     if target_os == 'linux' :
         SConscript(DI_SENSOR_BUNDLE_DIR + 'src/inputSensors/SConscript')
@@ -162,6 +164,7 @@ if target_os in ['linux', 'tizen', 'android']:
 
     BMISensorBundle = BMI_sensor_bundle_env.SharedLibrary('BMISensorBundle', BMI_sensor_bundle_src)
     BMI_sensor_bundle_env.InstallTarget(BMISensorBundle, 'libBMISensorBundle')
+    BMI_sensor_bundle_env.UserInstallTargetLib(BMISensorBundle, 'libBMISensorBundle')
 
     if target_os == 'linux' :
         SConscript(BMI_SENSOR_BUNDLE_DIR + 'src/inputSensors/SConscript')
@@ -200,6 +203,7 @@ else:
 
     HueBundle = hue_resource_bundle_env.SharedLibrary('HueBundle', hue_resource_bundle_src)
     hue_resource_bundle_env.InstallTarget(HueBundle, 'libHueBundle')
+    hue_resource_bundle_env.UserInstallTargetLib(HueBundle, 'libHueBundle')
 lib_env = conf2.Finish()
 
 ######################################################################
index 3e02991..b6ef553 100755 (executable)
@@ -75,6 +75,9 @@ else :
     rdsdk = rd_env.StaticLibrary('resource_directory', rd_src)
 
 rd_env.InstallTarget(rdsdk, 'libresource_directory')
+rd_env.UserInstallTargetLib(rdsdk, 'libresource_directory')
+rd_env.UserInstallTargetHeader('/include/rd_client.h', 'service/resource-directory', 'rd_client.h')
+rd_env.UserInstallTargetHeader('/include/rd_server.h', 'service/resource-directory', 'rd_server.h')
 
 ######################################################################
 # Samples for the resource directory
index c240006..06efb88 100644 (file)
@@ -89,6 +89,7 @@ rcs_common_src = [
 rcs_common_static = rcs_common_env.StaticLibrary('rcs_common', rcs_common_src)
 rcs_common_shared = rcs_common_env.SharedLibrary('rcs_common', rcs_common_src)
 rcs_common_env.InstallTarget([rcs_common_static,rcs_common_shared], 'rcs_common')
+rcs_common_env.UserInstallTargetLib([rcs_common_static,rcs_common_shared], 'rcs_common')
 
 ######################################################################
 # Build Test Expiry Timer and primitive Resource
index 1ec21b7..563d1d6 100644 (file)
@@ -80,6 +80,7 @@ server_builder_static = server_builder_env.StaticLibrary('rcs_server', server_bu
 server_builder_shared = server_builder_env.SharedLibrary('rcs_server', server_builder_src)
 
 server_builder_env.InstallTarget([server_builder_static, server_builder_shared], 'rcs_server')
+server_builder_env.UserInstallTargetLib([server_builder_static, server_builder_shared], 'rcs_server')
 
 ######################################################################
 # Build Test
index bc9e4c8..1dfd837 100644 (file)
@@ -37,7 +37,7 @@ resource_path = src_dir + '/resource'
 ######################################################################
 # Check dependent packages (Linux only)
 ######################################################################
-if target_os in ['linux', 'tizen']:
+if target_os in ['linux']:
        if not env.GetOption('help'):
                if not target_arch == platform.machine():
                        print '''
index 72b6eef..73abdc4 100644 (file)
@@ -1,17 +1,17 @@
 Name: iotivity
-Version: 1.0.0
+Version: 1.0.1
 Release: 0
-Summary: IoTivity Base Stack & IoTivity Services
-Group: System Environment/Libraries
+Summary: IoT Connectivity sponsored by the OIC
+Group: Network & Connectivity/Other
 License: Apache-2.0
 URL: https://www.iotivity.org/
 Source0: %{name}-%{version}.tar.bz2
 Source1001: %{name}.manifest
 Source1002: %{name}-test.manifest
-BuildRequires: gettext
-BuildRequires: python, libcurl-devel
-BuildRequires: scons
-BuildRequires: openssl-devel
+BuildRequires:  gettext-tools, expat-devel
+BuildRequires:  python, libcurl-devel
+BuildRequires:  scons
+BuildRequires:  openssl-devel
 BuildRequires:  boost-devel
 BuildRequires:  boost-thread
 BuildRequires:  boost-system
@@ -20,24 +20,33 @@ BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(uuid)
 BuildRequires:  pkgconfig(capi-network-wifi)
 BuildRequires:  pkgconfig(capi-network-bluetooth)
-%if 0%{?tizen_version_major} < 3
-BuildRequires:  pkgconfig(capi-appfw-app-common)
-%else
-BuildRequires:  pkgconfig(capi-appfw-application)
-%endif
 BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(sqlite3)
 Requires(postun): /sbin/ldconfig
 Requires(post): /sbin/ldconfig
 
-%define release_mode false
-%define secure_mode 0
+
+## If tizen 2.x, RELEASE follows tizen_build_binary_release_type_eng. ##
+## and if tizen 3.0, RELEASE follows tizen_build_devel_mode. ##
+%if 0%{?tizen_build_devel_mode} == 1 || 0%{?tizen_build_binary_release_type_eng} == 1
+%define RELEASE False
+%else
+%define RELEASE True
+%endif
+
+%{!?TARGET_TRANSPORT: %define TARGET_TRANSPORT IP}
+%{!?SECURED: %define SECURED 0}
+%{!?LOGGING: %define LOGGING True}
+%{!?ROUTING: %define ROUTING GW}
 
 %description
-IoTivity Base (RICH & LITE) Stack & IoTivity Services
+An open source reference implementation of the OIC standard specifications
+IoTivity Base Libraries are included.
+
 
 %package service
 Summary: Development files for %{name}
-Group: Development/Libraries
+Group: Network & Connectivity/Service
 Requires: %{name} = %{version}-%{release}
 
 %description service
@@ -46,7 +55,7 @@ developing applications that use %{name}-service.
 
 %package test
 Summary: Development files for %{name}
-Group: Development/Libraries
+Group: Network & Connectivity/Testing
 Requires: %{name} = %{version}-%{release}
 
 %description test
@@ -55,7 +64,7 @@ how the iotivity works using %{name}-test
 
 %package devel
 Summary: Development files for %{name}
-Group: Development/Libraries
+Group: Network & Connectivity/Development
 Requires: %{name} = %{version}-%{release}
 Requires: pkgconfig
 
@@ -64,7 +73,10 @@ The %{name}-devel package contains libraries and header files for
 developing applications that use %{name}.
 
 %prep
-%setup -q -n %{name}-%{version}
+%setup -q
+chmod g-w %_sourcedir/*
+
+cp LICENSE.md LICENSE.APLv2
 cp %{SOURCE1001} .
 %if 0%{?tizen_version_major} < 3
 cp %{SOURCE1002} .
@@ -91,75 +103,75 @@ cp %{SOURCE1001} ./%{name}-test.manifest
 %define RPM_ARCH "x86"
 %endif
 
+#VERBOSE=1
+scons -j2 --prefix=%{_prefix} \
+       TARGET_OS=tizen TARGET_ARCH=%{RPM_ARCH} TARGET_TRANSPORT=%{TARGET_TRANSPORT} \
+       RELEASE=%{RELEASE} SECURED=%{SECURED} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \
+       LIB_INSTALL_DIR=%{_libdir}
 
-scons -j 4 TARGET_OS=tizen TARGET_ARCH=%{RPM_ARCH} TARGET_TRANSPORT=IP RELEASE=%{release_mode} SECURED=%{secure_mode}
 
 %install
 rm -rf %{buildroot}
-mkdir -p %{buildroot}%{_includedir}
-mkdir -p %{buildroot}%{_libdir}
-mkdir -p %{buildroot}%{_bindir}
+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} \
+       LIB_INSTALL_DIR=%{_libdir}
 
 
-%if %{release_mode} == "true"
+# For Example
+%if %{RELEASE} == "True"
 %define build_mode release
 %else
 %define build_mode debug
 %endif
+%define ex_install_dir %{buildroot}%{_bindir}
+mkdir -p %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/examples/OICMiddle/OICMiddle %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/devicediscoveryclient %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/devicediscoveryserver %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/fridgeclient %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/fridgeserver %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/garageclient %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/garageserver %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/groupclient %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/groupserver %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/lightserver %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/presenceclient %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/presenceserver %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/roomclient %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/roomserver %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/simpleclient %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/simpleclientHQ %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/simpleclientserver %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/simpleserver %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/simpleserverHQ %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/threadingsample %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/oic_svr_db_server.json %{ex_install_dir}
+cp out/tizen/*/%{build_mode}/resource/examples/oic_svr_db_client.json %{ex_install_dir}
+%if 0%{?SECURED} == 1
+mkdir -p %{ex_install_dir}/provisioning
+cp out/tizen/*/%{build_mode}/resource/provisioning/examples/oic_svr_db_client.json %{ex_install_dir}/provisioning/
+cp out/tizen/*/%{build_mode}/resource/provisioning/examples/provisioningclient %{ex_install_dir}/provisioning/
+
+cp ./resource/csdk/security/include/pinoxmcommon.h %{buildroot}%{_includedir}
+cp ./resource/csdk/security/provisioning/include/oxm/*.h %{buildroot}%{_includedir}
+cp ./resource/csdk/security/provisioning/include/internal/*.h %{buildroot}%{_includedir}
+cp ./resource/csdk/security/provisioning/include/*.h %{buildroot}%{_includedir}
+
+cp out/tizen/*/%{build_mode}/resource/csdk/security/provisioning/sample/provisioningclient %{ex_install_dir}/provision-sample/
+cp out/tizen/*/%{build_mode}/resource/csdk/security/provisioning/sample/sampleserver_justworks %{ex_install_dir}/provision-sample/
+cp out/tizen/*/%{build_mode}/resource/csdk/security/provisioning/sample/sampleserver_randompin %{ex_install_dir}/provision-sample/
+cp out/tizen/*/%{build_mode}/resource/csdk/security/provisioning/sample/*.json %{ex_install_dir}/provision-sample/
+%endif
+
 
-cp out/tizen/*/%{build_mode}/resource/examples/devicediscoveryclient %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/devicediscoveryserver %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/fridgeclient %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/fridgeserver %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/garageclient %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/garageserver %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/groupclient %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/groupserver %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/lightserver %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/presenceclient %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/presenceserver %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/roomclient %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/roomserver %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/simpleclient %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/simpleclientHQ %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/simpleclientserver %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/simpleserver %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/simpleserverHQ %{buildroot}%{_bindir}
-cp out/tizen/*/%{build_mode}/resource/examples/threadingsample %{buildroot}%{_bindir}
-if echo %{secure_mode}|grep -qi '1'; then
-       cp out/tizen/*/%{build_mode}/libocpmapi.a %{buildroot}%{_libdir}
-       cp resource/c_common/*.h %{buildroot}%{_includedir}
-       cp resource/csdk/connectivity/api/*.h %{buildroot}%{_includedir}
-       cp extlibs/tinycbor/tinycbor/src/*.h %{buildroot}%{_includedir}
-       cp ./extlibs/cjson/*.h %{buildroot}%{_includedir}
-       cp ./resource/c_common/oic_string/include/*.h %{buildroot}%{_includedir}
-       cp ./resource/csdk/security/provisioning/include/oxm/*.h %{buildroot}%{_includedir}
-       cp ./resource/csdk/security/include/*.h %{buildroot}%{_includedir}
-       cp ./resource/csdk/security/provisioning/include/internal/*.h %{buildroot}%{_includedir}
-       cp ./resource/csdk/security/provisioning/include/*.h %{buildroot}%{_includedir}
-       cp ./resource/csdk/connectivity/lib/libcoap-4.1.1/*.h %{buildroot}%{_includedir}
-
-       cp out/tizen/*/%{build_mode}/resource/csdk/stack/samples/linux/secure/occlientbasicops %{buildroot}%{_bindir}
-       cp out/tizen/*/%{build_mode}/resource/csdk/stack/samples/linux/secure/ocserverbasicops %{buildroot}%{_bindir}
-       cp out/tizen/*/%{build_mode}/resource/csdk/stack/samples/linux/secure/ocamsservice %{buildroot}%{_bindir}
-       cp out/tizen/*/%{build_mode}/resource/examples/*.json %{buildroot}%{_bindir}
-       cp out/tizen/*/%{build_mode}/resource/csdk/stack/samples/linux/secure/*.json %{buildroot}%{_bindir}
-
-       cp out/tizen/*/%{build_mode}/resource/csdk/security/provisioning/sample/provisioningclient %{buildroot}%{_bindir}
-       cp out/tizen/*/%{build_mode}/resource/csdk/security/provisioning/sample/sampleserver_justworks %{buildroot}%{_bindir}
-       cp out/tizen/*/%{build_mode}/resource/csdk/security/provisioning/sample/sampleserver_randompin %{buildroot}%{_bindir}
-       cp out/tizen/*/%{build_mode}/resource/csdk/security/provisioning/sample/*.json %{buildroot}%{_bindir}
-fi
-cp out/tizen/*/%{build_mode}/libcoap.a %{buildroot}%{_libdir}
-cp out/tizen/*/%{build_mode}/lib*.so %{buildroot}%{_libdir}
-
-cp resource/csdk/stack/include/*.h %{buildroot}%{_includedir}
-cp resource/csdk/logger/include/*.h %{buildroot}%{_includedir}
-cp resource/c_common/ocrandom/include/*.h %{buildroot}%{_includedir}
-cp -r resource/oc_logger/include/* %{buildroot}%{_includedir}
-cp resource/include/*.h %{buildroot}%{_includedir}
-
-cp service/things-manager/sdk/inc/*.h %{buildroot}%{_includedir}
+%if 0%{?tizen_version_major} < 3
+mkdir -p %{buildroot}/%{_datadir}/license
+cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}
+cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}-service
+cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}-test
+%endif
 
 %post -p /sbin/ldconfig
 
@@ -173,7 +185,11 @@ cp service/things-manager/sdk/inc/*.h %{buildroot}%{_includedir}
 %{_libdir}/liboc_logger_core.so
 %{_libdir}/liboctbstack.so
 %{_libdir}/libconnectivity_abstraction.so
-%{_libdir}/lib*.a
+%if 0%{?tizen_version_major} < 3
+%{_datadir}/license/%{name}
+%else
+%license LICENSE.APLv2
+%endif
 
 %files service
 %manifest %{name}.manifest
@@ -187,30 +203,24 @@ cp service/things-manager/sdk/inc/*.h %{buildroot}%{_includedir}
 %{_libdir}/librcs_common.so
 %{_libdir}/librcs_container.so
 %{_libdir}/librcs_server.so
+%if 0%{?tizen_version_major} < 3
+%{_datadir}/license/%{name}-service
+%else
+%license LICENSE.APLv2
+%endif
 
 %files test
 %manifest %{name}-test.manifest
 %defattr(-,root,root,-)
-%{_bindir}/devicediscoveryclient
-%{_bindir}/devicediscoveryserver
-%{_bindir}/fridgeclient
-%{_bindir}/fridgeserver
-%{_bindir}/garageclient
-%{_bindir}/garageserver
-%{_bindir}/groupclient
-%{_bindir}/groupserver
-%{_bindir}/lightserver
-%{_bindir}/presenceclient
-%{_bindir}/presenceserver
-%{_bindir}/roomclient
-%{_bindir}/roomserver
-%{_bindir}/simpleclient
-%{_bindir}/simpleclientHQ
-%{_bindir}/simpleclientserver
-%{_bindir}/simpleserver
-%{_bindir}/simpleserverHQ
-%{_bindir}/threadingsample
+%{_bindir}/*
+%if 0%{?tizen_version_major} < 3
+%{_datadir}/license/%{name}-test
+%else
+%license LICENSE.APLv2
+%endif
 
 %files devel
 %defattr(-,root,root,-)
+%{_libdir}/lib*.a
+%{_libdir}/pkgconfig/%{name}.pc
 %{_includedir}/*