Remove Profile Build Dependency 08/98908/7
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 21 Nov 2016 07:04:11 +0000 (16:04 +0900)
committerKyeonghun Lee <kh9090.lee@samsung.com>
Tue, 3 Jan 2017 06:24:21 +0000 (22:24 -0800)
- This is for Tizen 4.0.
  (4.0 Configurability & Building Blocks requires not to use
  profile macro soon.)

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

  - Add msg-service-profile_mobile for mobile profile.
  - Add msg-service-profile_wearable for wearable profile.

(patchset 6 has fixed mobile runtime issue)

Change-Id: Idad37ccea075ce56fde0109eeb22de17788a7bf8
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
packaging/msg-service.spec

index 6b026aa..a1d4f8c 100755 (executable)
@@ -1,3 +1,9 @@
+# Do not provide .so automatically for the extensions.
+# This if statement is for backward compatibility with GBM/Obsolete build systems
+%if "%{?profile}" != "wearable" && "%{?profile}" != "mobile"
+%global __provides_exclude_from ^.*\\.(wearable|mobile)$
+%endif
+
 Name:           msg-service
 Version:        1.0.9
 Release:        2
@@ -50,10 +56,14 @@ BuildRequires: pkgconfig(motion)
 BuildRequires: pkgconfig(sqlite3)
 BuildRequires: pkgconfig(tapi)
 BuildRequires: pkgconfig(vconf)
+# This is for backward compatibility. This does not damage 4.0 configurability
+# if mobile, common, tv, ivi, or undefined
 %if "%{?profile}" != "wearable"
 BuildRequires: pkgconfig(contacts-service2)
 %endif
-%if "%{?profile}" == "mobile"
+# This is for backward compatibility. This does not damage 4.0 configurability
+# if mobile, common, or unified
+%if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi"
 BuildRequires: gettext-tools
 BuildRequires: hash-signer
 BuildRequires: pkgconfig(badge)
@@ -67,15 +77,44 @@ BuildRequires: pkgconfig(capi-media-recorder)
 BuildRequires: pkgconfig(feedback)
 BuildRequires: pkgconfig(notification)
 %endif
+Provides: %{name}-profile_common = %{version}-%{release}
+Provides: %{name}-profile_ivi = %{version}-%{release}
+Provides: %{name}-profile_tv = %{version}-%{release}
 
 %description
 Description: Messaging Framework Library
 
+%package profile_mobile
+summary:    msg-service extension for mobile profile
+requires:   %{name} = %{version}-%{release}
+conflicts:  %{name}-profile_wearable
+%description profile_mobile
+messaging framework library extension for tizen mobile profile.
+this overwrites some of msg-service binaries; thus, you need to
+reinstall msg-service if you want to keep using msg-service after
+uninstalling this package.
+
+%package profile_wearable
+summary:    msg-service extension for wearable profile
+requires:   %{name} = %{version}-%{release}
+conflicts:  %{name}-profile_mobile
+%description profile_wearable
+messaging framework library extension for tizen wearable profile.
+this overwrites some of msg-service binaries; thus, you need to
+reinstall msg-service if you want to keep using msg-service after
+uninstalling this package.
 
 %package devel
 License:        Apache-2.0
 Summary:        Messaging Framework Library (development)
 Requires:       %{name} = %{version}-%{release}
+# This if statement is for backward compatibility with GBM/Obsolete build systems
+%if "%{profile}" == "wearable"
+Requires:       %{name}-profile_wearable
+%endif
+%if "%{profile}" == "mobile"
+Requires:       %{name}-profile_mobile
+%endif
 Group:          Development/Libraries
 
 %description devel
@@ -126,48 +165,81 @@ Group:          Applications/Messaging
 %description -n msg-manager
 Description: Message manager application
 
-%if "%{?profile}" == "mobile"
 %define APP_PKGNAME    org.tizen.msg-manager
 %define APP_PREFIX     %{TZ_SYS_RO_APP}/%{APP_PKGNAME}
-%define APP_BINDIR     %{APP_PREFIX}/bin
 %define APP_RESDIR     %{APP_PREFIX}/res
 %define APP_LOCALEDIR  %{APP_RESDIR}/locale
