Remove profile build dependency 38/108038/5
authorMu-Woong Lee <muwoong.lee@samsung.com>
Mon, 2 Jan 2017 11:21:17 +0000 (20:21 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Tue, 3 Jan 2017 05:49:53 +0000 (14:49 +0900)
Instead of the four packages, sensord, libsensord, libsensord-devel, and sensor-hal-devel,
the following packages are produced:

- sensord : dummy internal API library, which completely disable all sensor listener features
- sensord-genuine : working internal API library and the sensor service daemon
- sensord-devel : internal API headers and the pc file
- sensor-hal-devel : API headers for Sensor HAL

Change-Id: Ie3529d6e5eba0554fd86b4d7f95ea9726db00aa4
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
20 files changed:
CMakeLists.txt
include/enum_factory.h [moved from src/shared/enum_factory.h with 100% similarity]
include/sensor_common.h [moved from src/shared/sensor_common.h with 100% similarity]
include/sensor_deprecated.h [moved from src/shared/sensor_deprecated.h with 100% similarity]
include/sensor_hal.h [moved from src/hal/sensor_hal.h with 100% similarity]
include/sensor_hal_types.h [moved from src/hal/sensor_hal_types.h with 100% similarity]
include/sensor_internal.h [moved from src/client/sensor_internal.h with 100% similarity]
include/sensor_internal_deprecated.h [moved from src/client/sensor_internal_deprecated.h with 100% similarity]
include/sensor_types.h [moved from src/shared/sensor_types.h with 99% similarity]
packaging/sensord.spec
src/client-dummy/CMakeLists.txt [new file with mode: 0644]
src/client-dummy/client_deprecated.cpp [new file with mode: 0644]
src/client-dummy/client_dummy.cpp [moved from src/client/client_dummy.cpp with 98% similarity]
src/client-dummy/external_client_dummy.cpp [moved from src/client/external_client_dummy.cpp with 93% similarity]
src/client-dummy/sensor.pc.in [moved from src/client/sensor.pc.in with 100% similarity]
src/client/CMakeLists.txt
src/hal/CMakeLists.txt [deleted file]
src/sensorctl/CMakeLists.txt
src/shared/CMakeLists.txt
src/shared/sensor_types.cpp

index bf31fa9..c5d9d08 100644 (file)
@@ -2,6 +2,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(sensord-main CXX)
 INCLUDE(GNUInstallDirs)
 
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+
 # Common Options
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O2 -omit-frame-pointer -std=gnu++0x")
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -ffunction-sections")
@@ -13,8 +15,14 @@ MESSAGE("FLAGS: ${CMAKE_EXE_LINKER_FLAGS}")
 #add_definitions(-Wall -g -D_DEBUG)
 
 # Sub-directory
+ADD_SUBDIRECTORY(src/shared)
 ADD_SUBDIRECTORY(src/server)
 ADD_SUBDIRECTORY(src/client)
-ADD_SUBDIRECTORY(src/shared)
-ADD_SUBDIRECTORY(src/hal)
+ADD_SUBDIRECTORY(src/client-dummy)
 ADD_SUBDIRECTORY(src/sensorctl)
+
+INSTALL(
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
+       DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor
+       FILES_MATCHING PATTERN "*.h"
+)
similarity index 100%
rename from src/hal/sensor_hal.h
rename to include/sensor_hal.h
similarity index 99%
rename from src/shared/sensor_types.h
rename to include/sensor_types.h
index dab36bc..ac1f13a 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef _SENSOR_TYPES_H_
 #define _SENSOR_TYPES_H_
 
-#include "enum_factory.h"
+#include <enum_factory.h>
 
 #ifdef __cplusplus
 extern "C"
index cfd30af..e0e45ec 100644 (file)
@@ -1,7 +1,7 @@
 Name:       sensord
 Summary:    Sensor daemon
-Version:    2.0.9
-Release:    0
+Version:    2.0.10
+Release:    1
 Group:      System/Sensor Framework
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
@@ -18,28 +18,35 @@ BuildRequires:  pkgconfig(libsystemd-daemon)
 BuildRequires:  pkgconfig(cynara-creds-socket)
 BuildRequires:  pkgconfig(cynara-client)
 BuildRequires:  pkgconfig(cynara-session)
-Requires:   libsensord = %{version}-%{release}
 
-%define BUILD_PROFILE %{?profile}%{!?profile:%{?tizen_profile_name}}
+Provides:   %{name}-profile_tv = %{version}-%{release}
+# For backward compatibility
+Provides:   libsensord = %{version}-%{release}
 
 %description
 Sensor daemon
 
-%package -n libsensord
-Summary:    Sensord library
-Group:      System/Libraries
+%package    genuine
+Summary:    Genuine Sensor Framework service daemon and shared library
 Requires:   %{name} = %{version}-%{release}
-
-%description -n libsensord
-Sensord library
-
-%package -n libsensord-devel
-Summary:    Sensord shared library
+Provides:   %{name}-profile_mobile = %{version}-%{release}
+Provides:   %{name}-profile_wearable = %{version}-%{release}
+Provides:   %{name}-profile_ivi = %{version}-%{release}
+Provides:   %{name}-profile_common = %{version}-%{release}
+
+%description genuine
+Binary replacement for sensord.
+This genuine sensord package contains actually working shared library
+of the sensor internal APIs and the sensor service daemon.
+If you want to keep using %{name} after uninstalling this, you need to reinstall %{name}.
+
+%package    devel
+Summary:    Internal Sensor API (Development)
 Group:      System/Development
-Requires:   libsensord = %{version}-%{release}
+Requires:   %{name} = %{version}-%{release}
 
-%description -n libsensord-devel
-Sensord shared library
+%description devel
+Internal Sensor API (Development)
 
 %package -n sensor-hal-devel
 Summary:    Sensord HAL interface
@@ -55,11 +62,20 @@ Group:      System/Testing
 %description -n sensor-test
 Sensor functional testing
 
+# This dummy package will be removed later.
+%package -n libsensord-devel
+Summary:    Dummy package for backward compatibility
+Requires:   sensord-devel
+
+%description -n libsensord-devel
+Some packages require libsensord-devel directly, and it causes local gbs build failures
+with the old build snapshots. This is a temporal solution to handle such cases.
+
 %prep
 %setup -q
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIBDIR=%{_libdir} \
-        -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DPROFILE=%{BUILD_PROFILE}
+        -DMAJORVER=${MAJORVER} -DFULLVER=%{version}
 
 %build
 make %{?jobs:-j%jobs}
@@ -70,7 +86,6 @@ rm -rf %{buildroot}
 
 mkdir -p %{buildroot}%{_unitdir}
 
-%if "%{?BUILD_PROFILE}" != "tv"
 install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}
 install -m 0644 %SOURCE2 %{buildroot}%{_unitdir}
 install -m 0644 %SOURCE3 %{buildroot}%{_unitdir}
