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