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