From 5c3c145b2861dc536200c40a08d142abec7ab811 Mon Sep 17 00:00:00 2001 From: Mu-Woong Lee Date: Thu, 30 Mar 2017 16:05:37 +0900 Subject: [PATCH] Integrate the legacy context-service into the agent service (2/2) This patch integrates the legacy contextd logic into contextd-agent. Change-Id: I5a8c8372dcab37b6ee1f96dbdf6b28e12436f8fb Signed-off-by: Mu-Woong Lee --- packaging/context-service.spec | 13 +++++++++++++ src/agent/AgentMain.cpp | 3 ++- src/agent/CMakeLists.txt | 18 +++++++++++++++++- src/agent/legacy/Server.cpp | 2 +- src/agent/legacy/Server.h | 2 ++ 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/packaging/context-service.spec b/packaging/context-service.spec index 14c6608..42a8c4f 100644 --- a/packaging/context-service.spec +++ b/packaging/context-service.spec @@ -25,6 +25,19 @@ BuildRequires: pkgconfig(context-sensor-recorder-server) BuildRequires: pkgconfig(context-store-server) BuildRequires: pkgconfig(context-job-scheduler-server) +# Legacy support. These dependencies will be removed. +BuildRequires: pkgconfig(gmodule-2.0) +BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(capi-system-device) +BuildRequires: pkgconfig(capi-appfw-app-manager) +BuildRequires: pkgconfig(capi-appfw-package-manager) +BuildRequires: pkgconfig(notification) +BuildRequires: pkgconfig(cynara-creds-gdbus) +BuildRequires: pkgconfig(cynara-client) +BuildRequires: pkgconfig(cynara-session) +BuildRequires: pkgconfig(context-common-legacy) +# --- + %description This is a systemd service that contains all features provided by the Tizen Contextual Service Framework. diff --git a/src/agent/AgentMain.cpp b/src/agent/AgentMain.cpp index fc1dc8d..b1bfe89 100644 --- a/src/agent/AgentMain.cpp +++ b/src/agent/AgentMain.cpp @@ -15,8 +15,9 @@ */ #include +#include "legacy/Server.h" int main(int argc, char* argv[]) { - return EXIT_SUCCESS; + return mainLegacy(); } diff --git a/src/agent/CMakeLists.txt b/src/agent/CMakeLists.txt index a97f2b1..c476073 100644 --- a/src/agent/CMakeLists.txt +++ b/src/agent/CMakeLists.txt @@ -4,7 +4,22 @@ SET(target "contextd-agent") SET(DEPS glib-2.0 gio-2.0 dlog capi-base-common) -FILE(GLOB SRCS *.cpp) +# Legacy support +SET(DEPS ${DEPS} + gmodule-2.0 + vconf + cynara-creds-gdbus + cynara-client + cynara-session + capi-system-device + capi-appfw-app-manager + capi-appfw-package-manager + notification + context-common-legacy +) +# --- + +FILE(GLOB_RECURSE SRCS *.cpp) MESSAGE("Sources: ${SRCS}") INCLUDE(FindPkgConfig) @@ -14,6 +29,7 @@ FOREACH(flag ${DEPS_AGENT_PKG_CFLAGS}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") ENDFOREACH(flag) +ADD_DEFINITIONS(-D_LIBDIR_="${CMAKE_INSTALL_LIBDIR}") ADD_EXECUTABLE(${target} ${SRCS}) SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_DEFINITIONS "LOG_TAG=\"CONTEXT-AGENT\"") TARGET_LINK_LIBRARIES(${target} ${DEPS_AGENT_PKG_LDFLAGS}) diff --git a/src/agent/legacy/Server.cpp b/src/agent/legacy/Server.cpp index 197b0d6..b6e1c50 100644 --- a/src/agent/legacy/Server.cpp +++ b/src/agent/legacy/Server.cpp @@ -142,7 +142,7 @@ static void __signalHandler(int signo) QUIT(mainloop); } -int main(int argc, char* argv[]) +int mainLegacy() { static struct sigaction signalAction; signalAction.sa_handler = __signalHandler; diff --git a/src/agent/legacy/Server.h b/src/agent/legacy/Server.h index cd93bbf..621a6ea 100644 --- a/src/agent/legacy/Server.h +++ b/src/agent/legacy/Server.h @@ -17,6 +17,8 @@ #ifndef _CONTEXT_SERVER_H_ #define _CONTEXT_SERVER_H_ +int mainLegacy(); + namespace ctx { class RequestInfo; -- 2.34.1