[Tizen] Remove profile build dependencies 50/114850/2 accepted/tizen/common/20170216.094146 accepted/tizen/ivi/20170216.095313 accepted/tizen/mobile/20170216.095240 accepted/tizen/tv/20170222.095222 accepted/tizen/wearable/20170216.095259 submit/tizen/20170216.055551 submit/tizen_tv/20170222.020329
authorhk57.kim <hk57.kim@samsung.com>
Wed, 15 Feb 2017 08:37:54 +0000 (17:37 +0900)
committerhk57.kim <hk57.kim@samsung.com>
Wed, 15 Feb 2017 08:48:47 +0000 (17:48 +0900)
- This is for Tizen 4.0.
- Added backward-compatibility that does not deteriorate 4.0 Configurability

- When you SR this, you need to create JIRA-TRE issue of:
  : add calendar-service-extension-tv for TV

(It's add, not replace.)

Change-Id: I8bcddae316cb5b71887689f18373856e88bfedef
Signed-off-by: hk57.kim <hk57.kim@samsung.com>
packaging/calendar-service.spec

index 393cedd..e70908a 100644 (file)
@@ -1,3 +1,7 @@
+# Do not create provides fro extension-tv because the main package
+# should anchor any reverse-dependencies
+%global __provides_exclude_from ^(.*\\.tv)$
+
 Name:       calendar-service
 Summary:    DB library for calendar
 Version:    0.1.175
@@ -27,25 +31,34 @@ Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
 # This is for backward-compatibility. This does not deteriorate 4.0 Configurability
+# TV profile does not have contacts-service2.
+# if wearable, ivi, common, mobile ||"undefined"
+%if "%{?profile}" != "tv"
+BuildRequires: pkgconfig(accounts-svc)
+BuildRequires: pkgconfig(contacts-service2)
+%endif
+
+%description
+Calendar Service for using Calendar DB
+
+# This is for backward-compatibility. This does not deteriorate 4.0 Configurability
 # Dummy contacts for TV product optimization.
 # Note that even if it includes contacts-service2, the behavior is not chanaged
 # because the code determines profile at runtime.
-# if tv
-%if "%{?profile}" == "tv"
+# if tv ||"undefined"
+%if "%{?profile}" != "wearable" && "%{?profile}" != "ivi" && "%{?profile}" != "common" && "%{?profile}" != "mobile"
+%package extension-tv
+Summary:       Extension for TV
+Requires:      %{name} = %{version}-%{release}
 Source3:       dummy_account.h
 Source4:       dummy_contacts.h
-%else
-# TV profile does not have contacts-service2.
-# Do not build for unified environment if it is TV.
-BuildRequires: pkgconfig(accounts-svc)
-BuildRequires: pkgconfig(contacts-service2)
+%description extension-tv
+Calendar Service for using Dummy contacts for TV
 %endif
 
 %define _dbus_interface org.tizen.CalendarService.dbus
 %define upgrade_script_path /usr/share/upgrade/scripts
 
-%description
-Calendar Service for using Calendar DB
 
 %package devel
 Summary:    DB library for calendar
@@ -65,37 +78,59 @@ cp %SOURCE1001 .
 
 %build
 
-# This is for backward-compatibility. This does not deteriorate 4.0 Configurability
-# TV profile does not have contacts-service2.
-# Do not build for unified environment if it is TV.
-# if tv
-%if "%{?profile}" == "tv"
-cp %SOURCE3 server/account.h
-cp %SOURCE4 server/contacts.h
-%endif
-
 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
 
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+
+# This is for backward-compatibility. This does not deteriorate 4.0 Configurability
+# if tv ||"undefined"
+%if "%{?profile}" != "wearable" && "%{?profile}" != "ivi" && "%{?profile}" != "common" && "%{?profile}" != "mobile"
+# extension-tv
+cp %SOURCE3 server/account.h
+cp %SOURCE4 server/contacts.h
 %cmake . -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DBIN_INSTALL_DIR:PATH=%{_bindir} \
                -DDBUS_INTERFACE=%{_dbus_interface} \
-%if "%{?profile}" == "tv"
                -DTIZEN_WITHOUT_CONTACTS="1"
+
+make %{?jobs:-j%jobs}
+
+%make_install
+mkdir -p build_tv
+mv %{buildroot}%{_bindir}/calendar-serviced* build_tv/
+mv %{buildroot}%{_libdir}/lib%{name}2.so.* build_tv/
 %endif
 
+# This is for backward-compatibility. This does not deteriorate 4.0 Configurability
+# TV profile does not have contacts-service2.
+# if wearable, ivi, common, mobile ||"undefined"
+%if "%{?profile}" != "tv"
+# non-TV
+%cmake . -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DBIN_INSTALL_DIR:PATH=%{_bindir} \
+               -DDBUS_INTERFACE=%{_dbus_interface} \
+               -DTIZEN_WITHOUT_CONTACTS="0"
 
 make %{?jobs:-j%jobs}
-
+%endif
 
 %install
 rm -rf %{buildroot}
+%make_install
+
+# This is for backward-compatibility. This does not deteriorate 4.0 Configurability
+# if tv ||"undefined"
+%if "%{?profile}" != "wearable" && "%{?profile}" != "ivi" && "%{?profile}" != "common" && "%{?profile}" != "mobile"
+# extension-tv
+cp -f build_tv/calendar-serviced %{buildroot}%{_bindir}/calendar-serviced.tv
+pushd build_tv
+for FILE in lib%{name}2.so.*; do cp -f "$FILE" "%{buildroot}%{_libdir}/$FILE.tv"; done
+popd
+%endif
+
 mkdir -p %{buildroot}%{upgrade_script_path}
 cp -f scripts/500.%{name}.sh %{buildroot}%{upgrade_script_path}
 
-%make_install
-
 mkdir -p %{buildroot}%{_unitdir_user}/default.target.wants
 install -m 0644 %SOURCE1 %{buildroot}%{_unitdir_user}
 
@@ -117,11 +152,54 @@ install -m 0644 %SOURCE2001 %{buildroot}%{_datadir}/dbus-1/services
 %postun -p /sbin/ldconfig
 
 
+# This is for backward-compatibility. This does not deteriorate 4.0 Configurability
+# if tv ||"undefined"
+%if "%{?profile}" != "wearable" && "%{?profile}" != "ivi" && "%{?profile}" != "common" && "%{?profile}" != "mobile"
+
+%post extension-tv
+pushd %{_bindir}
+for FILE in calendar-serviced*.tv; do ln -sf "$FILE" "${FILE%.tv}"; done
+popd
+pushd %{_libdir}
+for FILE in lib%{name}2.so.*.tv; do ln -sf "$FILE" "${FILE%.tv}"; done
+popd
+/sbin/ldconfig
+
+%preun extension-tv
+case "$1" in
+  0)
+    # This is an un-installation.
+       rm %{_bindir}/calendar-serviced*
+       rm %{_libdir}/lib%{name}2.so.*
+       /sbin/ldconfig
+  ;;
+  1)
+    # This is an upgrade.
+    # Do nothing.
+    :
+  ;;
+esac
+
+%files extension-tv
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+%{_bindir}/calendar-serviced*.tv
+%{_libdir}/lib%{name}2.so.*.tv
+%endif
+
+
 %files
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
 %{_bindir}/calendar-serviced*
 %{_libdir}/lib%{name}2.so.*
+# This is for backward-compatibility. This does not deteriorate 4.0 Configurability
+# if tv ||"undefined"
+%if "%{?profile}" != "wearable" && "%{?profile}" != "ivi" && "%{?profile}" != "common" && "%{?profile}" != "mobile"
+# extension-tv
+%exclude %{_bindir}/calendar-serviced*.tv
+%exclude %{_libdir}/lib%{name}2.so.*.tv
+%endif
 %{_unitdir_user}/%{name}d.service
 %{_datadir}/dbus-1/services/%{_dbus_interface}.service
 %config %{_sysconfdir}/dbus-1/session.d/%{name}.conf