-%define APP_MANIFESTDIR        %{TZ_SYS_RO_PACKAGES}
+
+%ifarch i586
+%define i586_option    "-D_TIZEN_I586_ENABLED:BOOL=ON"
+%else
+%define i586_option    "-D_TIZEN_I586_ENABLED:BOOL=OFF"
 %endif
 
 %prep
 %setup -q
 
 %build
-cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+# This is for backward compatibility. This does not damage 4.0 configurability
+# if mobile, common, or unified
+%if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi"
+mkdir -p build_mobile
+pushd build_mobile
+cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} \
                -DLIB_INSTALL_DIR=%{_libdir} \
-%if "%{?profile}" == "mobile"
-               -DAPP_MANIFESTDIR=%{APP_MANIFESTDIR}   \
-               -DAPP_BINDIR=%{APP_BINDIR}   \
-               -DAPP_LOCALEDIR=%{APP_LOCALEDIR}   \
-%endif
+               -DAPP_MANIFESTDIR=%{TZ_SYS_RO_PACKAGES}   \
+               -DAPP_BINDIR=%{APP_PREFIX}/bin   \
+               -DAPP_LOCALEDIR=%{APP_RESDIR}/locale \
                -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP \
                -DTZ_SYS_GLOBALUSER_DATA=%TZ_SYS_GLOBALUSER_DATA \
                -DTZ_SYS_GLOBALUSER_DB=%TZ_SYS_GLOBALUSER_DB \
                -DTZ_SYS_HOME=%TZ_SYS_HOME \
                -DTZ_SYS_BIN=%TZ_SYS_BIN \
-%ifarch i586
--D_TIZEN_I586_ENABLED:BOOL=ON \
-%else
--D_TIZEN_I586_ENABLED:BOOL=OFF \
-%endif
-%if "%{?profile}" == "wearable"
--D_MSG_WEARABLE_PROFILE:BOOL=ON \
-%else
--D_MSG_WEARABLE_PROFILE:BOOL=OFF \
+               %{i586_option} \
+               -D_MSG_WEARABLE_PROFILE:BOOL=OFF \
+               -D_MSG_MOBILE_PROFILE:BOOL=ON
+
+make %{?jobs:-j%jobs}
+popd
 %endif
-%if "%{?profile}" == "mobile"
--D_MSG_MOBILE_PROFILE:BOOL=ON \
-%else
--D_MSG_MOBILE_PROFILE:BOOL=OFF \
+
+# This is for backward compatibility. This does not damage 4.0 configurability
+# if wearable, common, or unified
+%if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi"
+mkdir -p build_wearable
+pushd build_wearable
+cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+               -DLIB_INSTALL_DIR=%{_libdir} \
+               -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP \
+               -DTZ_SYS_GLOBALUSER_DATA=%TZ_SYS_GLOBALUSER_DATA \
+               -DTZ_SYS_GLOBALUSER_DB=%TZ_SYS_GLOBALUSER_DB \
+               -DTZ_SYS_HOME=%TZ_SYS_HOME \
+               -DTZ_SYS_BIN=%TZ_SYS_BIN \
+               %{i586_option} \
+               -D_MSG_WEARABLE_PROFILE:BOOL=ON \
+               -D_MSG_MOBILE_PROFILE:BOOL=OFF
+
+make %{?jobs:-j%jobs}
+popd
 %endif
 
+# This is for backward compatibility. This does not damage 4.0 configurability
+# if common, ivi, tv, or unified
+%if "%{?profile}" != "mobile" && "%{?profile}" != "wearable"
+
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+               -DLIB_INSTALL_DIR=%{_libdir} \
+               -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP \
+               -DTZ_SYS_GLOBALUSER_DATA=%TZ_SYS_GLOBALUSER_DATA \
+               -DTZ_SYS_GLOBALUSER_DB=%TZ_SYS_GLOBALUSER_DB \
+               -DTZ_SYS_HOME=%TZ_SYS_HOME \
+               -DTZ_SYS_BIN=%TZ_SYS_BIN \
+               %{i586_option} \
+               -D_MSG_WEARABLE_PROFILE:BOOL=OFF \
+               -D_MSG_MOBILE_PROFILE:BOOL=OFF
+
 make %{?jobs:-j%jobs}
