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