From: Mu-Woong Lee Date: Mon, 23 May 2016 12:39:55 +0000 (+0900) Subject: Add a build feature to support non-multiuser version appfw API X-Git-Tag: accepted/tizen/common/20160627.191150~1^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f91b3e591413556bd7e2289f3b23fd1500b38aa7;p=platform%2Fcore%2Fapi%2Fcontext.git Add a build feature to support non-multiuser version appfw API By setting LEGACY_APPFW as 1, it can be built on Tizen 2.3 or Tizen 2.4, which has no multiuser support. Change-Id: I6f3c74e9c038f859d1a2402a533e2ce84e37cefb Signed-off-by: Mu-Woong Lee --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 139e2ae..dfdcf02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ FILE(GLOB_RECURSE SRCS src/*.cpp) MESSAGE("Sources: ${SRCS}") # Dependencies -SET(DEPS "libcontext-shared aul bundle capi-appfw-app-control pkgmgr-info") +SET(DEPS "gio-2.0 libcontext-shared aul bundle capi-appfw-app-control pkgmgr-info") # Common Options INCLUDE(FindPkgConfig) @@ -20,6 +20,10 @@ INCLUDE_DIRECTORIES( ADD_DEFINITIONS(-O2 -Wall -fPIC -fdata-sections -ffunction-sections -fvisibility=hidden) SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIC -Wl,--as-needed -Wl,--gc-section -Wl,--print-gc-section") +IF(${LEGACY_APPFW}) + ADD_DEFINITIONS(-DLEGACY_APPFW) +ENDIF(${LEGACY_APPFW}) + # Building Library pkg_check_modules(api_pkg REQUIRED ${DEPS}) diff --git a/packaging/context.spec b/packaging/context.spec index 041dd36..9a84f71 100644 --- a/packaging/context.spec +++ b/packaging/context.spec @@ -8,11 +8,14 @@ Source0: %{name}-%{version}.tar.gz %define BUILD_PROFILE %{?profile}%{!?profile:%{?tizen_profile_name}} +%define LEGACY_APPFW 0 + %if "%{?BUILD_PROFILE}" == "tv" ExcludeArch: %{arm} aarch64 %ix86 x86_64 %endif BuildRequires: cmake +BuildRequires: pkgconfig(gio-2.0) BuildRequires: pkgconfig(libcontext-shared) BuildRequires: pkgconfig(aul) BuildRequires: pkgconfig(bundle) @@ -39,7 +42,7 @@ export CXXFLAGS+=" -fno-strict-aliasing -fno-unroll-loops -fsigned-char -fstrict export CFLAGS+=" -fno-common" export CXXFLAGS+=" -Wnon-virtual-dtor" -export CXXFLAGS+=" -std=c++11 -Wno-c++11-compat" +export CXXFLAGS+=" -std=c++0x" #export CFLAGS+=" -Wcast-qual" #export CXXFLAGS+=" -Wcast-qual" @@ -53,7 +56,9 @@ export CFLAGS+=" -D_ALLOW_SERVICE_APP_TRIGGER_" export CXXFLAGS+=" -D_ALLOW_SERVICE_APP_TRIGGER_" %endif -cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DPROFILE=%{?BUILD_PROFILE} +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DMAJORVER=${MAJORVER} -DFULLVER=%{version} \ + -DPROFILE=%{?BUILD_PROFILE} \ + -DLEGACY_APPFW=%{LEGACY_APPFW} make %{?jobs:-j%jobs} %install diff --git a/src/context_trigger.cpp b/src/context_trigger.cpp index 2cc7262..0e503f0 100644 --- a/src/context_trigger.cpp +++ b/src/context_trigger.cpp @@ -21,7 +21,11 @@ #include #include #include + +#ifndef LEGACY_APPFW #include +#endif + #include #include #include @@ -374,7 +378,11 @@ SO_EXPORT int context_trigger_rule_set_action_app_control(context_trigger_rule_h IF_FAIL_RETURN_TAG(error == ERR_NONE, error, _E, "Failed to get app id"); pkgmgrinfo_appinfo_h app_info; +#ifdef LEGACY_APPFW + error = pkgmgrinfo_appinfo_get_appinfo(app_id, &app_info); +#else error = pkgmgrinfo_appinfo_get_usr_appinfo(app_id, getuid(), &app_info); +#endif g_free(app_id); IF_FAIL_RETURN_TAG(error == PMINFO_R_OK, CONTEXT_TRIGGER_ERROR_INVALID_RULE, _E, "No such app"); @@ -432,7 +440,11 @@ SO_EXPORT int context_trigger_rule_set_action_notification(context_trigger_rule_ IF_FAIL_RETURN_TAG(error == ERR_NONE, error, _E, "Failed to get app id"); pkgmgrinfo_appinfo_h app_info; +#ifdef LEGACY_APPFW + error = pkgmgrinfo_appinfo_get_appinfo(app_id, &app_info); +#else error = pkgmgrinfo_appinfo_get_usr_appinfo(app_id, getuid(), &app_info); +#endif g_free(app_id); IF_FAIL_RETURN_TAG(error == PMINFO_R_OK, CONTEXT_TRIGGER_ERROR_INVALID_RULE, _E, "No such app"); } @@ -540,7 +552,11 @@ SO_EXPORT int context_trigger_rule_custom_event_create(const char* event_item, c // Err: Invalid provider pkgmgrinfo_pkginfo_h pkg_info; +#ifdef LEGACY_APPFW + int error = pkgmgrinfo_pkginfo_get_pkginfo(provider, &pkg_info); +#else int error = pkgmgrinfo_pkginfo_get_usr_pkginfo(provider, getuid(), &pkg_info); +#endif pkgmgrinfo_pkginfo_destroy_pkginfo(pkg_info); IF_FAIL_RETURN_TAG(error == PMINFO_R_OK, CONTEXT_TRIGGER_ERROR_INVALID_DATA, _E, "No such package"); @@ -617,7 +633,11 @@ SO_EXPORT int context_trigger_rule_custom_condition_create(const char* condition // Err: Invalid provider pkgmgrinfo_pkginfo_h pkg_info; +#ifdef LEGACY_APPFW + int error = pkgmgrinfo_pkginfo_get_pkginfo(provider, &pkg_info); +#else int error = pkgmgrinfo_pkginfo_get_usr_pkginfo(provider, getuid(), &pkg_info); +#endif pkgmgrinfo_pkginfo_destroy_pkginfo(pkg_info); IF_FAIL_RETURN_TAG(error == PMINFO_R_OK, CONTEXT_TRIGGER_ERROR_INVALID_DATA, _E, "No such package");