Remove Profile Build Dependency 77/97077/14
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Fri, 11 Nov 2016 06:13:18 +0000 (15:13 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Mon, 2 Jan 2017 06:12:38 +0000 (15:12 +0900)
- This is for Tizen 4.0.

- When SR-ing this, you need to create JIRA-TRE issue of:

  Add capi-system-sensor-profile_mobile for mobile profile
  Add capi-system-sensor-profile_wearable for wearable profile

Change-Id: I150ade04716ee3c1f0d5aefa7f4de82a177d66a7
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
CMakeLists.txt
packaging/capi-system-sensor.spec
src/sensor_dummy.cpp [deleted file]

index 9d13cf6..6f1a62b 100644 (file)
@@ -4,7 +4,7 @@ INCLUDE(GNUInstallDirs)
 
 SET(DEPENDENTS "dlog sensor capi-base-common")
 
-IF(NOT "${PROFILE}" STREQUAL "tv")
+IF("${SENSOR_RECORDER}" STREQUAL "on")
        SET(DEPENDENTS "${DEPENDENTS} context-common")
 ENDIF()
 
@@ -37,15 +37,14 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl, --rpath=${LIB_INSTALL_DIR}")
 #ADD_DEFINITIONS("-DTIZEN_DEBUG")
 
 # Compile Source files
-SET(SOURCES src/geomagnetic_field.c
-            src/fusion_util.c)
+SET(SOURCES src/sensor.cpp
+                       src/geomagnetic_field.c
+                       src/fusion_util.c)
 
-IF("${PROFILE}" STREQUAL "tv")
-       SET(SOURCES ${SOURCES} src/sensor_dummy.cpp)
-       SET(SOURCES ${SOURCES} src/sensor_recorder_dummy.cpp)
-ELSE()
-       SET(SOURCES ${SOURCES} src/sensor.cpp)
+IF("${SENSOR_RECORDER}" STREQUAL "on")
        SET(SOURCES ${SOURCES} src/sensor_recorder.cpp)
+ELSE()
+       SET(SOURCES ${SOURCES} src/sensor_recorder_dummy.cpp)
 ENDIF()
 
 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SOURCES})
index 3386ef0..703a4d0 100644 (file)
@@ -1,26 +1,50 @@
+# Do not provide .so automatically for the extensions.
+%global __provides_exclude_from ^.*\\.recorder
+
 Name:       capi-system-sensor
 Summary:    A Sensor library in TIZEN C API
-Version:    0.2.3
-Release:    0
+Version:    0.2.4
+Release:    1
 Group:      System/API
 License:    Apache-2.0 and PD
 Source0:    %{name}-%{version}.tar.gz
 
-%define BUILD_PROFILE %{?profile}%{!?profile:%{?tizen_profile_name}}
-
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(sensor)
 BuildRequires:  pkgconfig(capi-base-common)
-%if "%{?BUILD_PROFILE}" != "tv"
+# This is for backward-compatibility. This does not deteriorate 4.0 Configurability
+# if mobile || wearable || common || "undefined"
+%if "%{?profile}" != "tv" && "%{?profile}" != "ivi"
 BuildRequires:  pkgconfig(context-common)
 %endif
+
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
+Provides: %{name}-profile_tv = %{version}-%{release}
+Provides: %{name}-profile_ivi = %{version}-%{release}
+Provides: %{name}-profile_common = %{version}-%{release}
+
 %description
 A Sensor Library in TIZEN C API package.
 
+# This is for backward-compatibility. This does not deteriorate 4.0 Configurability
+# if mobile || wearable || common || "undefined"
+%if "%{?profile}" != "tv" && "%{?profile}" != "ivi"
+%package extension-recorder
+Summary:  capi-system-sensor extension with sensor recorder (for mobile/wearable)
+Requires: %{name} = %{version}-%{release}
+Provides: %{name}-profile_mobile = %{version}-%{release}
+Provides: %{name}-profile_wearable = %{version}-%{release}
+
+%description extension-recorder
+Binary replacing extension for capi-system-sensor supporting recorder.
+This extension targets Tizen mobile/wearable profiles.
+If you want to keep using %{name} after uninstalling this extension,
+you need to reinstall %{name} after uninstalling this extension.
+%endif
+
 %package devel
 Summary:  A Sensor library in TIZEN C API (Development)
 Group:    System/Development
@@ -35,11 +59,34 @@ A Sensor library in TIZEN C API package (Development).
 
 %build
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DPROFILE=%{BUILD_PROFILE}
+
+# This is for backward-compatibility. This does not deteriorate 4.0 Configurability
+# if mobile || wearable || common || "undefined"
+%if "%{?profile}" != "tv" && "%{?profile}" != "ivi"
+mkdir -p build_extension
+pushd build_extension
+%cmake .. -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DSENSOR_RECORDER=on
+%__make %{?_smp_mflags}
+popd
+%endif
+
+%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DSENSOR_RECORDER=off
 %__make %{?_smp_mflags}
 
 %install
 rm -rf %{buildroot}
