Make gcov package when --define 'gcov ON' is given 50/217250/1 accepted/tizen/unified/20191108.142953 submit/tizen/20191108.073429
authorDongsun Lee <ds73.lee@samsung.com>
Fri, 8 Nov 2019 03:00:28 +0000 (12:00 +0900)
committerDongsun Lee <ds73.lee@samsung.com>
Fri, 8 Nov 2019 03:00:28 +0000 (12:00 +0900)
Change-Id: I2268f6cbf22565b712a7af5038ceb6d222a06772
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
packaging/yaca.spec

index 665da8cc677c8d9e94bf74f40dd749cf7cb75052..538f47cc28865c51686646392ce4f2521bcae69d 100644 (file)
@@ -9,6 +9,9 @@ BuildRequires:      cmake
 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
 
@@ -31,13 +34,34 @@ The package provides Yet Another Crypto API.
 %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}
 
@@ -79,3 +103,17 @@ The package provides Yet Another Crypto API bindings for Python3.
 
 %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
+
+