Merge "Build gtest when gcov flag is defined only" into tizen
[platform/core/api/tethering.git] / packaging / capi-network-tethering.spec
1 Name:           capi-network-tethering
2 Summary:        Tethering Framework
3 Version:        1.0.57
4 Release:        1
5 Group:          System/Network
6 License:        Apache-2.0
7 Source0:        %{name}-%{version}.tar.gz
8 BuildRequires:  pkgconfig(dlog)
9 BuildRequires:  pkgconfig(dbus-1)
10 BuildRequires:  pkgconfig(capi-base-common)
11 BuildRequires:  pkgconfig(glib-2.0)
12 BuildRequires:  pkgconfig(gio-2.0)
13 BuildRequires:  pkgconfig(vconf)
14 BuildRequires:  pkgconfig(key-manager)
15 BuildRequires:  pkgconfig(capi-system-info)
16 BuildRequires:  pkgconfig(libtzplatform-config)
17 BuildRequires:  pkgconfig(gmock)
18 BuildRequires:  cmake
19 %if 0%{?gcov:1}
20 BuildRequires: lcov
21 BuildRequires: tar
22 %endif
23 Requires(post):         /sbin/ldconfig
24 Requires(postun):       /sbin/ldconfig
25
26 %description
27 Tethering framework library for CAPI
28
29 %package devel
30 Summary:        Development package for Tethering framework library
31 Group:          Development/Libraries
32 Requires:       %{name} = %{version}-%{release}
33 %description devel
34 Development package for Tethering framework library
35
36 %package tool
37 Summary:        Test application for Tethering
38 %description tool
39 Test application for Tethering
40
41 %if 0%{?gcov:1}
42 %package gcov
43 Summary:  Tethering Library(gcov)
44 Group:    Network/Testing
45 %description gcov
46 gcov objects for coverage test
47 %endif
48
49 %prep
50 %setup -q
51
52
53 %build
54 %if 0%{?gcov:1}
55 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
56 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
57 export FFLAGS+=" -fprofile-arcs -ftest-coverage"
58 export LDFLAGS+=" -lgcov"
59 %endif
60
61 %cmake -DBUILD_GTESTS=%{?gcov:1}%{!?gcov:0} \
62         .
63 make %{?_smp_mflags}
64
65 %install
66 %make_install
67
68 %if 0%{?gcov:1}
69 find .. -name '*.gcno' | tar cf %{name}-gcov.tar -T -
70 install -d -m 755 %{buildroot}%{_datadir}/gcov/obj
71 tar xf %{name}-gcov.tar -C %{buildroot}%{_datadir}/gcov/obj
72 %endif
73
74 %check
75 %if 0%{?gcov:1}
76 tests/tethering-gtest
77 %endif
78
79 %if 0%{?gcov:1}
80 lcov -c --ignore-errors graph --no-external -b . -d . -o %{name}.info
81 genhtml %{name}.info -o out --legend --show-details
82 %endif
83
84 %post -p /sbin/ldconfig
85
86 %postun -p /sbin/ldconfig
87
88 %files
89 %manifest capi-network-tethering.manifest
90 %defattr(-,root,root,-)
91 %{_libdir}/*.so.*
92 %license LICENSE
93
94 %files devel
95 %defattr(-,root,root,-)
96 %{_includedir}/network/*.h
97 %{_libdir}/pkgconfig/*.pc
98 %{_libdir}/*.so
99 %license LICENSE
100
101 %files tool
102 %{_bindir}/tethering_test
103
104 %if 0%{?gcov:1}
105 %files gcov
106 %{_datadir}/gcov/obj/*
107 %endif