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