Fix issues in the merged Tizen 3.0 code
[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
4 Name:       bluetooth-frwk
5 Summary:    Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
6 Version:    0.2.146
7 Release:    0
8 Group:      Network & Connectivity/Bluetooth
9 License:    Apache-2.0
10 Source0:    %{name}-%{version}.tar.gz
11 Source1001: bluetooth-frwk.manifest
12 Source1002: bt-icon.png
13 URL:        https://review.tizen.org/git/?p=platform/core/connectivity/bluetooth-frwk.git;a=summary
14 Requires: dbus
15 Requires: syspopup
16 Requires: bluetooth-tools
17 BuildRequires:  pkgconfig(aul)
18 BuildRequires:  pkgconfig(dbus-glib-1)
19 BuildRequires:  pkgconfig(dlog)
20 BuildRequires:  pkgconfig(glib-2.0)
21 BuildRequires:  pkgconfig(gio-2.0)
22 BuildRequires:  pkgconfig(gio-unix-2.0)
23 %if %{with bluetooth_frwk_libnotify}
24 BuildRequires:  pkgconfig(libnotify)
25 BuildRequires:  pkgconfig(gdk-pixbuf-2.0)
26 BuildRequires:  pkgconfig(gtk+-3.0)
27 %elif %{without bluetooth_frwk_libnotification}
28 BuildRequires:  pkgconfig(syspopup-caller)
29 Requires:       syspopup
30 %else
31 BuildRequires:  pkgconfig(syspopup-caller)
32 %endif
33 BuildRequires:  pkgconfig(vconf)
34 BuildRequires:  pkgconfig(libxml-2.0)
35 BuildRequires:  pkgconfig(dbus-1)
36 #%if %{with x}
37 #BuildRequires:  pkgconfig(utilX)
38 #%endif
39 BuildRequires:  pkgconfig(capi-network-connection)
40
41 BuildRequires:  pkgconfig(libprivilege-control)
42 BuildRequires:  pkgconfig(status)
43 BuildRequires:  pkgconfig(alarm-service)
44 BuildRequires:  pkgconfig(notification)
45 BuildRequires:  pkgconfig(security-server)
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 %cmake . \
117 -DTZ_SYS_USER_GROUP=%TZ_SYS_USER_GROUP \
118 -DTZ_SYS_DEFAULT_USER=%TZ_SYS_DEFAULT_USER \
119 %if %{with bluetooth_frwk_libnotify}
120  -DLIBNOTIFY_SUPPORT=On \
121 %else
122  -DLIBNOTIFY_SUPPORT=Off \
123 %endif
124 %if %{with bluetooth_frwk_libnotification}
125  -DLIBNOTIFICATION_SUPPORT=On
126 %else
127  -DLIBNOTIFICATION_SUPPORT=Off
128 %endif
129
130 %cmake \
131 %if "%{?tizen_profile_name}" == "wearable"
132         -DTIZEN_WEARABLE=YES \
133 %endif
134 %if "%{?tizen_profile_name}" == "mobile"
135         -DTIZEN_WEARABLE=NO \
136 %endif
137 %if "%{?tizen_profile_name}" == "common"
138         -DTIZEN_WEARABLE=NO \
139 %endif
140
141 %install
142 rm -rf %{buildroot}
143 %make_install
144
145 install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk
146 install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk-service
147 install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk-devel
148
149 mkdir -p %{buildroot}%{_unitdir_user}
150 install -m 0644 bt-service/bluetooth-frwk-service.service %{buildroot}%{_unitdir_user}
151
152 %if %{with bluetooth_frwk_libnotify} || %{with bluetooth_frwk_libnotification}
153 mkdir -p %{buildroot}%{_datadir}/icons/default
154 install -m 0644 %{SOURCE1002} %{buildroot}%{_datadir}/icons/default/bt-icon.png
155 %endif
156
157 # On IVI bt-service needs to be run as 'app' even if there is a 'guest' user.
158 %if "%{profile}"=="ivi"
159 sed -i 's/%TZ_SYS_DEFAULT_USER/app/' %{buildroot}%{_datadir}/dbus-1/system-services/org.projectx.bt.service
160 %endif
161
162 %post
163 /sbin/ldconfig
164 %if "%{?tizen_profile_name}" == "wearable"
165 vconftool set -f -t int db/bluetooth/status "1" -g 6520
166 %endif
167 %if "%{?tizen_profile_name}" == "mobile"
168 vconftool set -f -t int db/bluetooth/status "0" -g 6520
169 %endif
170 %if "%{?tizen_profile_name}" == "common"
171 vconftool set -f -t int db/bluetooth/status "0" -g 6520
172 %endif
173
174
175 vconftool set -f -t int db/bluetooth/status "0" -s User
176 vconftool set -f -t int db/bluetooth/lestatus "0" -s User
177 vconftool set -f -t int file/private/bt-core/flight_mode_deactivated "0" -s User
178 vconftool set -f -t int file/private/bt-core/powersaving_mode_deactivated "0" -s User
179 vconftool set -f -t int file/private/bt-service/bt_off_due_to_timeout "0" -s User
180 vconftool set -f -t string memory/bluetooth/sco_headset_name "" -g 6520 -i
181 vconftool set -f -t int memory/bluetooth/device "0" -g 6520 -i
182 vconftool set -f -t bool memory/bluetooth/btsco "0" -g 6520 -i
183 vconftool set -f -t bool memory/bluetooth/dutmode "0" -g 6520 -i
184
185 #%post service
186 #mkdir -p %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
187 #ln -sf %{_libdir}/systemd/system/bluetooth-frwk.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
188
189 %postun -p /sbin/ldconfig
190
191 %files
192 %manifest %{name}.manifest
193 %defattr(-, root, root)
194 %{_libdir}/libbluetooth-api.so.*
195 %{_datadir}/license/bluetooth-frwk
196
197 %files devel
198 %defattr(-, root, root)
199 %{_includedir}/bt-service/bluetooth-api.h
200 %{_includedir}/bt-service/bluetooth-hid-api.h
201 %{_includedir}/bt-service/bluetooth-audio-api.h
202 %{_includedir}/bt-service/bluetooth-telephony-api.h
203 %{_includedir}/bt-service/bluetooth-media-control.h
204 %{_includedir}/bt-service/bluetooth-scmst-api.h
205 %{_libdir}/pkgconfig/bluetooth-api.pc
206 %{_libdir}/libbluetooth-api.so
207 %{_datadir}/license/bluetooth-frwk-devel
208
209 %files service
210 %manifest %{name}.manifest
211 %defattr(-, root, root)
212 %{_datadir}/dbus-1/system-services/org.projectx.bt.service
213
214 %{_bindir}/bt-service
215 %{_unitdir_user}/bluetooth-frwk-service.service
216 %{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-service.conf
217 %{_bindir}/bluetooth-frwk-test
218 #%{_bindir}/bluetooth-gatt-test
219 #%{_bindir}/bluetooth-advertising-test
220 %{_varlibdir}/bluetooth
221 %{_prefix}/etc/bluetooth
222 %{_datadir}/license/bluetooth-frwk-service
223 %if %{with bluetooth_frwk_libnotify} || %{with bluetooth_frwk_libnotification}
224 %{_datadir}/icons/default/bt-icon.png
225 %endif
226
227 %files core
228 %manifest %{name}.manifest
229 %defattr(-, root, root)
230 %{_datadir}/dbus-1/system-services/org.projectx.bt_core.service
231 %{_bindir}/bt-core
232 %{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-core.conf
233
234 %files test
235 %manifest %{name}.manifest
236 %defattr(-, root, root)
237 %{_bindir}/bluetooth-frwk-test
238 #%{_bindir}/bluetooth-gatt-test
239 #%{_bindir}/bluetooth-advertising-test