%build
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+%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 CXXFLAGS+=" -Wall -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wswitch-default -Wno-unused-parameter"
export CXXFLAGS+=" -Wformat=2 -Wno-empty-body -fomit-frame-pointer -fno-optimize-sibling-calls"
export CXXFLAGS+=" -fno-strict-aliasing -fno-unroll-loops -fsigned-char -fstrict-overflow"
%cmake . -DMAJORVER=${MAJORVER} -DFULLVER=%{version}
make %{?_smp_mflags}
+%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
+
# Backward compatibility
ln -s %{name}.pc %{buildroot}/%{_libdir}/pkgconfig/context.pc
ln -s lib%{name}.so.%{version} %{buildroot}/%{_libdir}/libcontext.so.0
%manifest testsuite/capi-context-test.manifest
%{_bindir}/context-test
%license LICENSE
+
+%if 0%{?gcov:1}
+%package gcov
+Summary: Tizen Context Framework Native API (gcov)
+Group: Service Framework/Testing
+
+%description gcov
+gcov objects for coverage test
+
+%files gcov
+%{_datadir}/gcov/obj/*
+%endif