Rollback changes to submit TIZEN:COMMON project
[platform/core/connectivity/bluetooth-frwk.git] / packaging / bluetooth-frwk.spec
1 %bcond_with bluetooth_frwk_libnotify
2 %bcond_with bluetooth_frwk_libnotification
3 %bcond_with x
4
5 Name:       bluetooth-frwk
6 Summary:    Bluetooth framework for BlueZ and Obexd
7 Version:    0.2.55
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: bluetooth-tools
17 BuildRequires:  pkgconfig(aul)
18 BuildRequires:  pkgconfig(dbus-glib-1)
19 BuildRequires:  pkgconfig(dlog)
20 BuildRequires:  pkgconfig(glib-2.0)
21 %if %{with bluetooth_frwk_libnotify}
22 BuildRequires:  pkgconfig(libnotify)
23 BuildRequires:  pkgconfig(gdk-pixbuf-2.0)
24 BuildRequires:  pkgconfig(gtk+-3.0)
25 %elif %{without bluetooth_frwk_libnotification}
26 BuildRequires:  pkgconfig(syspopup-caller)
27 Requires:       syspopup
28 %endif
29 BuildRequires:  pkgconfig(vconf)
30 BuildRequires:  pkgconfig(libxml-2.0)
31 BuildRequires:  pkgconfig(dbus-1)
32 %if %{with x}
33 BuildRequires:  pkgconfig(utilX)
34 %endif
35 BuildRequires:  pkgconfig(capi-network-tethering)
36 BuildRequires:  pkgconfig(libprivilege-control)
37 BuildRequires:  pkgconfig(status)
38 BuildRequires:  pkgconfig(alarm-service)
39 BuildRequires:  pkgconfig(notification)
40 BuildRequires:  cmake
41 BuildRequires:  pkgconfig(libtzplatform-config)
42
43 Requires(post): /usr/bin/vconftool
44 Requires(post): /sbin/ldconfig
45 Requires(postun): /sbin/ldconfig
46
47 %description
48 Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
49  This package contains API set for BT GAP, BT SDP, and BT RFCOMM.
50
51
52 %package devel
53 Summary:    Bluetooth framework for BlueZ and Obexd
54 Group:      Development/Libraries
55 Requires:   %{name} = %{version}-%{release}
56
57 %description devel
58 This package is development files for Bluetooth framework based on BlueZ and Obexd stack.
59 This package contains API set for BT GAP, BT SDP, and BT RFCOMM.
60
61 %package service
62 Summary:    Bluetooth Service daemon
63 Group:      Network & Connectivity/Bluetooth
64 Requires:   %{name} = %{version}-%{release}
65
66 %description service
67 This package is Bluetooth Service daemon to manage BT services.
68
69 %package core
70 Summary:    Bluetooth Core daemon
71 Group:      Network & Connectivity/Bluetooth
72 Requires:   %{name} = %{version}-%{release}
73 Requires:   connman
74
75 %description core
76 This package is Bluetooth core daemon to manage activation / deactivation.
77
78 %prep
79 %setup -q
80 cp %{SOURCE1001} .
81
82
83 %build
84
85 %ifarch x86_64
86 export CFLAGS="${CFLAGS}   -Wall -g -fvisibility=hidden -fPIC"
87 export LDFLAGS="${LDFLAGS} -Wl,--rpath=%{_libdir} -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs"
88 %else
89 export CFLAGS="${CFLAGS} -fpie"
90 export LDFLAGS="${LDFLAGS} -Wl,--rpath=%{_libdir} -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
91 %endif
92
93 %cmake . \
94 -DTZ_SYS_USER_GROUP=%TZ_SYS_USER_GROUP \
95 -DTZ_SYS_DEFAULT_USER=%TZ_SYS_DEFAULT_USER \
96 %if %{with bluetooth_frwk_libnotify}
97  -DLIBNOTIFY_SUPPORT=On \
98 %else
99  -DLIBNOTIFY_SUPPORT=Off \
100 %endif
101 %if %{with bluetooth_frwk_libnotification}
102  -DLIBNOTIFICATION_SUPPORT=On
103 %else
104  -DLIBNOTIFICATION_SUPPORT=Off
105 %endif
106
107 %__make
108
109 %install
110 rm -rf %{buildroot}
111 %make_install
112
113 mkdir -p %{buildroot}%{_unitdir_user}
114 install -m 0644 bt-service/bluetooth-frwk-service.service %{buildroot}%{_unitdir_user}
115
116 %if %{with bluetooth_frwk_libnotify} || %{with bluetooth_frwk_libnotification}
117 mkdir -p %{buildroot}%{_datadir}/icons/default
118 install -m 0644 %{SOURCE1002} %{buildroot}%{_datadir}/icons/default/bt-icon.png
119 %endif
120
121 # On IVI bt-service needs to be run as 'app' even if there is a 'guest' user.
122 %if "%{profile}"=="ivi"
123 sed -i 's/%TZ_SYS_DEFAULT_USER/app/' %{buildroot}%{_datadir}/dbus-1/system-services/org.projectx.bt.service
124 %endif
125
126 %post
127 /sbin/ldconfig
128 vconftool set -f -t int db/bluetooth/status "0" -g 6520
129 vconftool set -f -t int file/private/bt-service/flight_mode_deactivated "0" -g 6520 -i
130 vconftool set -f -t string memory/bluetooth/sco_headset_name "" -g 6520 -i
131 vconftool set -f -t int memory/bluetooth/device "0" -g 6520 -i
132 vconftool set -f -t int memory/bluetooth/btsco "0" -g 6520 -i
133 # set 'User' smack label to vconf keys in order to allow bt-service to access them.
134 chsmack -a 'User' %TZ_SYS_CONFIG/db/bluetooth/status
135 chsmack -a 'User' %TZ_SYS_CONFIG/file/private/bt-service/flight_mode_deactivated
136 chsmack -a 'User' %TZ_SYS_CONFIG/memory_init/memory/bluetooth/sco_headset_name
137 chsmack -a 'User' %TZ_SYS_CONFIG/memory_init/memory/bluetooth/device
138 chsmack -a 'User' %TZ_SYS_CONFIG/memory_init/memory/bluetooth/btsco
139
140 %postun -p /sbin/ldconfig
141
142 %files
143 %manifest %{name}.manifest
144 %defattr(-, root, root)
145 %{_libdir}/libbluetooth-api.so.*
146
147 %files devel
148 %manifest %{name}.manifest
149 %defattr(-, root, root)
150 %{_includedir}/bt-service/bluetooth-api.h
151 %{_includedir}/bt-service/bluetooth-hid-api.h
152 %{_includedir}/bt-service/bluetooth-audio-api.h
153 %{_includedir}/bt-service/bluetooth-telephony-api.h
154 %{_includedir}/bt-service/bluetooth-media-control.h
155 %{_libdir}/pkgconfig/bluetooth-api.pc
156 %{_libdir}/libbluetooth-api.so
157
158 %files service
159 %manifest %{name}.manifest
160 %defattr(-, root, root)
161 %{_datadir}/dbus-1/system-services/org.projectx.bt.service
162
163 %{_bindir}/bt-service
164 %{_unitdir_user}/bluetooth-frwk-service.service
165 %attr(0666,-,-) /opt/var/lib/bluetooth/auto-pair-blacklist
166 %{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-service.conf
167 %if %{with bluetooth_frwk_libnotify} || %{with bluetooth_frwk_libnotification}
168 %{_datadir}/icons/default/bt-icon.png
169 %endif
170
171 %files core
172 %manifest %{name}.manifest
173 %defattr(-, root, root)
174 %{_datadir}/dbus-1/system-services/org.projectx.bt_core.service
175 %{_bindir}/bt-core
176 %{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-core.conf