+%endif
 
 %install
 rm -rf %{buildroot}
@@ -176,7 +248,50 @@ mkdir -p %{buildroot}/etc/config
 mkdir -p %{buildroot}/usr/share/upgrade/scripts
 cp -f 500.msg-service.sh %{buildroot}/usr/share/upgrade/scripts
 
+# These .so files differ per profile. (sms/mms-plugin do not differ.)
+LIB_PER_PROFILE="libmsg_plugin_manager.so
+libmsg_framework_handler.so
+libmsg_transaction_manager.so
+libmsg_utils.so
+libmsg_externals.so
+libmsg_transaction_proxy.so
+libmsg_vobject.so"
+
+# This is for backward compatibility. This does not damage 4.0 configurability
+# if mobile, common, or unified
+%if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi"
+pushd build_mobile
+%make_install
+popd
+pushd %{buildroot}%{_libdir}
+for FILE in $LIB_PER_PROFILE; do mv "${FILE}" "${FILE}.mobile"; done
+for FILE in libmsg_mapi*.so.*; do if [[ $FILE =~ .*mobile$ ]]; then echo skip "${FILE}"; else mv "${FILE}" "${FILE}.mobile"; fi; done
+popd
+pushd %{buildroot}%{_bindir}
+mv msg-server msg-server.mobile
+popd
+%endif
+
+# This is for backward compatibility. This does not damage 4.0 configurability
+# if wearable, common, or unified
+%if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi"
+pushd build_wearable
+%make_install
+popd
+pushd %{buildroot}%{_libdir}
+for FILE in $LIB_PER_PROFILE; do mv "${FILE}" "${FILE}.wearable"; done
+for FILE in libmsg_mapi*.so.*; do if [[ $FILE =~ .*mobile$ ]]; then echo skip "${FILE}"; else mv "${FILE}" "${FILE}.wearable"; fi; done
+popd
+pushd %{buildroot}%{_bindir}
+mv msg-server msg-server.wearable
+popd
+%endif
+
+# This is for backward compatibility. This does not damage 4.0 configurability
+# if common, ivi, tv, or unified
+%if "%{?profile}" != "mobile" && "%{?profile}" != "wearable"
 %make_install
+%endif
 
 %define tizen_sign 1
 %define tizen_sign_base %{APP_PREFIX}
@@ -237,6 +352,7 @@ chsmack -a "System::Shared" %{TZ_SYS_GLOBALUSER_DATA}/msg-service/msgdata/thumbn
 chmod o= %{TZ_SYS_GLOBALUSER_DATA}/msg-service/ipcdata
 setfacl -m group:priv_message_write:rw %{TZ_SYS_GLOBALUSER_DATA}/msg-service/ipcdata
 
+
 %post -n sms-plugin -p /sbin/ldconfig
 %post -n mms-plugin -p /sbin/ldconfig
 
@@ -252,7 +368,12 @@ setfacl -m group:priv_message_write:rw %{TZ_SYS_GLOBALUSER_DATA}/msg-service/ipc
 %files
 %manifest msg-service.manifest
 %license LICENSE.APLv2
+# This is for backward compatibility. This does not damage 4.0 configurability
+# if common, ivi, tv, or unified
+%if "%{?profile}" != "mobile" && "%{?profile}" != "wearable"
 %{_bindir}/msg-server
+%exclude %{_libdir}/libmsg_*.wearable
+%exclude %{_libdir}/libmsg_*.mobile
 %{_libdir}/libmsg_plugin_manager.so
 %{_libdir}/libmsg_mapi.so.*
 %{_libdir}/libmsg_framework_handler.so
@@ -261,8 +382,73 @@ setfacl -m group:priv_message_write:rw %{TZ_SYS_GLOBALUSER_DATA}/msg-service/ipc
 %{_libdir}/libmsg_externals.so
 %{_libdir}/libmsg_transaction_proxy.so
 %{_libdir}/libmsg_vobject.so
+%endif
 /usr/share/upgrade/scripts/500.msg-service.sh
 
