Remove gcov rpm
[platform/core/connectivity/bluetooth-agent.git] / packaging / bluetooth-agent.spec
1 %define _usrlibdir /usr/lib
2
3 Name:       bluetooth-agent
4 Summary:    Bluetooth agent packages that support various external profiles
5 Version:    0.6.0
6 Release:    1
7 Group:      Network & Connectivity/Bluetooth
8 License:    Apache-2.0
9 Source0:    %{name}-%{version}.tar.gz
10 Source1001:     bluetooth-agent.manifest
11
12 BuildRequires:  pkgconfig(aul)
13 BuildRequires:  pkgconfig(bluetooth-api)
14
15 # The profile macro usage with the following comments may be removed after
16 # Tizen OBS build projects are merged. However, each vendor may keep using
17 # such if/endif statement to skip building profiles not interested
18
19 # This usage of profile macro does NOT conflict 4.0 configurability.
20 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv"
21 # Original: wearable, ivi. Added: common, "undefined"
22 BuildRequires:  pkgconfig(alarm-service)
23 BuildRequires:  pkgconfig(capi-appfw-app-manager)
24 BuildRequires:  pkgconfig(capi-system-device)
25 %endif
26 # This usage of profile macro does NOT conflict 4.0 configurability.
27 %if "%{?profile}" != "wearable" && "%{?profile}" != "ivi"
28 # Original: common, mobile, tv. Added: "undefined"
29 BuildRequires:  pkgconfig(contacts-service2)
30 BuildRequires:  pkgconfig(msg-service)
31 BuildRequires:  pkgconfig(email-service)
32 %endif
33 BuildRequires:  pkgconfig(capi-system-info)
34 BuildRequires:  pkgconfig(dbus-1)
35 BuildRequires:  pkgconfig(tapi)
36 BuildRequires:  pkgconfig(dlog)
37 BuildRequires:  pkgconfig(vconf)
38 BuildRequires:  pkgconfig(appsvc)
39 BuildRequires:  pkgconfig(capi-appfw-application)
40 BuildRequires:  pkgconfig(capi-network-connection)
41 BuildRequires:  pkgconfig(capi-network-bluetooth)
42 BuildRequires:  pkgconfig(capi-media-image-util)
43 BuildRequires:  pkgconfig(contacts-service2)
44 BuildRequires:  pkgconfig(libexif)
45 BuildRequires:  pkgconfig(gio-2.0)
46 BuildRequires:  cmake
47 Requires: security-config
48 %if 0%{?gcov:1}
49 BuildRequires:  gtest-devel
50 BuildRequires:  lcov
51 %endif
52
53 #Requires:      %{name}-compat = %{version}-%{release}
54 #Recommends:    %{name}-profile_common = %{version}-%{release}
55
56 %description
57 Bluetooth agent packages that support various external profiles
58
59 %package hfp_ag
60 Summary:        Bluetooth agent for HFP(Hands-Free Profile)'s AG(Audio Gate) role
61 Requires:   %{name} = %{version}-%{release}
62 Group:      Network & Connectivity/Bluetooth
63 %description hfp_ag
64 Bluetooth agent binary compiled for HFP(Hands-Free Profile)'s AG(Audio Gate) role
65
66 %package hfp_hf
67 Summary:        Bluetooth agent for HFP(Hands-Free Profile)'s HF(Hands-Free) role
68 Requires:   %{name} = %{version}-%{release}
69 Group:      Network & Connectivity/Bluetooth
70 %description hfp_hf
71 Bluetooth agent binary compiled for HFP(Hands-Free Profile)'s HF(Hands-Free) role
72
73 %package map
74 Summary:        Bluetooth agent for MAP(Message Access Profile) server
75 Requires:   %{name} = %{version}-%{release}
76 Group:      Network & Connectivity/Bluetooth
77 %description map
78 Bluetooth agent binary compiled for MAP(Message Access Profile) server
79
80 %package pbap
81 Summary:        Bluetooth agent for PBAP(PhoneBook Access Profile) server
82 Requires:   %{name} = %{version}-%{release}
83 Group:      Network & Connectivity/Bluetooth
84 %description pbap
85 Bluetooth agent binary compiled for PBAP(PhoneBook Access Profile) server
86
87 %package hid
88 Summary:        Bluetooth agent for HID(Human Interface Device)'s device role
89 Requires:   %{name} = %{version}-%{release}
90 Group:      Network & Connectivity/Bluetooth
91 %description hid
92 Bluetooth agent binary compiled for HID(Human Interface Device)'s device role
93
94 %package ipsp
95 Summary:        Bluetooth agent for IPSP(Internet Protocol Support Profile)
96 Requires:   %{name} = %{version}-%{release}
97 Group:      Network & Connectivity/Bluetooth
98 %description ipsp
99 Bluetooth agent binary compiled for IPSP(Internet Protocol Support Profile)
100
101 %prep
102 %setup -q
103 cp %{SOURCE1001} .
104
105 %build
106 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
107 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
108 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
109 export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_MEDIA_ENHANCE"
110 export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_HFP_AG"
111 export CFLAGS="$CFLAGS -DTIZEN_SUPPORT_DUAL_HF"
112
113 %ifarch aarch64 x86_64
114 echo arch64
115 export CFLAGS+=" -DARCH64"
116 export CXXFLAGS+=" -DARCH64"
117 export FFLAGS+=" -DARCH64"
118 %endif
119
120 export CFLAGS+=" -fpie -DTIZEN_FEATURE_BP_PBAP_SIM -fvisibility=hidden "
121 export CXXFLAGS+=" -fpie -DTIZEN_FEATURE_BP_PBAP_SIM -fvisibility=hidden "
122
123 export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
124
125 export CFLAGS_DEFAULT="$CFLAGS"
126
127 %if 0%{?gcov:1}
128 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
129 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
130 export FFLAGS+=" -fprofile-arcs -ftest-coverage"
131 export LDFLAGS+=" -lgcov"
132 %endif
133
134 # Build All (wearalbe/ivi/common/tv/mobile)
135 %cmake . -DCMAKE_INSTALL_PREFIX=/usr \
136         -DTIZEN_FEATURE_BT_HFP_AG=1 \
137         -DBUILD_GTESTS=%{?gcov:1}%{!?gcov:0} \
138         -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0}
139
140 make VERBOSE=1
141
142 %if 0%{?gcov:1}
143 mkdir -p gcov-obj
144 find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
145 %endif
146
147 %install
148 rm -rf %{buildroot}
149 %make_install
150
151 # This usage of profile macro does NOT conflict 4.0 configurability.
152 #%if "%{?profile}" != "mobile" && "%{?profile}" != "tv"
153 # Original: wearable, ivi. Added: common, "undefined"
154 #mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services
155 #mkdir -p %{buildroot}%{_bindir}/
156 #install -D -m 0644 %{buildroot}/usr/share/dbus-1/system-services/org.bluez.hf_agent.service %{buildroot}%{_datadir}/dbus-1/system-services/
157 #install -D -m 0644 %{buildroot}/usr/share/dbus-1/system-services/org.bluez.ipsp_agent.service %{buildroot}%{_datadir}/dbus-1/system-services/
158 #install -D -m 0644 %{buildroot}/usr/bin/bluetooth-hf-agent %{buildroot}%{_bindir}/
159 #install -D -m 0644 %{buildroot}/usr/bin/bluetooth-ipsp-agent %{buildroot}%{_bindir}/
160 #%endif
161 install -D -m 0644 packaging/bluetooth-map-agent.service %{buildroot}%{_unitdir}/bluetooth-map-agent.service
162 install -D -m 0644 packaging/bluetooth-pbap-agent.service %{buildroot}%{_unitdir}/bluetooth-pbap-agent.service
163 install -D -m 0644 packaging/bluetooth-ag-agent.service %{buildroot}%{_unitdir}/bluetooth-ag-agent.service
164 install -D -m 0644 packaging/bluetooth-hf-agent.service %{buildroot}%{_unitdir}/bluetooth-hf-agent.service
165 install -D -m 0644 packaging/bluetooth-hid-agent.service %{buildroot}%{_unitdir}/bluetooth-hid-agent.service
166
167 %if 0%{?gcov:1}
168 mkdir -p %{buildroot}%{_datadir}/gcov/obj/%{name}
169 install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj/%{name}/
170 %endif
171
172 %check
173 %if 0%{?gcov:1}
174 pushd unittest
175 ./run_coverage.sh
176 popd
177 %endif
178
179 %files
180 %manifest %{name}.manifest
181 %license LICENSE
182 %defattr(-, root, root)
183 %exclude %{_bindir}/gtest-bluetooth-agent
184 %exclude %{_libdir}/lib*
185 %exclude %{_datadir}/gcov/obj/*
186
187 %files hfp_ag
188 %manifest %{name}.manifest
189 %license LICENSE
190 %{_bindir}/bluetooth-ag-agent
191 %attr(0666,-,-) /var/lib/bluetooth/voice-recognition-blacklist
192 %{_datadir}/dbus-1/system-services/org.bluez.ag_agent.service
193 %{_sysconfdir}/dbus-1/system.d/bluetooth-ag-agent.conf
194 %{_unitdir}/bluetooth-ag-agent.service
195 #%exclude %{_unitdir}/bluetooth-map-agent.service
196 #%exclude %{_unitdir}/bluetooth-pbap-agent.service
197
198 %files hfp_hf
199 %manifest %{name}.manifest
200 %license LICENSE
201 %{_bindir}/bluetooth-hf-agent
202 %{_datadir}/dbus-1/system-services/org.bluez.hf_agent.service
203 %{_sysconfdir}/dbus-1/system.d/bluetooth-hf-agent.conf
204 %{_unitdir}/bluetooth-hf-agent.service
205 #%exclude %{_unitdir}/bluetooth-map-agent.service
206 #%exclude %{_unitdir}/bluetooth-pbap-agent.service
207
208 %files map
209 %manifest %{name}.manifest
210 %license LICENSE
211 %{_bindir}/bluetooth-map-agent
212 %{_datadir}/dbus-1/system-services/org.bluez.map_agent.service
213 %{_unitdir}/bluetooth-map-agent.service
214 %{_sysconfdir}/dbus-1/system.d/bluetooth_map_agent.conf
215
216 %files pbap
217 %manifest %{name}.manifest
218 %license LICENSE
219 %{_bindir}/bluetooth-pb-agent
220 %{_datadir}/dbus-1/system-services/org.bluez.pb_agent.service
221 %{_unitdir}/bluetooth-pbap-agent.service
222 %{_sysconfdir}/dbus-1/system.d/bluetooth_pb_agent.conf
223
224 %files hid
225 %manifest %{name}.manifest
226 %license LICENSE
227 %{_bindir}/bluetooth-hid-agent
228 %{_datadir}/dbus-1/system-services/org.bluez.hid_agent.service
229 %{_unitdir}/bluetooth-hid-agent.service
230 %{_sysconfdir}/dbus-1/system.d/bluetooth-hid-agent.conf
231
232 %files ipsp
233 %manifest %{name}.manifest
234 %license LICENSE
235 %{_bindir}/bluetooth-ipsp-agent
236 %{_datadir}/dbus-1/system-services/org.bluez.ipsp_agent.service
237 %{_sysconfdir}/dbus-1/system.d/bluetooth-ipsp-agent.conf