+
+# This is for backward-compatibility. This does not deteriorate 4.0 Configurability
+# if mobile || wearable || common || "undefined"
+%if "%{?profile}" != "tv" && "%{?profile}" != "ivi"
+pushd build_extension
+%make_install
+popd
+pushd %{buildroot}%{_libdir}/
+for FILE in libcapi-system-sensor.so.*; do mv "${FILE}" "${FILE}.recorder"; done
+popd
+%endif
+
 %make_install
 
 %post -p /sbin/ldconfig
@@ -48,6 +95,7 @@ rm -rf %{buildroot}
 
 %files
 %manifest packaging/capi-system-sensor.manifest
+%exclude %{_libdir}/libcapi-system-sensor.so.*.recorder
 %{_libdir}/libcapi-system-sensor.so.*
 %license LICENSE.APLv2
 
@@ -57,3 +105,18 @@ rm -rf %{buildroot}
 %{_libdir}/pkgconfig/*.pc
 %{_includedir}/sensor/*.h
 %license LICENSE.APLv2
+
+# This is for backward-compatibility. This does not deteriorate 4.0 Configurability
+# if mobile || wearable || common || "undefined"
+%if "%{?profile}" != "tv" && "%{?profile}" != "ivi"
+%post extension-recorder
+pushd %{_libdir}
+for FILE in libcapi-system-sensor.so.*.recorder; do ln -sf "${FILE}" "${FILE%.recorder}"; done
+popd
+
+%preun extension-recorder
+echo "You need to reinstall %{name} if you want to keep using %{name} after uninstalling this extension."
+
+%files extension-recorder
+%{_libdir}/libcapi-system-sensor.so.*.recorder
+%endif
diff --git a/src/sensor_dummy.cpp b/src/sensor_dummy.cpp
deleted file mode 100644 (file)
index 8f07d44..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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.h>
-
-int sensor_is_supported(sensor_type_e type, bool *supported)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_get_default_sensor(sensor_type_e type, sensor_h *sensor)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_get_sensor_list(sensor_type_e type, sensor_h **list, int *sensor_count)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_is_wake_up(sensor_h sensor, bool *wakeup)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_create_listener(sensor_h sensor, sensor_listener_h *listener)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_destroy_listener(sensor_listener_h listener)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_listener_start(sensor_listener_h listener)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_listener_stop(sensor_listener_h listener)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_listener_set_event_cb(sensor_listener_h listener,
-               unsigned int interval, sensor_event_cb callback, void *user_data)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_listener_unset_event_cb(sensor_listener_h listener)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_listener_set_accuracy_cb(sensor_listener_h listener,
-               sensor_accuracy_changed_cb callback, void *data)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_listener_unset_accuracy_cb(sensor_listener_h listener)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_listener_set_interval(sensor_listener_h listener, unsigned int interval)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_listener_set_max_batch_latency(sensor_listener_h listener, unsigned int max_batch_latency)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_listener_set_attribute_int(sensor_listener_h listener, sensor_attribute_e attribute, int value)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_listener_set_option(sensor_listener_h listener, sensor_option_e option)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_listener_read_data(sensor_listener_h listener, sensor_event_s *event)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_get_name(sensor_h sensor, char** name)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_get_vendor(sensor_h sensor, char** vendor)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_get_type(sensor_h sensor, sensor_type_e *type)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_get_min_range(sensor_h sensor, float *min_range)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_get_max_range(sensor_h sensor, float *max_range)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_get_resolution(sensor_h sensor, float *resolution)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_get_min_interval(sensor_h sensor, int *min_interval)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_get_fifo_count(sensor_h sensor, int *fifo_count)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_get_max_batch_count(sensor_h sensor, int *max_batch_count)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-/*
- *     FUNCTIONS : SENSOR_UTIL_*
- */
-
-int sensor_util_get_declination(float latitude, float longitude, float altitude, float *declination)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_util_get_angle_change(float R[], float prevR[], float angleChange[])
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_util_get_orientation(float R[], float values[])
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_util_get_inclination(float I[], float* inclination)
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_util_remap_coordinate_system(float inR[], sensor_util_axis_e x, sensor_util_axis_e y, float outR[])
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_util_get_rotation_matrix_from_vector(float Vx, float Vy, float Vz, float R[])
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-
-int sensor_util_get_rotation_matrix(float Gx, float Gy, float Gz, float Mx, float My, float Mz, float R[], float I[])
-{
-       return SENSOR_ERROR_NOT_SUPPORTED;
-}
-