Gcov automation
[platform/core/messaging/msg-service.git] / packaging / msg-service.spec
index 25d3efc..077f0ef 100755 (executable)
@@ -1,11 +1,5 @@
-# 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
+Version:        1.0.11
 Release:        2
 License:        Apache-2.0
 Summary:        Messaging Framework Library
@@ -13,6 +7,7 @@ Group:          System/Libraries
 Source0:        %{name}-%{version}.tar.gz
 Source1:        msg-server.service
 Source2:        msg-server.socket
+Source3:        msg-server.asan.conf
 
 Requires(post): /usr/bin/sqlite3
 Requires(post): /sbin/ldconfig
@@ -33,7 +28,7 @@ BuildRequires: pkgconfig(capi-network-connection)
 BuildRequires: pkgconfig(capi-system-device)
 BuildRequires: pkgconfig(capi-system-info)
 BuildRequires: pkgconfig(capi-telephony)
-BuildRequires: pkgconfig(csr)
+BuildRequires: pkgconfig(contacts-service2)
 BuildRequires: pkgconfig(cynara-client)
 BuildRequires: pkgconfig(cynara-creds-commons)
 BuildRequires: pkgconfig(cynara-creds-socket)
@@ -48,22 +43,16 @@ BuildRequires: pkgconfig(json-glib-1.0)
 BuildRequires: pkgconfig(lbs-dbus)
 BuildRequires: pkgconfig(libcurl)
 BuildRequires: pkgconfig(libsmack)
-BuildRequires: pkgconfig(libsystemd-login)
+BuildRequires: pkgconfig(libsystemd)
 BuildRequires: pkgconfig(libtzplatform-config)
 BuildRequires: pkgconfig(libxml-2.0)
 BuildRequires: pkgconfig(libwbxml2)
 BuildRequires: pkgconfig(motion)
+BuildRequires: pkgconfig(phonenumber-utils)
 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
-# This is for backward compatibility. This does not damage 4.0 configurability
-# if mobile, common, or unified
-%if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi"
+# Below BuildRequires-statements are only for msg-manager
 BuildRequires: gettext-tools
 BuildRequires: hash-signer
 BuildRequires: pkgconfig(badge)
@@ -76,64 +65,23 @@ BuildRequires: pkgconfig(capi-media-sound-manager)
 BuildRequires: pkgconfig(capi-media-recorder)
 BuildRequires: pkgconfig(feedback)
 BuildRequires: pkgconfig(notification)
+
+%if 0%{?gcov:1}
+BuildRequires:  lcov
 %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
 Description: Messaging Framework Library (development)
 
-
-%package tools
-License:        Apache-2.0
-Summary:        Messaging server application
-Requires:       %{name} = %{version}-%{release}
-Group:          System/Libraries
-Requires(post): /usr/bin/sqlite3
-Requires(post): /sbin/ldconfig
-Requires(postun): /sbin/ldconfig
-
-%description tools
-Description:  Messaging server application
-
-
 %package -n sms-plugin
 License:        Apache-2.0
 Summary:        SMS plugin library
@@ -176,16 +124,28 @@ Description: Message manager application
 %define i586_option    "-D_TIZEN_I586_ENABLED:BOOL=OFF"
 %endif
 
+#################################################
+# gcov
+#################################################
+%if 0%{?gcov:1}
+%package gcov
+Summary:    Messaging Framework library (gcov)
+Group:      Service Framework/Testing
+%description gcov
+gcov objects for coverage test
+%endif
+
 %prep
 %setup -q
 
 %build
-# 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} \
+%if 0%{?gcov:1}
+export CFLAGS+=" -fprofile-arcs -ftest-coverage"
+export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
+export FFLAGS+=" -fprofile-arcs -ftest-coverage"
+export LDFLAGS+=" -lgcov"
+%endif
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
                -DLIB_INSTALL_DIR=%{_libdir} \
                -DAPP_MANIFESTDIR=%{TZ_SYS_RO_PACKAGES}   \
                -DAPP_BINDIR=%{APP_PREFIX}/bin   \
@@ -195,101 +155,21 @@ cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} \
                -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=ON
