[Adapt: OAL]Add OAL APIs to get remote conn status
[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.
7 Version:    0.2.151
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 %if %{with bluetooth_frwk_libnotify} || %{with bluetooth_frwk_libnotification}
14 Source1002: bt-icon.png
15 %endif
16
17 Requires: dbus
18 Requires: syspopup
19 %if "%{?profile}" != "mobile"
20 Requires: bluetooth-tools
21 %endif
22
23 %define bt_hal ENABLED
24 %define bt_bluez_hal ENABLED
25
26 BuildRequires:  pkgconfig(aul)
27 BuildRequires:  pkgconfig(dbus-glib-1)
28 BuildRequires:  pkgconfig(dlog)
29 BuildRequires:  pkgconfig(glib-2.0)
30 BuildRequires:  pkgconfig(gio-2.0)
31 BuildRequires:  pkgconfig(gio-unix-2.0)
32 %if %{with bluetooth_frwk_libnotify}
33 BuildRequires:  pkgconfig(libnotify)
34 BuildRequires:  pkgconfig(gdk-pixbuf-2.0)
35 BuildRequires:  pkgconfig(gtk+-3.0)
36 %elif %{without bluetooth_frwk_libnotification}
37 BuildRequires:  pkgconfig(syspopup-caller)
38 Requires:       syspopup
39 %else
40 BuildRequires:  pkgconfig(syspopup-caller)
41 %endif
42 BuildRequires:  pkgconfig(vconf)
43 BuildRequires:  pkgconfig(libxml-2.0)
44 BuildRequires:  pkgconfig(dbus-1)
45 %if %{with x}
46 BuildRequires:  pkgconfig(utilX)
47 %endif
48 BuildRequires:  pkgconfig(capi-network-connection)
49 BuildRequires:  pkgconfig(alarm-service)
50 BuildRequires:  pkgconfig(capi-content-mime-type)
51 BuildRequires:  pkgconfig(appcore-efl)
52 BuildRequires:  pkgconfig(pkgmgr)
53 #BuildRequires:  pkgconfig(journal)
54 BuildRequires:  pkgconfig(eventsystem)
55 BuildRequires:  pkgconfig(libsoup-2.4)
56 %if "%{?profile}" == "mobile"
57 BuildRequires:  pkgconfig(capi-network-tethering)
58 %endif
59 BuildRequires:  cmake
60 BuildRequires:  pkgconfig(cynara-client)
61 BuildRequires:  pkgconfig(cynara-creds-gdbus)
62 BuildRequires:  pkgconfig(libtzplatform-config)
63 BuildRequires:  pkgconfig(storage)
64
65 Requires(post): /usr/bin/vconftool
66 Requires(post): /sbin/ldconfig
67 Requires(postun): /sbin/ldconfig
68 Requires: psmisc
69
70 %description
71 Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
72  This package contains API set for BT GAP, BT SDP, and BT RFCOMM.
73
74
75 %package devel
76 Summary:    Bluetooth framework for BlueZ and Obexd
77 Group:      Development/Libraries
78 Requires:   %{name} = %{version}-%{release}
79
80 %description devel
81 This package is development files for Bluetooth framework based on BlueZ and Obexd stack.
82 This package contains API set for BT GAP, BT SDP, and BT RFCOMM.
83
84 %package service
85 Summary:    Bluetooth Service daemon
86 Group:      Network & Connectivity/Bluetooth
87 Requires:   %{name} = %{version}-%{release}
88
89 %description service
90 This package is Bluetooth Service daemon to manage BT services.
91
92 %package httpproxy
93 Summary:    Bluetooth HTTP Proxy Service daemon
94 Group:      Network & Connectivity/Bluetooth
95 Requires:   %{name} = %{version}-%{release}
96
97 %description httpproxy
98 This package is Bluetooth HTTP Proxy Service daemon
99
100 %package core
101 Summary:    Bluetooth Core daemon
102 Group:      Network & Connectivity/Bluetooth
103 Requires:   %{name} = %{version}-%{release}
104
105 %description core
106 This package is Bluetooth core daemon to manage activation / deactivation.
107
108 %package test
109 Summary:    Bluetooth test application
110 Group:      Network & Connectivity/Bluetooth
111 Requires:   %{name} = %{version}-%{release}
112
113 %description test
114 This package is Bluetooth test application.
115
116 %if %{bt_hal} == ENABLED
117 %package oal
118 Summary:    Bluetooth OAL
119 Group:      Network & Connectivity/Bluetooth
120 Requires:   %{name} = %{version}-%{release}
121
122 %description oal
123 This package is BT stack common interface.
124 %endif
125
126 %prep
127 %setup -q
128 cp %{SOURCE1001} .
129
130
131 %build
132 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
133 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
134 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
135
136 %define _servicefile packaging/bluetooth-frwk-common.service
137 %define _servicedir starter.target.wants
138
139 %if "%{?profile}" == "mobile"
140 export CFLAGS="$CFLAGS -DTIZEN_NETWORK_TETHERING_ENABLE -DTIZEN_BT_FLIGHTMODE_ENABLED -DTIZEN_MOBILE -DTIZEN_TELEPHONY_ENABLED"
141 %if "%{?tizen_target_name}" == "TM1"
142 %define _servicefile packaging/bluetooth-frwk-mobile-sprd.service
143 %else
144 %define _servicefile packaging/bluetooth-frwk-mobile.service
145 %endif
146 %define _servicedir multi-user.target.wants
147 %endif
148
149 %if "%{?profile}" == "wearable"
150 export CFLAGS="$CFLAGS -DTIZEN_WEARABLE -DTIZEN_BT_FLIGHTMODE_ENABLED"
151 %define _servicefile packaging/bluetooth-frwk-wearable.service
152 %define _servicedir multi-user.target.wants
153 %endif
154
155 %if "%{?profile}" == "tv"
156 export CFLAGS="$CFLAGS -DUSB_BLUETOOTH -DTIZEN_TV -DAUTO_ACCEPT"
157 %define _servicefile packaging/bluetooth-frwk-mobile.service
158 %define _servicedir multi-user.target.wants
159 %endif
160
161 %ifarch x86_64
162 export CFLAGS="$CFLAGS -Wall -g -fvisibility=hidden -fPIC"
163 %else
164 export CFLAGS="$CFLAGS -fpie"
165 export LDFLAGS="$CFLAGS -pie"
166 %endif
167
168 %if %{bt_hal} == ENABLED
169 export CFLAGS="$CFLAGS -URFCOMM_DIRECT -DTIZEN_BT_HAL"
170 %else
171 export CFLAGS="$CFLAGS -DRFCOMM_DIRECT"
172 %endif
173 export LDFLAGS="$CFLAGS -Wl,--rpath=%{_libdir} -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs"
174
175 %if "%{?_with_emulator}" == "1"
176 export CFLAGS="$CFLAGS -DEMUL"
177 export CXXFLAGS="$CXXFLAGS -DEMUL"
178 export FFLAGS="$FFLAGS -DEMUL"
179 %endif
180
181 %if %{bt_hal} == ENABLED
182 export BT_INCLUDE_OAL=ENABLED
183 %if %{bt_bluez_hal} == ENABLED
184 export BT_INCLUDE_OAL_BLUEZ=ENABLED
185 export CFLAGS="$CFLAGS -DTIZEN_BT_INCLUDE_OAL_BLUEZ"
186 export CFLAGS="$CFLAGS -DTIZEN_SYSPOPUP_SUPPORTED"
187 %else
188 export BT_INCLUDE_OAL_BLUEZ=DISABLED
189 %endif
190 %else
191 export BT_INCLUDE_OAL=DISABLED
192 %endif
193
194 cmake . -DCMAKE_INSTALL_PREFIX=/usr \
195 -DCMAKE_LIB_DIR=%{_libdir} \
196 -DTZ_SYS_USER_GROUP=%TZ_SYS_USER_GROUP \
197 -DTZ_SYS_DEFAULT_USER=%TZ_SYS_DEFAULT_USER \
198 %if %{with bluetooth_frwk_libnotify}
199         -DLIBNOTIFY_SUPPORT=On \
200 %else
201         -DLIBNOTIFY_SUPPORT=Off \
202 %endif
203 %if %{with bluetooth_frwk_libnotification}
204         -DLIBNOTIFICATION_SUPPORT=On
205 %else
206         -DLIBNOTIFICATION_SUPPORT=Off
207 %endif
208
209 make
210
211 %cmake \
212 %if "%{?profile}" == "wearable"
213         -DTIZEN_WEARABLE=YES \
214 %else
215         -DTIZEN_WEARABLE=NO \
216 %endif
217 %if "%{?profile}" == "common"
218         -DTIZEN_WEARABLE=NO \
219 %endif
220
221 %install
222 rm -rf %{buildroot}
223 %make_install
224
225 install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk
226 install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk-service
227 install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk-httpproxy
228 install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk-devel
229
230 #mkdir -p %{buildroot}%{_libdir}/systemd/user
231 #install -m 0644 packaging/bluetooth-frwk-tv.service %{buildroot}%{_libdir}/systemd/user
232 mkdir -p %{buildroot}%{_unitdir}/%{_servicedir}
233 install -m 0644 %{_servicefile} %{buildroot}%{_unitdir}/bluetooth-frwk.service
234 ln -s ../bluetooth-frwk.service %{buildroot}%{_unitdir}/%{_servicedir}/bluetooth-frwk.service
235
236 %if %{with bluetooth_frwk_libnotify} || %{with bluetooth_frwk_libnotification}
237 mkdir -p %{buildroot}%{_datadir}/icons/default
238 install -m 0644 %{SOURCE1002} %{buildroot}%{_datadir}/icons/default/bt-icon.png
239 %endif
240
241 # On IVI bt-service needs to be run as 'app' even if there is a 'guest' user.
242 %if "%{profile}"=="ivi"
243 sed -i 's/%TZ_SYS_DEFAULT_USER/app/' %{buildroot}%{_datadir}/dbus-1/system-services/org.projectx.bt.service
244 %endif
245
246
247 #%post
248 #/sbin/ldconfig
249 #%if "%{?profile}" == "wearable"
250 #vconftool set -f -t int db/bluetooth/status "1" -g 6520
251 #%endif
252 #%if "%{?profile}" == "mobile"
253 #vconftool set -f -t int db/bluetooth/status "0" -g 6520
254 #%endif
255 #%if "%{?profile}" == "common"
256 #vconftool set -f -t int db/bluetooth/status "0" -g 6520
257 #%endif
258
259 #vconftool set -f -t int db/bluetooth/status "0" -s User
260 #vconftool set -f -t int db/bluetooth/lestatus "0" -s User
261 #vconftool set -f -t int file/private/bt-core/flight_mode_deactivated "0" -s User
262 #vconftool set -f -t int file/private/bt-core/powersaving_mode_deactivated "0" -s User
263 #vconftool set -f -t int file/private/bt-service/bt_off_due_to_timeout "0" -s User
264 #vconftool set -f -t string memory/bluetooth/sco_headset_name "" -g 6520 -i
265 #vconftool set -f -t int memory/bluetooth/device "0" -g 6520 -i
266 #vconftool set -f -t bool memory/bluetooth/btsco "0" -g 6520 -i
267 #vconftool set -f -t bool memory/bluetooth/dutmode "0" -g 6520 -i
268
269
270 #%post service
271 #mkdir -p %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
272 #ln -sf %{_libdir}/systemd/user/bluetooth-frwk.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
273
274 %postun -p /sbin/ldconfig
275
276 %files
277 %manifest %{name}.manifest
278 %defattr(-, root, root)
279 %{_libdir}/libbluetooth-api.so.*
280 %{_datadir}/license/bluetooth-frwk
281 %{_unitdir}/%{_servicedir}/bluetooth-frwk.service
282 %{_unitdir}/bluetooth-frwk.service
283
284 %files devel
285 %defattr(-, root, root)
286 %{_includedir}/bt-service/bluetooth-api.h
287 %{_includedir}/bt-service/bluetooth-hid-api.h
288 %{_includedir}/bt-service/bluetooth-audio-api.h
289 %{_includedir}/bt-service/bluetooth-telephony-api.h
290 %{_includedir}/bt-service/bluetooth-media-control.h
291 %{_includedir}/bt-service/bluetooth-scmst-api.h
292 %{_includedir}/bt-service/bluetooth-ipsp-api.h
293 %{_libdir}/pkgconfig/bluetooth-api.pc
294 %{_libdir}/libbluetooth-api.so
295 %{_datadir}/license/bluetooth-frwk-devel
296
297 %files service
298 %manifest %{name}.manifest
299 %defattr(-, root, root)
300 %{_datadir}/dbus-1/system-services/org.projectx.bt.service
301 %{_bindir}/bt-service
302 #%{_libdir}/systemd/user/bluetooth-frwk-tv.service
303 %{_unitdir}/%{_servicedir}/bluetooth-frwk.service
304 %{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-service.conf
305 %{_bindir}/bluetooth-frwk-test
306 #%{_bindir}/bluetooth-gatt-test
307 #%{_bindir}/bluetooth-advertising-test
308 %{_varlibdir}/bluetooth
309 %{_prefix}/etc/bluetooth
310 #%attr(0666,-,-) %{_varlibdir}/bluetooth/auto-pair-blacklist
311 #%attr(0666,-,-) %{_prefix}/etc/bluetooth/stack_info
312 #%{_dumpdir}/bluetooth_log_dump.sh
313
314
315 %{_datadir}/license/bluetooth-frwk-service
316 %if %{with bluetooth_frwk_libnotify} || %{with bluetooth_frwk_libnotification}
317 %{_datadir}/icons/default/bt-icon.png
318 %endif
319
320 %files httpproxy
321 %manifest %{name}.manifest
322 %defattr(-, root, root)
323 %{_bindir}/bt-httpproxy
324 %{_datadir}/license/bluetooth-frwk-httpproxy
325 %{_datadir}/dbus-1/system-services/org.projectx.httpproxy.service
326 %{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-httpproxy.conf
327
328 %files core
329 %manifest %{name}.manifest
330 %defattr(-, root, root)
331 %{_datadir}/dbus-1/system-services/org.projectx.bt_core.service
332 %{_bindir}/bt-core
333 %{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-core.conf
334
335 %files test
336 %manifest %{name}.manifest
337 %defattr(-, root, root)
338 %{_bindir}/bluetooth-frwk-test
339 %{_bindir}/bluetooth-gatt-test
340 %{_bindir}/bluetooth-advertising-test
341
342 %if %{bt_hal} == ENABLED
343 %files oal
344 %manifest %{name}.manifest
345 %{_libdir}/libbt-oal.so*
346 %{_libdir}/libbluetooth.default.so*
347 %endif