From: Youngjae Shin Date: Fri, 13 Nov 2015 03:06:14 +0000 (+0900) Subject: revise build scripts X-Git-Tag: accepted/tizen/mobile/20151113.060940^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F21%2F51721%2F2;p=platform%2Fupstream%2Fiotivity.git revise build scripts Change-Id: I604596c38d62456bb7639197bbeff1619c53f75b --- diff --git a/build_common/SConscript b/build_common/SConscript index f56b166..3a3ac44 100644 --- a/build_common/SConscript +++ b/build_common/SConscript @@ -128,8 +128,8 @@ if target_os in ['android', 'arduino']: # Android/Arduino always uses GNU compil else: env = Environment(variables = help_vars, tools = ['default', 'textfile'], TARGET_ARCH = target_arch, TARGET_OS = target_os, - PREFIX = GetOption('prefix'), INSTALL_ROOT = ARGUMENTS.get('INSTALL_ROOT', dir), - LIB_INSTALL_DIR = ARGUMENTS.get('LIB_INSTALL_DIR', GetOption('prefix')+'/lib') + PREFIX = GetOption('prefix'), + LIB_INSTALL_DIR = ARGUMENTS.get('LIB_INSTALL_DIR', '/usr/lib') ) Help(help_vars.GenerateHelpText(env)) @@ -213,7 +213,7 @@ def __install(ienv, targets, name): def __installlib(ienv, targets, name): user_prefix = env.get('PREFIX') if user_prefix: - i_n = ienv.Install(env.get('INSTALL_ROOT') + env.get('LIB_INSTALL_DIR'), targets) + i_n = ienv.Install(env.get('LIB_INSTALL_DIR'), targets) else: i_n = ienv.Install(env.get('BUILD_DIR'), targets) ienv.Alias("install", i_n) @@ -221,7 +221,7 @@ def __installlib(ienv, targets, name): def __installbin(ienv, targets, name): user_prefix = env.get('PREFIX') if user_prefix: - i_n = ienv.Install(env.get('INSTALL_ROOT') + user_prefix + '/bin', targets) + i_n = ienv.Install(user_prefix + '/bin', targets) else: i_n = ienv.Install(env.get('BUILD_DIR'), targets) ienv.Alias("install", i_n) @@ -229,7 +229,7 @@ def __installbin(ienv, targets, name): def __installheader(ienv, targets, dir, name): user_prefix = env.get('PREFIX') if user_prefix: - i_n = ienv.Install(env.get('INSTALL_ROOT') + user_prefix + '/include/' + dir ,targets) + i_n = ienv.Install(user_prefix + '/include/' + dir, targets) else: i_n = ienv.Install(env.get('BUILD_DIR'), targets) ienv.Alias("install", i_n) @@ -237,7 +237,7 @@ def __installheader(ienv, targets, dir, name): def __installpcfile(ienv, targets, name): user_prefix = env.get('PREFIX') if user_prefix: - i_n = ienv.Install(env.get('INSTALL_ROOT') + env.get('LIB_INSTALL_DIR') + '/pkgconfig', targets) + i_n = ienv.Install(env.get('LIB_INSTALL_DIR') + '/pkgconfig', targets) else: i_n = ienv.Install(env.get('BUILD_DIR'), targets) ienv.Alias("install", i_n) diff --git a/build_common/tizen/SConscript b/build_common/tizen/SConscript index 0c18828..15472b4 100644 --- a/build_common/tizen/SConscript +++ b/build_common/tizen/SConscript @@ -2,46 +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']) - env.AppendUnique(CCFLAGS = ['-g']) -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.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']) -else: - env.AppendUnique(CPPFLAGS = ['-march=armv5te']) +# Set arch flags : It will be handled by Tizen build system. diff --git a/packaging/iotivity.spec b/packaging/iotivity.spec index ad60de0..f3add3c 100644 --- a/packaging/iotivity.spec +++ b/packaging/iotivity.spec @@ -1,14 +1,14 @@ Name: iotivity Version: 1.0.0 Release: 0 -Summary: IoTivity Base Stack & IoTivity Services +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, expat-devel +BuildRequires: gettext-tools, expat-devel BuildRequires: python, libcurl-devel BuildRequires: scons BuildRequires: openssl-devel @@ -41,7 +41,9 @@ Requires(post): /sbin/ldconfig %{!?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} @@ -72,7 +74,9 @@ 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 @@ -100,49 +104,52 @@ cp %{SOURCE1001} ./%{name}-test.manifest %define RPM_ARCH "x86" %endif -scons --prefix=%{_prefix} \ - TARGET_OS=tizen TARGET_ARCH=%{RPM_ARCH} TARGET_TRANSPORT=%{TARGET_TRANSPORT} \ - RELEASE=%{RELEASE} SECURED=%{SECURED} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \ - INSTALL_ROOT=%{buildroot} LIB_INSTALL_DIR=%{_libdir} +#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} %install rm -rf %{buildroot} -scons install --prefix=%{_prefix} \ - TARGET_OS=tizen TARGET_ARCH=%{RPM_ARCH} TARGET_TRANSPORT=%{TARGET_TRANSPORT} \ - RELEASE=%{RELEASE} SECURED=%{SECURED} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \ - INSTALL_ROOT=%{buildroot} 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} \ + LIB_INSTALL_DIR=%{_libdir} + +# For Example %if %{RELEASE} == "True" %define build_mode release %else %define build_mode debug %endif - -# For Example -mkdir -p %{buildroot}%{_bindir} -cp out/tizen/*/%{build_mode}/examples/OICMiddle/OICMiddle %{buildroot}%{_bindir} -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} -cp out/tizen/*/%{build_mode}/resource/examples/oic_svr_db_server.json %{buildroot}%{_bindir} -cp out/tizen/*/%{build_mode}/resource/examples/oic_svr_db_client.json %{buildroot}%{_bindir} +%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} # For iotcon cp resource/csdk/stack/include/ocpayload.h %{buildroot}%{_includedir}/resource @@ -194,28 +201,7 @@ cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}-test %files test %manifest %{name}-test.manifest %defattr(-,root,root,-) -%{_bindir}/OICMiddle -%{_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}/oic_svr_db_server.json -%{_bindir}/oic_svr_db_client.json +%{_bindir}/* %if 0%{?tizen_version_major} < 3 %{_datadir}/license/%{name}-test %else diff --git a/resource/csdk/stack/include/internal/oicgroup.h b/resource/csdk/stack/include/internal/oicgroup.h old mode 100755 new mode 100644 diff --git a/resource/csdk/stack/include/ocpayload.h b/resource/csdk/stack/include/ocpayload.h old mode 100755 new mode 100644 diff --git a/resource/examples/SConscript b/resource/examples/SConscript index 731b203..3e44315 100644 --- a/resource/examples/SConscript +++ b/resource/examples/SConscript @@ -87,6 +87,10 @@ devicediscoveryserver = examples_env.Program('devicediscoveryserver', 'devicedis devicediscoveryclient = examples_env.Program('devicediscoveryclient', 'devicediscoveryclient.cpp') threadingsample = examples_env.Program('threadingsample', 'threadingsample.cpp') +serverjson = examples_env.Install(env.get('BUILD_DIR') + '/resource/examples/', + env.get('SRC_DIR') + '/resource/examples/' + 'oic_svr_db_client.json') +clientjson = 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')) +env.AppendTarget('examples') \ No newline at end of file diff --git a/resource/examples/oic_svr_db_client.json b/resource/examples/oic_svr_db_client.json old mode 100755 new mode 100644 diff --git a/resource/examples/oic_svr_db_server.json b/resource/examples/oic_svr_db_server.json old mode 100755 new mode 100644