+# This is for backward compatibility. This does not damage 4.0 configurability
+# if mobile, common, or unified
+%if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi"
+%post profile_mobile
+mv %{_bindir}/msg-server.mobile %{_bindir}/msg-server
+pushd %{_libdir}
+mv libmsg_plugin_manager.so.mobile libmsg_plugin_manager.so
+for FILE in libmsg_mapi.so.*.mobile; do mv "${FILE}" "${FILE%.mobile}"; done
+mv libmsg_framework_handler.so.mobile libmsg_framework_handler.so
+mv libmsg_transaction_manager.so.mobile libmsg_transaction_manager.so
+mv libmsg_utils.so.mobile libmsg_utils.so
+mv libmsg_externals.so.mobile libmsg_externals.so
+mv libmsg_transaction_proxy.so.mobile libmsg_transaction_proxy.so
+mv libmsg_vobject.so.mobile libmsg_vobject.so
+popd
+/sbin/ldconfig
+%postun profile_mobile
+/sbin/ldconfig
+%preun profile_mobile
+echo "If you want to keep using %name after uninstalling this, you need to reinstall %name after uninstalling this."
+%files profile_mobile
+%{_bindir}/msg-server.mobile
+%{_libdir}/libmsg_plugin_manager.so.mobile
+%{_libdir}/libmsg_mapi.so.*.mobile
+%{_libdir}/libmsg_framework_handler.so.mobile
+%{_libdir}/libmsg_transaction_manager.so.mobile
+%{_libdir}/libmsg_utils.so.mobile
+%{_libdir}/libmsg_externals.so.mobile
+%{_libdir}/libmsg_transaction_proxy.so.mobile
+%{_libdir}/libmsg_vobject.so.mobile
+%endif
+
+# This is for backward compatibility. This does not damage 4.0 configurability
+# if wearable, common, or unified
+%if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi"
+%post profile_wearable
+mv %{_bindir}/msg-server.wearable %{_bindir}/msg-server
+pushd %{_libdir}
+mv libmsg_plugin_manager.so.wearable libmsg_plugin_manager.so
+for FILE in libmsg_mapi.so.*.wearable; do mv "${FILE}" "${FILE%.wearable}"; done
+mv libmsg_framework_handler.so.wearable libmsg_framework_handler.so
+mv libmsg_transaction_manager.so.wearable libmsg_transaction_manager.so
+mv libmsg_utils.so.wearable libmsg_utils.so
+mv libmsg_externals.so.wearable libmsg_externals.so
+mv libmsg_transaction_proxy.so.wearable libmsg_transaction_proxy.so
+mv libmsg_vobject.so.wearable libmsg_vobject.so
+popd
+/sbin/ldconfig
+%postun profile_wearable
+/sbin/ldconfig
+%preun profile_wearable
+echo "If you want to keep using %name after uninstalling this, you need to reinstall %name after uninstalling this."
+%files profile_wearable
+%{_bindir}/msg-server.wearable
+%{_libdir}/libmsg_plugin_manager.so.wearable
+%{_libdir}/libmsg_mapi.so.*.wearable
+%{_libdir}/libmsg_framework_handler.so.wearable
+%{_libdir}/libmsg_transaction_manager.so.wearable
+%{_libdir}/libmsg_utils.so.wearable
+%{_libdir}/libmsg_externals.so.wearable
+%{_libdir}/libmsg_transaction_proxy.so.wearable
+%{_libdir}/libmsg_vobject.so.wearable
+%endif
+
 %files devel
 %license LICENSE.APLv2
 %{_libdir}/libmsg_mapi.so
@@ -288,12 +474,14 @@ setfacl -m group:priv_message_write:rw %{TZ_SYS_GLOBALUSER_DATA}/msg-service/ipc
 %license LICENSE.APLv2
 %{_libdir}/libmsg_mms_plugin.so
 
-%if "%{?profile}" == "mobile"
+# This is for backward compatibility. This does not damage 4.0 configurability
+# if mobile, common, or unified
+%if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi"
 %files -n msg-manager
 %manifest msg-manager.manifest
 %license LICENSE.APLv2
-%{APP_BINDIR}/msg-manager
-%{APP_MANIFESTDIR}/*.xml
+%{APP_PREFIX}/bin/msg-manager
+%{TZ_SYS_RO_PACKAGES}/*.xml
 %{APP_PREFIX}/author-signature.xml
 %{APP_PREFIX}/signature1.xml
 %{APP_RESDIR}/*