95fff5e7f6acb1e83addd7ed59db8eb4916c1590
[platform/core/connectivity/bluetooth-frwk.git] / packaging / bluetooth-frwk.spec
1 %define _dumpdir /opt/etc/dump.d/module.d
2 %define _varlibdir /opt/var/lib
3 #%bcond_with bluetooth_frwk_libnotify
4 #%bcond_with bluetooth_frwk_libnotification
5 #%bcond_with x
6
7 Name:       bluetooth-frwk
8 Summary:    Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
9 Version:    0.2.146
10 Release:    0
11 Group:      Network & Connectivity/Bluetooth
12 License:    Apache License, Version 2.0
13 Source0:    %{name}-%{version}.tar.gz
14 Source1001: bluetooth-frwk.manifest
15 Source1002: bt-icon.png
16 URL:        https://review.tizen.org/git/?p=platform/core/connectivity/bluetooth-frwk.git;a=summary
17 Requires: dbus
18 Requires: syspopup
19 Requires: bluetooth-tools
20 BuildRequires:  pkgconfig(aul)
21 BuildRequires:  pkgconfig(dbus-glib-1)
22 BuildRequires:  pkgconfig(dlog)
23 BuildRequires:  pkgconfig(glib-2.0)
24 BuildRequires:  pkgconfig(gio-2.0)
25 BuildRequires:  pkgconfig(gio-unix-2.0)
26 %if %{with bluetooth_frwk_libnotify}
27 BuildRequires:  pkgconfig(libnotify)
28 BuildRequires:  pkgconfig(gdk-pixbuf-2.0)
29 BuildRequires:  pkgconfig(gtk+-3.0)
30 %elif %{without bluetooth_frwk_libnotification}
31 BuildRequires:  pkgconfig(syspopup-caller)
32 Requires:       syspopup
33 %else
34 BuildRequires:  pkgconfig(syspopup-caller)
35 %endif
36 BuildRequires:  pkgconfig(vconf)
37 BuildRequires:  pkgconfig(libxml-2.0)
38 BuildRequires:  pkgconfig(dbus-1)
39 #%if %{with x}
40 BuildRequires:  pkgconfig(utilX)
41 #%endif
42 BuildRequires:  pkgconfig(capi-network-connection)
43
44 BuildRequires:  pkgconfig(libprivilege-control)
45 BuildRequires:  pkgconfig(status)
46 BuildRequires:  pkgconfig(alarm-service)
47 BuildRequires:  pkgconfig(notification)
48 BuildRequires:  pkgconfig(security-server)
49 BuildRequires:  pkgconfig(capi-content-mime-type)
50 BuildRequires:  pkgconfig(appcore-efl)
51 BuildRequires:  pkgconfig(pkgmgr)
52 #BuildRequires:  pkgconfig(journal)
53
54 %if "%{?tizen_profile_name}" == "mobile"
55 BuildRequires:  pkgconfig(capi-network-tethering)
56 %endif
57
58 BuildRequires:  cmake
59 BuildRequires:  pkgconfig(libtzplatform-config)
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 core
89 Summary:    Bluetooth Core daemon
90 Group:      Network & Connectivity/Bluetooth
91 Requires:   %{name} = %{version}-%{release}
92 Requires:   connman
93
94 %description core
95 This package is Bluetooth core daemon to manage activation / deactivation.
96
97 %package test
98 Summary:    Bluetooth test application
99 Group:      Network & Connectivity/Bluetooth
100 Requires:   %{name} = %{version}-%{release}
101
102 %description test
103 This package is Bluetooth test application.
104
105 %prep
106 %setup -q
107 cp %{SOURCE1001} .
108
109
110 %build
111 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
112 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
113 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
114
115 %if "%{?tizen_profile_name}" == "mobile"
116 export CFLAGS="$CFLAGS -DTIZEN_NETWORK_TETHERING_ENABLE"
117 %endif
118
119 %if "%{?tizen_profile_name}" == "wearable"
120 export CFLAGS="$CFLAGS -DTIZEN_WEARABLE"
121 %define _servicefile packaging/bluetooth-frwk-wearable.service
122 %else
123 %define _servicefile packaging/bluetooth-frwk-mobile.service
124 %endif
125 %define _servicedir multi-user.target.wants
126
127 %if "%{?tizen_profile_name}" == "mobile"
128 %else
129 export CFLAGS="$CFLAGS -DTIZEN_TELEPHONY_ENABLED"
130 %endif
131
132 %ifarch x86_64
133 export CFLAGS+=" -Wall -g -fvisibility=hidden -fPIC -DRFCOMM_DIRECT "
134 export LDFLAGS+=" -Wl,--rpath=%{_libdir} -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs"
135 %else
136 export CFLAGS+=" -fpie -DRFCOMM_DIRECT "
137 export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
138 %endif
139
140 %cmake . \
141 -DTZ_SYS_USER_GROUP=%TZ_SYS_USER_GROUP \
142 -DTZ_SYS_DEFAULT_USER=%TZ_SYS_DEFAULT_USER \
143 %if %{with bluetooth_frwk_libnotify}
144  -DLIBNOTIFY_SUPPORT=On \
145 %else
146  -DLIBNOTIFY_SUPPORT=Off \
147 %endif
148 %if %{with bluetooth_frwk_libnotification}
149  -DLIBNOTIFICATION_SUPPORT=On
150 %else
151  -DLIBNOTIFICATION_SUPPORT=Off
152 %endif
153
154 %cmake \
155 %if "%{?tizen_profile_name}" == "wearable"
156         -DTIZEN_WEARABLE=YES \
157 %else
158         -DTIZEN_WEARABLE=NO \
159 %endif
160
161 %__make
162
163 %install
164 rm -rf %{buildroot}
165 %make_install
166
167 install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk
168 install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk-service
169 install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk-devel
170
171 mkdir -p %{buildroot}%{_unitdir_user}
172 install -m 0644 bt-service/bluetooth-frwk-service.service %{buildroot}%{_unitdir_user}
173
174 %if %{with bluetooth_frwk_libnotify} || %{with bluetooth_frwk_libnotification}
175 mkdir -p %{buildroot}%{_datadir}/icons/default
176 install -m 0644 %{SOURCE1002} %{buildroot}%{_datadir}/icons/default/bt-icon.png
177 %endif
178
179 # On IVI bt-service needs to be run as 'app' even if there is a 'guest' user.
180 %if "%{profile}"=="ivi"
181 sed -i 's/%TZ_SYS_DEFAULT_USER/app/' %{buildroot}%{_datadir}/dbus-1/system-services/org.projectx.bt.service
182 %endif
183
184 mkdir -p %{buildroot}%{_dumpdir}
185 install -m 0755 bluetooth_log_dump.sh %{buildroot}%{_dumpdir}
186
187 %post
188 /sbin/ldconfig
189 %if "%{?tizen_profile_name}" == "wearable"
190 vconftool set -f -t int db/bluetooth/status "1" -g 6520
191 %else
192 vconftool set -f -t int db/bluetooth/status "0" -g 6520
193 %endif
194
195 vconftool set -f -t int db/bluetooth/lestatus "0" -g 6520 -i
196 vconftool set -f -t int file/private/bt-service/flight_mode_deactivated "0" -g 6520 -i
197 vconftool set -f -t int file/private/bt-core/flight_mode_deactivated "0" -g 6520 -i
198 vconftool set -f -t int file/private/bt-core/powersaving_mode_deactivated "0" -g 6520 -i
199 vconftool set -f -t int file/private/bt-service/bt_off_due_to_timeout "0" -g 6520 -i
200 vconftool set -f -t string memory/bluetooth/sco_headset_name "" -g 6520 -i
201 vconftool set -f -t int memory/bluetooth/device "0" -g 6520 -i
202 vconftool set -f -t int memory/bluetooth/btsco "0" -g 6520 -i
203 vconftool set -f -t bool memory/bluetooth/dutmode "0" -g 6520 -i
204 # set 'User' smack label to vconf keys in order to allow bt-service to access them.
205 chsmack -a 'User' %TZ_SYS_CONFIG/db/bluetooth/status
206 chsmack -a 'User' %TZ_SYS_CONFIG/file/private/bt-service/flight_mode_deactivated
207 chsmack -a 'User' %TZ_SYS_CONFIG/memory_init/memory/bluetooth/sco_headset_name
208 chsmack -a 'User' %TZ_SYS_CONFIG/memory_init/memory/bluetooth/device
209 chsmack -a 'User' %TZ_SYS_CONFIG/memory_init/memory/bluetooth/btsco
210
211 %post service
212 mkdir -p %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
213 ln -sf %{_libdir}/systemd/system/bluetooth-frwk.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
214
215 %postun -p /sbin/ldconfig
216
217 %files
218 %manifest %{name}.manifest
219 %defattr(-, root, root)
220 %{_libdir}/libbluetooth-api.so.*
221 %{_datadir}/license/bluetooth-frwk
222
223 %files devel
224 %defattr(-, root, root)
225 %{_includedir}/bt-service/bluetooth-api.h
226 %{_includedir}/bt-service/bluetooth-hid-api.h
227 %{_includedir}/bt-service/bluetooth-audio-api.h
228 %{_includedir}/bt-service/bluetooth-telephony-api.h
229 %{_includedir}/bt-service/bluetooth-media-control.h
230 %{_includedir}/bt-service/bluetooth-scmst-api.h
231 %{_libdir}/pkgconfig/bluetooth-api.pc
232 %{_libdir}/libbluetooth-api.so
233 %{_datadir}/license/bluetooth-frwk-devel
234
235 %files service
236 %manifest %{name}.manifest
237 %defattr(-, root, root)
238 %{_datadir}/dbus-1/system-services/org.projectx.bt.service
239 %{_bindir}/bt-service
240 %{_unitdir_user}/bluetooth-frwk-service.service
241 %{_bindir}/bluetooth-frwk-test
242 %{_bindir}/bluetooth-gatt-test
243 %{_bindir}/bluetooth-advertising-test
244 %{_varlibdir}/bluetooth
245 %{_prefix}/etc/bluetooth
246 #%attr(0666,-,-) %{_varlibdir}/bluetooth/auto-pair-blacklist
247 #%{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-service.conf
248 #%attr(0666,-,-) %{_prefix}/etc/bluetooth/stack_info
249 %{_dumpdir}/bluetooth_log_dump.sh
250 %{_datadir}/license/bluetooth-frwk-service
251 %if %{with bluetooth_frwk_libnotify} || %{with bluetooth_frwk_libnotification}
252 %{_datadir}/icons/default/bt-icon.png
253 %endif
254
255 %files core
256 %manifest %{name}.manifest
257 %defattr(-, root, root)
258 %{_datadir}/dbus-1/system-services/org.projectx.bt_core.service
259 %{_bindir}/bt-core
260 #%{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-core.conf
261
262 %files test
263 %manifest %{name}.manifest
264 %defattr(-, root, root)
265 %{_bindir}/bluetooth-frwk-test
266 %{_bindir}/bluetooth-gatt-test
267 %{_bindir}/bluetooth-advertising-test