BuildRequires: python3 >= 3.4
BuildRequires: pkgconfig(capi-base-common)
BuildRequires: pkgconfig(openssl1.1)
+%if 0%{?gcov:1}
+BuildRequires: lcov
+%endif
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
%build
%{!?build_type:%define build_type "RELEASE"}
-%cmake . -DCMAKE_BUILD_TYPE=%{build_type}
+%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_BUILD_TYPE=%{build_type} \
+ -DBUILD_GCOV={?gcov:1}%{!?gcov:0}
+
make -k %{?jobs:-j%jobs}
+%if 0%{?gcov:1}
+mkdir -p gcov-obj
+find . \( -name '*.gcno' ! -name 'tc_*' \) -exec cp '{}' gcov-obj ';'
+%endif
+
+
%install
%make_install
%py3_compile %{buildroot}/%{python3_sitearch}
+%if 0%{?gcov:1}
+mkdir -p %{buildroot}%{_datadir}/gcov/obj
+install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
+%endif
+
+
%clean
rm -rf %{buildroot}
%files -n python3-yaca
%{python3_sitearch}/%{name}
+
+## gcov Package ############################################################
+%if 0%{?gcov:1}
+%package gcov
+Summary: yaca gcov for measuring test coverage
+Group: Secureity/Testing
+%description gcov
+New yaca gcov objects
+
+%files gcov
+%{_datadir}/gcov/obj/*
+%endif
+
+