@@ -78,56 +93,52 @@ install -m 0644 %SOURCE3 %{buildroot}%{_unitdir}
 %install_service multi-user.target.wants sensord.service
 %install_service sockets.target.wants sensord_event.socket
 %install_service sockets.target.wants sensord_command.socket
-%endif
+
+ln -s libsensor.so.2 %{buildroot}%{_libdir}/libsensor.so.1
 
 %post
-systemctl daemon-reload
+/sbin/ldconfig
 
-%postun
-systemctl daemon-reload
+%files
+%manifest packaging/sensord.manifest
+%{_libdir}/libsensor.so.*
+%license LICENSE.APLv2
 
-%post -n libsensord
-ln -sf %{_libdir}/libsensor.so.%{version} %{_libdir}/libsensor.so.1
+%post   genuine
+pushd %{_libdir}
+ln -sf libsensor-genuine.so.%{version} libsensor.so.%{version}
+chsmack -a "_" libsensor.so.%{version}
+popd
 /sbin/ldconfig
 
-%postun -n libsensord
-/sbin/ldconfig
+%preun  genuine
+echo "You need to reinstall %{name}, if you need to keep using the APIs after uinstalling this."
 
-%files
+%files  genuine
 %manifest packaging/sensord.manifest
+%{_libdir}/libsensord-shared.so
+%{_libdir}/libsensor-genuine.so.*
 %{_bindir}/sensord
-%license LICENSE.APLv2
-
-%if "%{?BUILD_PROFILE}" != "tv"
 %{_unitdir}/sensord.service
 %{_unitdir}/sensord_command.socket
 %{_unitdir}/sensord_event.socket
 %{_unitdir}/multi-user.target.wants/sensord.service
 %{_unitdir}/sockets.target.wants/sensord_command.socket
 %{_unitdir}/sockets.target.wants/sensord_event.socket
-%endif
-
-%files -n libsensord
-%defattr(-,root,root,-)
-%manifest packaging/libsensord.manifest
-%{_libdir}/libsensor.so.*
-%{_libdir}/libsensord-shared.so
-%license LICENSE.APLv2
 
