revise gcov option of spec file
authorYoungjae Shin <yj99.shin@samsung.com>
Tue, 25 Jan 2022 00:09:14 +0000 (09:09 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Tue, 25 Jan 2022 04:16:06 +0000 (13:16 +0900)
packaging/modes.spec

index f37827b4b22063e73b453b15505b50e6cfe0783f..d482480f377694ac9dcc9a68b86529412247d703 100644 (file)
@@ -9,6 +9,9 @@ URL : https://review.tizen.org/gerrit/gitweb?p=platform/core/system/modes.git
 Source0: %{name}-%{version}.tar.gz
 Source1001: %{name}.manifest
 
+%{!?gcov: %global gcov 0}
+%{!?stdoutlog: %global stdoutlog 0}
+
 BuildRequires: cmake
 BuildRequires: pkgconfig(capi-base-common)
 BuildRequires: pkgconfig(capi-network-wifi-manager)
@@ -22,10 +25,6 @@ BuildRequires: pkgconfig(libxml-2.0)
 BuildRequires: pkgconfig(vconf)
 #For changing owner/group
 Requires: security-config
-%if 0%{?gcov:1}
-BuildRequires: lcov
-BuildRequires: tar
-%endif
 
 %description
 The modes(Mode Supervisor) manages configurations which is described at a mode.
@@ -64,8 +63,9 @@ Group: System/Testing
 %description unittests
 The %{name}-unittests package contains programs for checking quality the %{name}.
 
-%if 0%{?gcov:1}
+%if 0%{gcov}
 %package gcov
+BuildRequires: tar
 Summary: Coverage Data of %{name}
 Group: System/Testing
 
@@ -84,7 +84,7 @@ The %{name}-gcov pacakge contains gcov objects
 cp %{SOURCE1001} ./%{name}.manifest
 
 %build
-%if 0%{?gcov:1}
+%if 0%{gcov}
 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
 export LDFLAGS+=" -lgcov -Wl,--dynamic-list-data"
@@ -101,8 +101,8 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
        -DMODES_PLUGIN_DEFAULT_DIR:PATH=%{modes_plugin_dir} \
        -DTEST_INSTALL_DIR:PATH=%{modes_test_dir} \
        -DDBUS_INTERFACE=%{_dbus_interface} \
-       -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0} \
-       -DSTDOUT_LOG=%{?stdlog:1}%{!?stdlog:0}
+       -DBUILD_GCOV:BOOL=%{gcov} \
+       -DSTDOUT_LOG:BOOL=%{stdoutlog}
 make %{?_smp_mflags}
 
 %install
@@ -118,10 +118,10 @@ install -m 0755 tests/modes-gtest-run.sh %{buildroot}%{modes_test_dir}/
 
 %install_service multi-user.target.wants %{name}.path
 
-%if 0%{?gcov:1}
+%if 0%{gcov}
 find .. -name '*.gcno' | tar cf %{name}-gcov.tar -T -
-install -d -m 0755 %{buildroot}%{_datadir}/gcov/obj
-tar xf %{name}-gcov.tar -C %{buildroot}%{_datadir}/gcov/obj
+install -d -m 0755 %{buildroot}%{_datadir}/gcov/obj/%{name}
+tar xf %{name}-gcov.tar -C %{buildroot}%{_datadir}/gcov/obj/%{name}
 %endif
 
 %check
@@ -191,7 +191,7 @@ systemctl try-restart %{name}.service
 %{modes_test_dir}/*.xml
 %license LICENSE.APLv2
 
-%if 0%{?gcov:1}
+%if 0%{gcov}
 %files gcov
 %{_datadir}/gcov/*
 %endif