-
-make %{?jobs:-j%jobs}
-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"
-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
+               %{i586_option}
 
 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}
 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
+%if 0%{?gcov:1}
+builddir=$(basename $PWD)
+gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
+mkdir -p "$gcno_obj_dir"
+find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
 %endif
 
 %define tizen_sign 1
@@ -305,6 +185,10 @@ install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}/msg-server.service
 mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants
 install -m 0644 %SOURCE2 %{buildroot}%{_unitdir}/msg-server.socket
 %install_service sockets.target.wants msg-server.socket
+%if "%{asan}" == "1"
+mkdir -p %{buildroot}%{_unitdir}/msg-server.service.d
+install -m 644 %SOURCE3 %{buildroot}%{_unitdir}/msg-server.service.d/msg-server.asan.conf
+%endif
 
 mkdir -p %{buildroot}%{TZ_SYS_GLOBALUSER_DB}
 sqlite3 %{buildroot}%{TZ_SYS_GLOBALUSER_DB}/.msg_service.db "PRAGMA journal_mode = PERSIST;"
@@ -314,7 +198,10 @@ rm %{buildroot}/usr/share/msg-service/msg-service-db.sql
 rm %{buildroot}%{TZ_SYS_GLOBALUSER_DB}/.msg_service.db-journal
 touch %{buildroot}%{TZ_SYS_GLOBALUSER_DB}/.msg_service.db-journal
 
-%post tools
+%post -n sms-plugin -p /sbin/ldconfig
+%post -n mms-plugin -p /sbin/ldconfig
+
+%post
 /sbin/ldconfig
 
 chmod 640 %{TZ_SYS_GLOBALUSER_DB}/.msg_service.db
@@ -352,27 +239,16 @@ 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
-
-%post
-/sbin/ldconfig
-
 %postun -p /sbin/ldconfig
 
-%postun tools -p /sbin/ldconfig
 %postun -n sms-plugin -p /sbin/ldconfig
 %postun -n mms-plugin -p /sbin/ldconfig
 
 %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"
+%config(noreplace) %{TZ_SYS_GLOBALUSER_DB}/.msg_service.db*
 %{_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
@@ -381,75 +257,12 @@ 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
-%manifest msg-manager.manifest
-%license LICENSE.APLv2
-%{_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
-%manifest msg-manager.manifest
-%license LICENSE.APLv2
-%{_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
+%{_unitdir}/msg-server.service
+%{_unitdir}/multi-user.target.wants/msg-server.service
+%{_unitdir}/msg-server.socket
+%{_unitdir}/sockets.target.wants/msg-server.socket
+%if "%{asan}" == "1"
+%{_unitdir}/msg-server.service.d/msg-server.asan.conf
 %endif
 
 %files devel
@@ -458,15 +271,6 @@ echo "If you want to keep using %name after uninstalling this, you need to reins
 %{_libdir}/pkgconfig/msg-service.pc
 %{_includedir}/msg-service/*
 
-%files tools
-%manifest msg-service-tools.manifest
-%license LICENSE.APLv2
-%config(noreplace) %{TZ_SYS_GLOBALUSER_DB}/.msg_service.db*
-%{_unitdir}/msg-server.service
-%{_unitdir}/multi-user.target.wants/msg-server.service
-%{_unitdir}/msg-server.socket
-%{_unitdir}/sockets.target.wants/msg-server.socket
-
 %files -n sms-plugin
 %manifest sms-plugin.manifest
 %license LICENSE.APLv2
@@ -477,9 +281,6 @@ echo "If you want to keep using %name after uninstalling this, you need to reins
 %license LICENSE.APLv2
 %{_libdir}/libmsg_mms_plugin.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"
 %files -n msg-manager
 %manifest msg-manager.manifest
 %license LICENSE.APLv2
@@ -488,6 +289,10 @@ echo "If you want to keep using %name after uninstalling this, you need to reins
 %{APP_PREFIX}/author-signature.xml
 %{APP_PREFIX}/signature1.xml
 %{APP_RESDIR}/*
+
+%if 0%{?gcov:1}
+%files gcov
+%{_datadir}/gcov/obj/*
 %endif
 
 %changelog