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