Merge "[Tizen] Remove emulator build dependencies" into tizen
[platform/core/connectivity/bluetooth-frwk.git] / packaging / bluetooth-frwk.spec
1 %bcond_with x
2 %define _dumpdir /opt/etc/dump.d/module.d
3 %define _varlibdir /opt/var/lib
4
5 Name:       bluetooth-frwk
6 Summary:    Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
7 Version:    0.2.157
8 Release:    1
9 Group:      Network & Connectivity/Bluetooth
10 License:    Apache-2.0
11 Source0:    %{name}-%{version}.tar.gz
12 Source1001: bluetooth-frwk.manifest
13
14 %if "%{?profile}" != "mobile"
15 Requires: bluetooth-tools
16 %endif
17 BuildRequires:  pkgconfig(aul)
18 BuildRequires:  pkgconfig(dlog)
19 BuildRequires:  pkgconfig(glib-2.0)
20 BuildRequires:  pkgconfig(gio-2.0)
21 BuildRequires:  pkgconfig(gio-unix-2.0)
22 BuildRequires:  pkgconfig(syspopup-caller)
23 BuildRequires:  pkgconfig(vconf)
24 BuildRequires:  pkgconfig(libxml-2.0)
25 BuildRequires:  pkgconfig(capi-network-connection)
26 BuildRequires:  pkgconfig(alarm-service)
27 BuildRequires:  pkgconfig(capi-content-mime-type)
28 BuildRequires:  pkgconfig(appcore-efl)
29 BuildRequires:  pkgconfig(pkgmgr)
30 #BuildRequires:  pkgconfig(journal)
31 BuildRequires:  pkgconfig(eventsystem)
32 BuildRequires:  pkgconfig(libsoup-2.4)
33 BuildRequires:  pkgconfig(capi-network-tethering)
34 BuildRequires:  cmake
35 BuildRequires:  pkgconfig(cynara-client)
36 BuildRequires:  pkgconfig(cynara-creds-gdbus)
37 BuildRequires:  pkgconfig(libtzplatform-config)
38 BuildRequires:  pkgconfig(storage)
39 BuildRequires:  pkgconfig(capi-system-info)
40
41 Requires(post): /usr/bin/vconftool
42 Requires(post): /sbin/ldconfig
43 Requires(postun): /sbin/ldconfig
44 Requires: psmisc
45
46 %description
47 Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
48  This package contains API set for BT GAP, BT SDP, and BT RFCOMM.
49
50 %package profile_common
51 Summary:    bluetooth-frwk service and conf files for common profile
52 Requires:   %{name} = %{version}-%{release}
53 Conflicts:  %{name}-profile_mobile
54 Conflicts:  %{name}-profile_wearable
55 Conflicts:  %{name}-profile_tv
56 Conflicts:  %{name}-profile_ivi
57 %description profile_common
58 Bluetooth framework configuration and service files for Tizen common profile
59
60 %package profile_mobile
61 Summary:    bluetooth-frwk service and conf files for mobile profile
62 Requires:   %{name} = %{version}-%{release}
63 Conflicts:  %{name}-profile_common
64 Conflicts:  %{name}-profile_wearable
65 Conflicts:  %{name}-profile_tv
66 Conflicts:  %{name}-profile_ivi
67 %description profile_mobile
68 Bluetooth framework configuration and service files for Tizen mobile profile
69
70 # extension-TM1
71 %ifarch %{ix86} || %{arm}
72 %package extension-TM1
73 Summary:    bluetooth-frwk service and conf files for mobile TM1
74 Requires:   %{name}-profile_mobile = %{version}-%{release}
75 %description extension-TM1
76 Bluetooth framework configuration and service files for Tizen mobile TM1
77 %endif
78
79 %package profile_wearable
80 Summary:    bluetooth-frwk service and conf files for wearable profile
81 Requires:   %{name} = %{version}-%{release}
82 Conflicts:  %{name}-profile_mobile
83 Conflicts:  %{name}-profile_common
84 Conflicts:  %{name}-profile_tv
85 Conflicts:  %{name}-profile_ivi
86 %description profile_wearable
87 Bluetooth framework configuration and service files for Tizen wearable profile
88
89 %package profile_tv
90 Summary:    bluetooth-frwk service and conf files for tv profile
91 Requires:   %{name} = %{version}-%{release}
92 Conflicts:  %{name}-profile_mobile
93 Conflicts:  %{name}-profile_wearable
94 Conflicts:  %{name}-profile_common
95 Conflicts:  %{name}-profile_ivi
96 %description profile_tv
97 Bluetooth framework configuration and service files for Tizen tv profile
98
99 %package profile_ivi
100 Summary:    bluetooth-frwk service and conf files for ivi profile
101 Requires:   %{name} = %{version}-%{release}
102 Conflicts:  %{name}-profile_mobile
103 Conflicts:  %{name}-profile_wearable
104 Conflicts:  %{name}-profile_tv
105 Conflicts:  %{name}-profile_common
106 %description profile_ivi
107 Bluetooth framework configuration and service files for Tizen ivi profile
108
109 %ifarch %{ix86} x86_64
110 %package extension-emulator
111 Summary:    bluetooth-frwk service and conf files for emulator
112 Requires:   %{name} = %{version}-%{release}
113 %description extension-emulator
114 bluetooth-frwk service and conf files for emulator
115 %endif // ifarch %{ix86} x86_64
116
117 %package devel
118 Summary:    Bluetooth framework for BlueZ and Obexd
119 Group:      Development/Libraries
120 Requires:   %{name} = %{version}-%{release}
121
122 %description devel
123 This package is development files for Bluetooth framework based on BlueZ and Obexd stack.
124 This package contains API set for BT GAP, BT SDP, and BT RFCOMM.
125
126 %package service
127 Summary:    Bluetooth Service daemon
128 Group:      Network & Connectivity/Bluetooth
129 Requires:   %{name} = %{version}-%{release}
130
131 %description service
132 This package is Bluetooth Service daemon to manage BT services.
133
134 %package httpproxy
135 Summary:    Bluetooth HTTP Proxy Service daemon
136 Group:      TO_BE/FILLED
137 Requires:   %{name} = %{version}-%{release}
138
139 %description httpproxy
140 This package is Bluetooth HTTP Proxy Service daemon
141
142 %package core
143 Summary:    Bluetooth Core daemon
144 Group:      Network & Connectivity/Bluetooth
145 Requires:   %{name} = %{version}-%{release}
146
147 %description core
148 This package is Bluetooth core daemon to manage activation / deactivation.
149
150 %package test
151 Summary:    Bluetooth test application
152 Group:      Network & Connectivity/Bluetooth
153 Requires:   %{name} = %{version}-%{release}
154
155 %description test
156 This package is Bluetooth test application.
157
158 %package plugin-headed
159 Summary:    Bluetooth plugin Headed
160 Group:      Network & Connectivity/Bluetooth
161 Requires:   %{name} = %{version}-%{release}
162
163 %description plugin-headed
164 This package is Bluetooth plugin to manage UI and syspopup
165
166 %prep
167 %setup -q
168 cp %{SOURCE1001} .
169
170
171 %build
172 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
173 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
174 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
175
176 %ifarch x86_64
177 export CFLAGS="$CFLAGS -Wall -g -fvisibility=hidden -fPIC"
178 export CFLAGS+=" -DARCH64"
179 export CXXFLAGS+=" -DARCH64"
180 export FFLAGS+=" -DARCH64"
181 %else
182 export CFLAGS="$CFLAGS -fpie"
183 export LDFLAGS="$CFLAGS -pie"
184 %endif
185
186 export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_RFCOMM_DIRECT"
187 export LDFLAGS="$CFLAGS -Wl,--rpath=%{_libdir} -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs"
188
189 %ifarch aarch64
190 echo arch64
191 export CFLAGS+=" -DARCH64"
192 export CXXFLAGS+=" -DARCH64"
193 export FFLAGS+=" -DARCH64"
194 %endif
195
196 export CFLAGS_DEFAULT="$CFLAGS"
197 export CXXFLAGS_DEFAULT="$CXXFLAGS"
198 export FFLAGS_DEFAULT="$FFLAGS"
199
200 # extension-TM1
201 %ifarch %{ix86} || %{arm}
202 mkdir -p tm1
203 export CFLAGS="$CFLAGS_DEFAULT -DTIZEN_FEATURE_RADIO"
204 export CXXFLAGS="$CXXFLAGS_DEFAULT -DTIZEN_FEATURE_RADIO"
205 export FFLAGS="$FFLAGS_DEFAULT -DTIZEN_FEATURE_RADIO"
206
207 cmake . -DCMAKE_INSTALL_PREFIX=/usr \
208 -DCMAKE_LIB_DIR=%{_libdir} \
209 -DTZ_SYS_USER_GROUP=%TZ_SYS_USER_GROUP \
210 -DTZ_SYS_DEFAULT_USER=%TZ_SYS_DEFAULT_USER \
211         -DLIBNOTIFY_SUPPORT=Off \
212         -DLIBNOTIFICATION_SUPPORT=Off
213 make
214
215 %cmake
216
217 %make_install
218 cp %{buildroot}%{_bindir}/bt-core tm1/bt-core.tm1
219 %endif
220
221 # extension-emulator
222 %ifarch %{ix86} x86_64
223 export CFLAGS="${CFLAGS_BASE} -DTIZEN_TEST_EMUL"
224 export CXXFLAGS="${CXXFLAGS_BASE} -DTIZEN_TEST_EMUL"
225 export FFLAGS="${FFLAGS_BASE} -DTIZEN_TEST_EMUL"
226
227 mkdir -p build_emulator
228
229 cmake . -DCMAKE_INSTALL_PREFIX=/usr \
230 -DCMAKE_LIB_DIR=%{_libdir} \
231 -DTZ_SYS_USER_GROUP=%TZ_SYS_USER_GROUP \
232 -DTZ_SYS_DEFAULT_USER=%TZ_SYS_DEFAULT_USER \
233         -DLIBNOTIFY_SUPPORT=Off \
234         -DLIBNOTIFICATION_SUPPORT=Off
235 make
236
237 %cmake
238
239 %make_install
240 cp %{buildroot}%{_libdir}/libbluetooth-api.so* build_emulator/
241 pushd build_emulator/
242 for FILE in libbluetooth-api.so*; do mv "${FILE}" "${FILE}.emulator"; done
243 popd
244 %endif
245
246 # non-extension-TM1 / non-extension-emulator
247
248 export CFLAGS="$CFLAGS_DEFAULT"
249 export CXXFLAGS="$CXXFLAGS_DEFAULT"
250 export FFLAGS="$FFLAGS_DEFAULT"
251
252 cmake . -DCMAKE_INSTALL_PREFIX=/usr \
253 -DCMAKE_LIB_DIR=%{_libdir} \
254 -DTZ_SYS_USER_GROUP=%TZ_SYS_USER_GROUP \
255 -DTZ_SYS_DEFAULT_USER=%TZ_SYS_DEFAULT_USER \
256         -DLIBNOTIFY_SUPPORT=Off \
257         -DLIBNOTIFICATION_SUPPORT=Off
258 make
259
260 %cmake
261
262 %install
263 rm -rf %{buildroot}
264 %make_install
265
266 mkdir -p %{buildroot}%{_unitdir}/starter.target.wants
267 mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
268
269 # extension-emulator
270 %ifarch %{ix86} x86_64
271 cp build_emulator/libbluetooth-api.so*.emulator %{buildroot}%{_libdir}/
272 %endif
273
274 # Rename the postfix (.mobile, .tv, ..) at post script
275 # mobile
276 install -m 0644 packaging/bluetooth-frwk-mobile.service %{buildroot}%{_unitdir}/bluetooth-frwk.service.mobile
277
278 # extension-TM1
279 %ifarch %{ix86} || %{arm}
280 cp tm1/bt-core.tm1 %{buildroot}%{_bindir}/
281 install -m 0644 packaging/bluetooth-frwk-mobile-sprd.service %{buildroot}%{_unitdir}/bluetooth-frwk.service.tm1
282 %endif
283
284 # wearable / ivi
285 install -m 0644 packaging/bluetooth-frwk-wearable.service %{buildroot}%{_unitdir}/bluetooth-frwk.service.wearable
286 # On IVI bt-service needs to be run as 'app' even if there is a 'guest' user.
287 cp %{buildroot}%{_datadir}/dbus-1/system-services/org.projectx.bt.service %{buildroot}%{_datadir}/dbus-1/system-services/org.projectx.bt.service.ivi
288 sed -i 's/%TZ_SYS_DEFAULT_USER/app/' %{buildroot}%{_datadir}/dbus-1/system-services/org.projectx.bt.service.ivi
289
290 # tv
291 install -m 0644 packaging/bluetooth-frwk-tv.service %{buildroot}%{_unitdir}/bluetooth-frwk.service.tv
292
293 # common
294 install -m 0644 packaging/bluetooth-frwk-common.service %{buildroot}%{_unitdir}/bluetooth-frwk.service.common
295
296 ln -s ../bluetooth-frwk.service %{buildroot}%{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
297 ln -s ../bluetooth-frwk.service %{buildroot}%{_unitdir}/starter.target.wants/bluetooth-frwk.service
298
299 %postun -p /sbin/ldconfig
300
301 %files
302 %manifest %{name}.manifest
303 %license LICENSE
304 %defattr(-, root, root)
305 %{_libdir}/libbluetooth-api.so.*
306 %exclude %{_libdir}/libbluetooth-api.so*.emulator
307
308 %files devel
309 %defattr(-, root, root)
310 %{_includedir}/bt-service/bluetooth-api.h
311 %{_includedir}/bt-service/bluetooth-hid-api.h
312 %{_includedir}/bt-service/bluetooth-audio-api.h
313 %{_includedir}/bt-service/bluetooth-telephony-api.h
314 %{_includedir}/bt-service/bluetooth-media-control.h
315 %{_includedir}/bt-service/bluetooth-scmst-api.h
316 %{_includedir}/bt-service/bluetooth-ipsp-api.h
317 %{_libdir}/pkgconfig/bluetooth-api.pc
318 %{_libdir}/libbluetooth-api.so
319
320 # extension-emulator
321 %ifarch %{ix86} x86_64
322 %post extension-emulator
323 pushd %{_libdir}
324 for FILE in libbluetooth-api.so*.emulator; do mv "${FILE}" "${FILE%.emulator}"; done
325 popd
326 %preun extension-emulator
327 pushd %{_libdir}
328 for FILE in libbluetooth-api.so*; do mv "${FILE}" "${FILE}.emulator"; done
329 popd
330 %files extension-emulator
331 %manifest %{name}.manifest
332 %defattr(-, root, root)
333 %{_libdir}/libbluetooth-api.so.*.emulator
334 %{_libdir}/libbluetooth-api.so.emulator
335 %endif
336
337 %files service
338 %manifest %{name}.manifest
339 %license LICENSE
340 %defattr(-, root, root)
341 %{_bindir}/bt-service
342 %{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-service.conf
343 %{_bindir}/bluetooth-frwk-test
344 %{_varlibdir}/bluetooth
345 %{_prefix}/etc/bluetooth
346
347 %files httpproxy
348 %manifest %{name}.manifest
349 %license LICENSE
350 %defattr(-, root, root)
351 %{_bindir}/bt-httpproxy
352 %{_datadir}/dbus-1/system-services/org.projectx.httpproxy.service
353 %{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-httpproxy.conf
354
355 %files core
356 %manifest %{name}.manifest
357 %license LICENSE
358 %defattr(-, root, root)
359 %{_datadir}/dbus-1/system-services/org.projectx.bt_core.service
360 %{_bindir}/bt-core
361 %{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-core.conf
362
363 %files test
364 %manifest %{name}.manifest
365 %license LICENSE
366 %defattr(-, root, root)
367 %{_bindir}/bluetooth-frwk-test
368 #{_bindir}/bluetooth-gatt-test
369 #{_bindir}/bluetooth-advertising-test
370
371 %files plugin-headed
372 %manifest %{name}.manifest
373 %license LICENSE
374 %defattr(-, root, root)
375 %{_libdir}/bt-plugin-headed.so
376
377 %post profile_common
378 pushd %{_unitdir}
379 mv bluetooth-frwk.service.common bluetooth-frwk.service
380 popd
381 %preun profile_common
382 pushd %{_unitdir}
383 mv bluetooth-frwk.service bluetooth-frwk.service.common
384 popd
385 %files profile_common
386 %license LICENSE
387 %{_unitdir}/starter.target.wants/bluetooth-frwk.service
388 %{_unitdir}/bluetooth-frwk.service.common
389 %{_datadir}/dbus-1/system-services/org.projectx.bt.service
390
391 %post profile_mobile
392 pushd %{_unitdir}
393 mv bluetooth-frwk.service.mobile bluetooth-frwk.service
394 popd
395 %preun profile_mobile
396 pushd %{_unitdir}
397 mv bluetooth-frwk.service bluetooth-frwk.service.mobile
398 popd
399 %files profile_mobile
400 %license LICENSE
401 %{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
402 %{_unitdir}/bluetooth-frwk.service.mobile
403 %{_datadir}/dbus-1/system-services/org.projectx.bt.service
404
405 # extension-TM1
406 %ifarch %{ix86} || %{arm}
407 %post extension-TM1
408 pushd %{_unitdir}
409 mv bluetooth-frwk.service.tm1 bluetooth-frwk.service
410 popd
411 pushd %{_bindir}
412 mv bt-core.tm1 bt-core
413 popd
414 %preun extension-TM1
415 pushd %{_unitdir}
416 mv bluetooth-frwk.service bluetooth-frwk.service.tm1
417 popd
418 pushd %{_bindir}
419 mv bt-core bt-core.tm1
420 popd
421 %files extension-TM1
422 %{_unitdir}/bluetooth-frwk.service.tm1
423 %license LICENSE
424 %defattr(-, root, root)
425 %{_bindir}/bt-core.tm1
426 %endif
427
428 %post profile_wearable
429 pushd %{_unitdir}
430 mv bluetooth-frwk.service.wearable bluetooth-frwk.service
431 popd
432 %preun profile_wearable
433 pushd %{_unitdir}
434 mv bluetooth-frwk.service bluetooth-frwk.service.wearable
435 popd
436 %files profile_wearable
437 %license LICENSE
438 %{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
439 %{_unitdir}/bluetooth-frwk.service.wearable
440 %{_datadir}/dbus-1/system-services/org.projectx.bt.service
441
442 %post profile_tv
443 pushd %{_unitdir}
444 mv bluetooth-frwk.service.tv bluetooth-frwk.service
445 popd
446 %preun profile_tv
447 pushd %{_unitdir}
448 mv bluetooth-frwk.service bluetooth-frwk.service.tv
449 popd
450 %files profile_tv
451 %license LICENSE
452 %{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
453 %{_unitdir}/bluetooth-frwk.service.tv
454 %{_datadir}/dbus-1/system-services/org.projectx.bt.service
455
456 # Note: ivi reuses bluetooth-frwk.service.wearable
457 %post profile_ivi
458 pushd %{_unitdir}
459 mv bluetooth-frwk.service.wearable bluetooth-frwk.service
460 popd
461 pushd %{_datadir}/dbus-1/system-services
462 mv org.projectx.bt.service.ivi org.projectx.bt.service
463 popd
464 %preun profile_ivi
465 pushd %{_unitdir}
466 mv bluetooth-frwk.service bluetooth-frwk.service.wearable
467 popd
468 pushd %{_datadir}/dbus-1/system-services
469 mv org.projectx.bt.service org.projectx.bt.service.ivi
470 popd
471 %files profile_ivi
472 %license LICENSE
473 %{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
474 %{_unitdir}/bluetooth-frwk.service.wearable
475 %{_datadir}/dbus-1/system-services/org.projectx.bt.service.ivi
476
477 ### added /usr/etc/bluetooth/wearable/stack_info (others: /usr/etc/bluetooth/stack_info))
478 # (for PROFILE WEARABLE)
479