-%files -n libsensord-devel
-%defattr(-,root,root,-)
+%files  devel
+%manifest packaging/sensord.manifest
+%exclude %{_includedir}/sensor/sensor_hal.h
 %{_includedir}/sensor/*.h
 %{_libdir}/libsensor.so
 %{_libdir}/pkgconfig/sensor.pc
-%license LICENSE.APLv2
 
 %files -n sensor-hal-devel
-%defattr(-,root,root,-)
-%{_includedir}/sensor/sensor_hal.h
-%{_includedir}/sensor/sensor_hal_types.h
-%license LICENSE.APLv2
+%manifest packaging/sensord.manifest
+%{_includedir}/sensor/sensor_hal*.h
 
 %files -n sensor-test
-%defattr(-,root,root,-)
 %{_bindir}/sensorctl
+
+%files -n libsensord-devel
 %license LICENSE.APLv2
diff --git a/src/client-dummy/CMakeLists.txt b/src/client-dummy/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b0f48c2
--- /dev/null
@@ -0,0 +1,39 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(sensor CXX)
+
+SET(DEPENDENTS "glib-2.0 dlog")
+SET(VERSION ${FULLVER})
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(PC_NAME ${PROJECT_NAME})
+SET(PC_DESCRIPTION "Sensor Client library")
+SET(PC_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/sensor")
+SET(PC_REQUIRES "${DEPENDENTS}")
+SET(PC_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
+SET(PC_LDFLAGS "-l${PROJECT_NAME}")
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(DUMMY_PKGS REQUIRED ${DEPENDENTS})
+
+FOREACH(flag ${DUMMY_PKGS_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -g -fPIC")
+
+INCLUDE_DIRECTORIES(
+       ${CMAKE_SOURCE_DIR}/src/shared
+       ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+FILE(GLOB_RECURSE SRCS *.cpp)
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${DUMMY_PKGS_LDFLAGS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJORVER})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER})
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc @ONLY)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries)
+INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
diff --git a/src/client-dummy/client_deprecated.cpp b/src/client-dummy/client_deprecated.cpp
new file mode 100644 (file)
index 0000000..e721bed
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * sensord
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <sensor_internal_deprecated.h>
+
+#ifndef API
+#define API __attribute__((visibility("default")))
+#endif
+
+API int sf_connect(sensor_type_t sensor_type)
+{
+       return OP_ERROR;
+}
+
+API int sf_disconnect(int handle)
+{
+       return OP_ERROR;
+}
+
+API int sf_start(int handle, int option)
+{
+       return OP_ERROR;
+}
+
+API int sf_stop(int handle)
+{
+       return OP_ERROR;
+}
+
+API int sf_register_event(int handle, unsigned int event_type, event_condition_t *event_condition, sensor_callback_func_t cb, void *user_data)
+{
+       return OP_ERROR;
+}
+
+API int sf_unregister_event(int handle, unsigned int event_type)
+{
+       return OP_ERROR;
+}
+
+API int sf_change_event_condition(int handle, unsigned int event_type, event_condition_t *event_condition)
+{
+       return OP_ERROR;
+}
+
+API int sf_change_sensor_option(int handle, int option)
+{
+       return OP_ERROR;
+}
+
+API int sf_send_sensorhub_data(int handle, const char* data, int data_len)
+{
+       return OP_ERROR;
+}
+
+API int sf_get_data(int handle, unsigned int data_id, sensor_data_t* sensor_data)
+{
+       return OP_ERROR;
+}
+
+API int sf_check_rotation(unsigned long *rotation)
+{
+       return OP_ERROR;
+}
+
+API int sf_is_sensor_event_available(sensor_type_t sensor_type, unsigned int event_type)
+{
+       return OP_ERROR;
+}
similarity index 98%
rename from src/client/client_dummy.cpp
rename to src/client-dummy/client_dummy.cpp
index c7732a6..574079a 100644 (file)
@@ -20,8 +20,8 @@
 #include <errno.h>
 #include <sensor_common.h>
 
-#include "sensor_internal.h"
-#include "sensor_internal_deprecated.h"
+#include <sensor_internal.h>
+#include <sensor_internal_deprecated.h>
 
 API int sensord_get_sensors(sensor_type_t type, sensor_t **list, int *sensor_count)
 {
similarity index 93%
rename from src/client/external_client_dummy.cpp
rename to src/client-dummy/external_client_dummy.cpp
index 8f359d0..8eb9221 100644 (file)
@@ -20,8 +20,8 @@
 #include <errno.h>
 #include <sensor_common.h>
 
-#include "sensor_internal.h"
-#include "sensor_internal_deprecated.h"
+#include <sensor_internal.h>
+#include <sensor_internal_deprecated.h>
 
 API int sensord_external_connect(const char *key, sensor_external_command_cb_t cb, void *user_data)
 {
index 33ed7fa..9131d8d 100644 (file)
@@ -1,60 +1,28 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(sensor CXX)
+PROJECT(sensor-genuine CXX)
 
 SET(DEPENDENTS "vconf glib-2.0 gio-2.0 dlog")
-SET(VERSION ${FULLVER})
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(EXEC_PREFIX "${CMAKE_INSTALL_PREFIX}/bin")
-
-SET(PC_NAME ${PROJECT_NAME})
-SET(PC_DESCRIPTION "Sensor Client library")
-SET(PC_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/sensor")
-SET(PC_REQUIRES "${DEPENDENTS}")
-SET(PC_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
-SET(PC_LDFLAGS "-l${PROJECT_NAME}")
 
 INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(PKGS REQUIRED ${DEPENDENTS})
+PKG_CHECK_MODULES(CLIENT_PKGS REQUIRED ${DEPENDENTS})
 
-FOREACH(flag ${PKGS_CFLAGS})
+FOREACH(flag ${CLIENT_PKGS_CFLAGS})
        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
 ENDFOREACH(flag)
 
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -g -fPIC")
 
-SET (INSTALL_HEADERS
-       sensor_internal.h
-       sensor_internal_deprecated.h
-)
-
 INCLUDE_DIRECTORIES(
-       ${CMAKE_SOURCE_DIR}/src/hal
        ${CMAKE_SOURCE_DIR}/src/shared
        ${CMAKE_CURRENT_SOURCE_DIR}
 )
 
 FILE(GLOB_RECURSE SRCS *.cpp)
 
-IF("${PROFILE}" STREQUAL "tv")
-       LIST(REMOVE_ITEM SRCS
-               "${CMAKE_CURRENT_SOURCE_DIR}/client.cpp"
-               "${CMAKE_CURRENT_SOURCE_DIR}/external_client.cpp")
-ELSE()
-       LIST(REMOVE_ITEM SRCS
-               "${CMAKE_CURRENT_SOURCE_DIR}/client_dummy.cpp"
-               "${CMAKE_CURRENT_SOURCE_DIR}/external_client_dummy.cpp")
-ENDIF()
-
 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
 
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS} "sensord-shared")
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${CLIENT_PKGS_LDFLAGS} "sensord-shared")
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJORVER})
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER})
 
-CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc @ONLY)
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries)
-FOREACH(HEADER IN ITEMS ${INSTALL_HEADERS})
-       INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor)
-ENDFOREACH()
-INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-
+INSTALL(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} NAMELINK_SKIP)
diff --git a/src/hal/CMakeLists.txt b/src/hal/CMakeLists.txt
deleted file mode 100644 (file)
index 7119639..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(sensor-hal CXX)
-
-INSTALL(FILES sensor_hal.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-INSTALL(FILES sensor_hal_types.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
index 1accf2a..2b9c675 100644 (file)
@@ -25,4 +25,4 @@ FILE(GLOB_RECURSE SRCS *.cpp)
 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} sensor)
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin/)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
index 5d094ec..69b88ed 100644 (file)
@@ -11,13 +11,6 @@ FOREACH(flag ${SHARED_PKGS_CFLAGS})
 ENDFOREACH(flag)
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
 
-SET (INSTALL_HEADERS
-       sensor_types.h
-       sensor_common.h
-       sensor_deprecated.h
-       enum_factory.h
-)
-
 INCLUDE_DIRECTORIES(
        ${CMAKE_SOURCE_DIR}/src/hal
        ${CMAKE_CURRENT_SOURCE_DIR}
@@ -29,7 +22,3 @@ ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SHARED_PKGS_LDFLAGS})
 
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
-FOREACH(HEADER IN ITEMS ${INSTALL_HEADERS})
-       INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor)
-ENDFOREACH()
index 084e6b8..037ddc9 100644 (file)
@@ -17,6 +17,6 @@
  *
  */
 
-#include "sensor_types.h"
+#include <sensor_types.h>
 
 DECLARE_SENSOR_ENUM_UTIL(sensor_type_t, SENSOR_TYPE)