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