Make a gcov package for measuring coverage easier 04/209704/4
authormk5004.lee <mk5004.lee@samsung.com>
Wed, 10 Jul 2019 05:51:44 +0000 (14:51 +0900)
committermk5004.lee <mk5004.lee@samsung.com>
Wed, 10 Jul 2019 08:04:09 +0000 (17:04 +0900)
Change-Id: Iea7e015b8b0278fc1315c1a70e14f53b337c36bf
Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
packaging/badge.spec

index 218838e..2c4c4cc 100644 (file)
@@ -22,9 +22,6 @@ requires(postun): /sbin/ldconfig
 %description
 Client/Server library for updating badge information
 
-%prep
-%setup -q
-
 %package devel
 Summary:    Badge library (devel)
 Group:      Development/Libraries
@@ -41,8 +38,27 @@ Requires:   %{name} = %{version}-%{release}
 %description service-devel
 Development files needed to build badge service
 
+%if 0%{?gcov:1}
+%package gcov
+Summary:  Badge library (gcov)
+Group:    System/API
+
+%description gcov
+gcov objects of a Badge library
+%endif
+
+%prep
+%setup -q
+
 %build
-export LDFLAGS+="-Wl,--rpath=%{_prefix}/lib -Wl,--as-needed"
+%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
+
+export LDFLAGS+=" -Wl,--rpath=%{_prefix}/lib -Wl,--as-needed"
 LDFLAGS="$LDFLAGS"
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 %cmake . \
@@ -50,9 +66,20 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
        -DFULLVER=%{version}
 make %{?jobs:-j%jobs}
 
+%if 0%{?gcov:1}
+mkdir -p gcov-obj
+find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
+%endif
+
 %install
+
 %make_install
 
+%if 0%{?gcov:1}
+mkdir -p %{buildroot}%{_datadir}/gcov/obj
+install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
+%endif
+
 %post
 /sbin/ldconfig
 
@@ -89,3 +116,10 @@ fi
 %{_includedir}/badge/badge_ipc.h
 %{_libdir}/pkgconfig/%{name}.pc
 %{_libdir}/libbadge.so
+
+
+%if 0%{?gcov:1}
+%files gcov
+%{_datadir}/gcov/obj/*
+%endif
+# End of a file