From 4d1f4dfe6aa30270e933cd264476f9161c5069c3 Mon Sep 17 00:00:00 2001 From: Mu-Woong Lee Date: Thu, 30 Mar 2017 13:49:02 +0900 Subject: [PATCH] Integrate the legacy context-common code and headers (2/2) This patch enables to build the imported legacy code and include built libraries and headers to the produced RPMs. Change-Id: I1103fcea1ab1891a00995609b1ae05a0a8612359 Signed-off-by: Mu-Woong Lee --- CMakeLists.txt | 13 ++++++++++++- common/CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ common/include/DBusTypes.h | 6 +++--- packaging/context-provider.spec | 32 ++++++++++++++++++++------------ pkg-config.pc.in | 13 +++++++++++++ src/CMakeLists.txt | 16 +++++++--------- 6 files changed, 86 insertions(+), 25 deletions(-) create mode 100644 common/CMakeLists.txt create mode 100644 pkg-config.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c21cb6..a38dc22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,8 +7,12 @@ SET(target_dir "context-service") # Common Options INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR}/common/include ${CMAKE_CURRENT_SOURCE_DIR}/src/shared ) + +SET(DEPS "glib-2.0 gio-2.0 json-glib-1.0 sqlite3 capi-base-common dlog alarm-service libtzplatform-config") + ADD_DEFINITIONS(-O2 -Wall -fPIC -fdata-sections -ffunction-sections) ADD_DEFINITIONS(-fvisibility=hidden) ADD_DEFINITIONS(-DLOG_TAG="CONTEXT") @@ -17,8 +21,15 @@ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIC -Wl,--as-needed -Wl, INSTALL( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${target_dir}/internal + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${target_dir}/legacy + FILES_MATCHING PATTERN "*.h" +) + +INSTALL( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/common/include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${target_dir}/legacy FILES_MATCHING PATTERN "*.h" ) +ADD_SUBDIRECTORY(common) ADD_SUBDIRECTORY(src) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt new file mode 100644 index 0000000..5168e02 --- /dev/null +++ b/common/CMakeLists.txt @@ -0,0 +1,31 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +INCLUDE(FindPkgConfig) +pkg_check_modules(LIB_PKG REQUIRED ${DEPS}) + +FOREACH(flag ${LIB_PKG_CFLAGS}) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") +ENDFOREACH(flag) + +SET(PC_NAME "context-common-legacy") +SET(VERSION ${FULLVER}) +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(PC_INCLUDE "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/context-service/legacy") +SET(PC_LIBDIR "${CMAKE_INSTALL_LIBDIR}") +SET(PC_DESCRIPTION "Tizen Context-Service Shared Library") +SET(PC_REQUIRED "${DEPS}") +SET(PC_LDFLAGS "-lctx-shared -lctx-server -lctx-client") +CONFIGURE_FILE( + ${CMAKE_SOURCE_DIR}/pkg-config.pc.in + ${CMAKE_CURRENT_SOURCE_DIR}/${PC_NAME}.pc + @ONLY +) + +INSTALL( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PC_NAME}.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +) + +ADD_SUBDIRECTORY(shared) +ADD_SUBDIRECTORY(client) +ADD_SUBDIRECTORY(server) diff --git a/common/include/DBusTypes.h b/common/include/DBusTypes.h index 1921e30..ae6af3c 100644 --- a/common/include/DBusTypes.h +++ b/common/include/DBusTypes.h @@ -17,9 +17,9 @@ #ifndef _CONTEXT_DBUS_TYPES_H_ #define _CONTEXT_DBUS_TYPES_H_ -#define DBUS_DEST "org.tizen.context" -#define DBUS_PATH "/org/tizen/context" -#define DBUS_IFACE "org.tizen.context" +#define DBUS_DEST "org.tizen.contextagent" +#define DBUS_PATH "/org/tizen/contextagent/Legacy" +#define DBUS_IFACE "org.tizen.contextagent.Legacy" #define DBUS_TIMEOUT 3000 #define METHOD_REQUEST "Request" diff --git a/packaging/context-provider.spec b/packaging/context-provider.spec index 8cf4fde..3325cb2 100644 --- a/packaging/context-provider.spec +++ b/packaging/context-provider.spec @@ -1,6 +1,6 @@ Name: context-provider Summary: Context Provider -Version: 0.9.14 +Version: 0.10.0 Release: 1 Group: Service/Context License: Apache-2.0 @@ -16,24 +16,31 @@ Provides: context-provider-profile_ivi = %{version}-%{release} BuildRequires: cmake +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(gio-2.0) BuildRequires: pkgconfig(gmodule-2.0) -BuildRequires: pkgconfig(context-common) +BuildRequires: pkgconfig(json-glib-1.0) +BuildRequires: pkgconfig(sqlite3) +BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(capi-base-common) +BuildRequires: pkgconfig(libtzplatform-config) +BuildRequires: pkgconfig(alarm-service) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(capi-system-device) BuildRequires: pkgconfig(capi-system-runtime-info) BuildRequires: pkgconfig(capi-media-sound-manager) BuildRequires: pkgconfig(capi-network-wifi) -BuildRequires: pkgconfig(sensor) -BuildRequires: pkgconfig(motion) +#BuildRequires: pkgconfig(sensor) +#BuildRequires: pkgconfig(motion) # TODO TEMPORARY STATEMENT # if it is mobile or BASE2 (when we have migrated everything into BASE2, we can remove this if statement) # Common also supports extension mode. %if "%{?BUILD_PROFILE}" != "tv" && "%{?BUILD_PROFILE}" != "wearable" && "%{?BUILD_PROFILE}" != "ivi" -BuildRequires: pkgconfig(capi-appfw-package-manager) -BuildRequires: pkgconfig(capi-appfw-application) -BuildRequires: pkgconfig(capi-appfw-app-manager) +#BuildRequires: pkgconfig(capi-appfw-package-manager) +#BuildRequires: pkgconfig(capi-appfw-application) +#BuildRequires: pkgconfig(capi-appfw-app-manager) BuildRequires: pkgconfig(capi-network-bluetooth) BuildRequires: pkgconfig(pkgmgr) BuildRequires: pkgconfig(pkgmgr-info) @@ -42,9 +49,9 @@ BuildRequires: pkgconfig(contacts-service2) BuildRequires: pkgconfig(tapi) BuildRequires: pkgconfig(capi-telephony) BuildRequires: pkgconfig(capi-messaging-email) -BuildRequires: pkgconfig(capi-content-media-content) +#BuildRequires: pkgconfig(capi-content-media-content) BuildRequires: pkgconfig(libmedia-utils) -BuildRequires: pkgconfig(capi-location-manager) +#BuildRequires: pkgconfig(capi-location-manager) BuildRequires: pkgconfig(capi-geofence-manager) %endif @@ -86,9 +93,9 @@ rm -rf %{buildroot} %files %manifest packaging/%{name}.manifest %{_libdir}/*.so* -%{_libdir}/context-service/*activity.so* +#%{_libdir}/context-service/*activity.so* %{_libdir}/context-service/*custom.so* -%{_libdir}/context-service/*sensor.so* +#%{_libdir}/context-service/*sensor.so* %{_libdir}/context-service/*system.so* %{_libdir}/context-service/*time.so* %license LICENSE @@ -103,7 +110,8 @@ Context Provider Shared Header (DEV) %files devel %manifest packaging/%{name}.manifest -%{_includedir}/context-service/internal/*.h +%{_includedir}/context-service/legacy/*.h +%{_libdir}/pkgconfig/*.pc # TODO TEMPORARY STATEMENT # if it is mobile or BASE2 (when we have migrated everything into BASE2, we can remove this if statement) diff --git a/pkg-config.pc.in b/pkg-config.pc.in new file mode 100644 index 0000000..378b991 --- /dev/null +++ b/pkg-config.pc.in @@ -0,0 +1,13 @@ +#Package Information for pkg-config + +prefix=@PREFIX@ +exec_prefix=@PREFIX@ +libdir=@PC_LIBDIR@ +includedir=@PC_INCLUDE@ + +Name: @PC_NAME@ +Description: @PC_DESCRIPTION@ +Version: @VERSION@ +Requires: @PC_REQUIRED@ +Libs: -L${libdir} @PC_LDFLAGS@ +Cflags: -I${includedir} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index babd7c3..2472289 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,26 +1,24 @@ SET(target_shared "${target_prefix}-shared") -SET(DEPS - context-common -) +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lctx-shared -lctx-server") ADD_SUBDIRECTORY(shared) -ADD_SUBDIRECTORY(activity) +#ADD_SUBDIRECTORY(activity) ADD_SUBDIRECTORY(custom) -ADD_SUBDIRECTORY(sensor) +#ADD_SUBDIRECTORY(sensor) ADD_SUBDIRECTORY(system) ADD_SUBDIRECTORY(time) IF("${FEATURES}" STREQUAL "extended") -ADD_SUBDIRECTORY(app-stats) -ADD_SUBDIRECTORY(battery-stats) +#ADD_SUBDIRECTORY(app-stats) +#ADD_SUBDIRECTORY(battery-stats) ADD_SUBDIRECTORY(call) ADD_SUBDIRECTORY(contacts) ADD_SUBDIRECTORY(email) ADD_SUBDIRECTORY(geofence) ADD_SUBDIRECTORY(headphone) -ADD_SUBDIRECTORY(media-stats) +#ADD_SUBDIRECTORY(media-stats) ADD_SUBDIRECTORY(message) #ADD_SUBDIRECTORY(my-place) -ADD_SUBDIRECTORY(social-stats) +#ADD_SUBDIRECTORY(social-stats) ADD_SUBDIRECTORY(wifi) ENDIF("${FEATURES}" STREQUAL "extended") -- 2.7.4