%description devel
RPC Port library (Development) package.
+#################################################
+# rpc-port-unittests
+#################################################
+%package -n rpc-port-unittests
+Summary: GTest for rpc-port
+Group: Development/Libraries
+Requires: %{name}
+
+%description -n rpc-port-unittests
+GTest for rpc-port
+
+#################################################
+# rpc-port-gcov
+#################################################
+%if 0%{?gcov:1}
+%package gcov
+Summary: RPC Port(gcov)
+Group: Application Framework/Testing
+
+%description gcov
+RPC Port gcov objects
+%endif
+
%prep
%setup -q
cp %{SOURCE1001} .
%build
+%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
+
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
# Call make instruction with smp support
%__make %{?jobs:-j%jobs}
+%if 0%{?gcov:1}
+mkdir -p gcov-obj
+find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
+%endif
+
%install
rm -rf %{buildroot}
%make_install
+%if 0%{?gcov:1}
+mkdir -p %{buildroot}%{_datadir}/gcov/obj
+install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
+%endif
+
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
+%post -n rpc-port-unittests
+%if 0%{?gcov:1}
+%{_bindir}/rpc-port_unittests
+%endif
+
%files
%manifest %{name}.manifest
%attr(0644,root,root) %{_libdir}/lib%{name}.so.*
#################################################
# rpc-port-unittests
#################################################
-%package -n rpc-port-unittests
-Summary: GTest for rpc-port
-Group: Development/Libraries
-Requires: %{name}
-
-%description -n rpc-port-unittests
-GTest for rpc-port
-
%files -n rpc-port-unittests
%{_bindir}/rpc-port_unittests
+
+#################################################
+# rpc-port-gcov
+#################################################
+%if 0%{?gcov:1}
+%files gcov
+%{_datadir}/gcov/obj/*
+%endif