Support gcov build option
[platform/core/system/libstorage.git] / packaging / libstorage.spec
1 Name:       libstorage
2 Summary:    Library to get storage information
3 Version:    1.0.0
4 Release:    0
5 Group:      System/Libraries
6 License:    Apache-2.0
7 Source0:    %{name}-%{version}.tar.gz
8 Source1:    %{name}.manifest
9 BuildRequires:  cmake
10 BuildRequires:  pkgconfig(dlog)
11 BuildRequires:  pkgconfig(capi-base-common)
12 BuildRequires:  pkgconfig(vconf)
13 BuildRequires:  pkgconfig(glib-2.0)
14 BuildRequires:  pkgconfig(gio-2.0)
15 BuildRequires:  pkgconfig(libtzplatform-config)
16 BuildRequires:  pkgconfig(mount)
17 BuildRequires:  pkgconfig(blkid)
18 BuildRequires:  pkgconfig(capi-system-info)
19 %if 0%{?gcov:1}
20 BuildRequires: lcov
21 %endif
22
23 %description
24 development package of library to get storage
25
26 %package devel
27 Summary:        Get storage information (devel)
28 Group:          Development/Libraries
29 Requires:       %{name} = %{version}-%{release}
30
31 %description devel
32 Library to get storage information (devel)
33
34 %if 0%{?gcov:1}
35 %package gcov
36 Summary:        Get storage information (gcov)
37 Group:          Development/Libraries
38 %description gcov
39 Library to get storage information (gcov)
40 %endif
41
42 %prep
43 %setup -q
44 cp %{SOURCE1} .
45
46 %build
47 %if 0%{?gcov:1}
48 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
49 export LDFLAGS+=" -lgcov"
50 %endif
51
52 %cmake .
53 make %{?jobs:-j%jobs}
54 %if 0%{?gcov:1}
55 mkdir -p gcov-obj
56 find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
57 %endif
58
59
60 %install
61 %make_install
62
63 %if 0%{?gcov:1}
64 mkdir -p %{buildroot}%{_datadir}/gcov/obj
65 install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
66 %endif
67
68 %post -p /sbin/ldconfig
69
70 %postun -p /sbin/ldconfig
71
72 %files
73 %manifest %{name}.manifest
74 %license LICENSE.Apache-2.0
75 %{_libdir}/*.so.*
76 %{_sysconfdir}/storage/libstorage.conf
77
78 %files devel
79 %manifest %{name}.manifest
80 %license LICENSE.Apache-2.0
81 %{_includedir}/storage/*.h
82 %{_libdir}/*.so
83 %{_libdir}/pkgconfig/*.pc
84
85 %if 0%{?gcov:1}
86 %files gcov
87 %{_datadir}/gcov/*
88 %endif