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