Handle switching between mutiple headsets
[platform/core/connectivity/bluetooth-agent.git] / packaging / bluetooth-agent.spec
1 %define _usrlibdir /usr/lib
2
3 Name:       bluetooth-agent
4 Summary:    Bluetooth agent packages that support various external profiles
5 Version:    0.1.2
6 Release:    1
7 Group:      Network & Connectivity/Bluetooth
8 License:    Apache-2.0
9 Source0:    %{name}-%{version}.tar.gz
10 Source1001:     bluetooth-agent.manifest
11
12 BuildRequires:  pkgconfig(aul)
13 BuildRequires:  pkgconfig(bluetooth-api)
14
15 # The profile macro usage with the following comments may be removed after
16 # Tizen OBS build projects are merged. However, each vendor may keep using
17 # such if/endif statement to skip building profiles not interested
18
19 # This usage of profile macro does NOT conflict 4.0 configurability.
20 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv"
21 # Original: wearable, ivi. Added: common, "undefined"
22 BuildRequires:  pkgconfig(alarm-service)
23 BuildRequires:  pkgconfig(capi-appfw-app-manager)
24 BuildRequires:  pkgconfig(capi-system-device)
25 %endif
26 # This usage of profile macro does NOT conflict 4.0 configurability.
27 %if "%{?profile}" != "wearable" && "%{?profile}" != "ivi"
28 # Original: common, mobile, tv. Added: "undefined"
29 BuildRequires:  pkgconfig(contacts-service2)
30 BuildRequires:  pkgconfig(msg-service)
31 BuildRequires:  pkgconfig(email-service)
32 %endif
33 BuildRequires:  pkgconfig(capi-system-info)
34 BuildRequires:  pkgconfig(dbus-glib-1)
35 BuildRequires:  pkgconfig(tapi)
36 BuildRequires:  pkgconfig(dlog)
37 BuildRequires:  pkgconfig(vconf)
38 BuildRequires:  pkgconfig(appsvc)
39 BuildRequires:  pkgconfig(capi-appfw-application)
40 BuildRequires:  pkgconfig(capi-media-image-util)
41 BuildRequires:  pkgconfig(contacts-service2)
42 BuildRequires:  pkgconfig(libexif)
43 BuildRequires:  pkgconfig(gio-2.0)
44 BuildRequires:  cmake
45 Requires: security-config
46 Requires:       %{name}-compat = %{version}-%{release}
47 Recommends:     %{name}-profile_common = %{version}-%{release}
48
49 %description
50 Bluetooth agent packages that support various external profiles
51
52 %package profile_common
53 Summary:        Bluetooth agent for common/tv/mobile
54 Provides:       %{name}-compat = %{version}-%{release}
55 Provides:       %{name}-profile_mobile = %{version}-%{release}
56 Provides:       %{name}-profile_tv = %{version}-%{release}
57 Conflicts:      %{name}-profile_ivi
58 Conflicts:      %{name}-profile_wearable
59 %description profile_common
60 Bluetooth agent binary compiled for common, tv, mobile profiles
61
62 %package profile_ivi
63 Summary:        Bluetooth agent for ivi
64 Provides:       %{name}-compat = %{version}-%{release}
65 Conflicts:      %{name}-profile_common
66 Conflicts:      %{name}-profile_wearable
67 %description profile_ivi
68 Bluetooth agent binary compiled for ivi profile
69
70 %package profile_wearable
71 Summary:        Bluetooth agent for wearable
72 Provides:       %{name}-compat = %{version}-%{release}
73 Conflicts:      %{name}-profile_common
74 Conflicts:      %{name}-profile_ivi
75 %description profile_wearable
76 Bluetooth agent binary compiled for wearable profile
77
78 %prep
79 %setup -q
80 cp %{SOURCE1001} .
81
82 %build
83 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
84 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
85 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
86 #export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_MEDIA_ENHANCE"
87 export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_HFP_AG"
88 export CFLAGS="$CFLAGS -DTIZEN_SUPPORT_DUAL_HF"
89
90 %ifarch aarch64
91 echo arch64
92 export CFLAGS+=" -DARCH64"
93 export CXXFLAGS+=" -DARCH64"
94 export FFLAGS+=" -DARCH64"
95 %endif
96
97 %ifarch x86_64
98 echo x86_64
99 export CFLAGS+=" -DARCH64"
100 export CXXFLAGS+=" -DARCH64"
101 export FFLAGS+=" -DARCH64"
102 %endif
103
104 export CFLAGS+=" -fpie -DTIZEN_FEATURE_BP_PBAP_SIM -fvisibility=hidden "
105 export CXXFLAGS+=" -fpie -DTIZEN_FEATURE_BP_PBAP_SIM -fvisibility=hidden "
106
107 export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
108
109 export CFLAGS_DEFAULT="$CFLAGS"
110
111 # This usage of profile macro does NOT conflict 4.0 configurability.
112 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv"
113 # Original: wearable, ivi. Added: common, "undefined"
114
115 # Build Wearable
116 export CFLAGS="$CFLAGS_DEFAULT -DTIZEN_PROFILE_WEARABLE"
117 export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_LUNAR_DEVICE"
118 mkdir -p wearable_build
119 pushd wearable_build
120 cmake .. -DCMAKE_INSTALL_PREFIX=/usr/wearable -DTIZEN_PROFILE_WEARABLE=1 -DTIZEN_FEATURE_BT_HFP_AG=1
121 make VERBOSE=1
122 popd
123
124
125 # Build IVI
126 # TODO: BT-Agent Developers, Please Check if TIZEN_KIRAN is really need for ALL NON-WEARABLES.
127 export CFLAGS="$CFLAGS_DEFAULT -DTIZEN_FEATURE_BT_KIRAN_DEVICE"
128 export CFLAGS="$CFLAGS -DTIZEN_PROFILE_IVI"
129 mkdir -p ivi_build
130 pushd ivi_build
131 cmake .. -DCMAKE_INSTALL_PREFIX=/usr/ivi -DTIZEN_PROFILE_WEARABLE=0 -DTIZEN_PROFILE_IVI=1 -DTIZEN_FEATURE_BT_HFP_AG=1
132 make VERBOSE=1
133 popd
134
135 %endif
136
137
138 # This usage of profile macro does NOT conflict 4.0 configurability.
139 %if "%{?profile}" != "wearable" && "%{?profile}" != "ivi"
140 # Original: common, mobile, tv. Added: "undefined"
141
142 # Build All Others (common/tv/mobile)
143 # TODO: BT-Agent Developers, Please Check if TIZEN_KIRAN is really need for ALL NON-WEARABLES.
144 export CFLAGS="$CFLAGS_DEFAULT -DTIZEN_FEATURE_BT_KIRAN_DEVICE"
145 mkdir -p common_build
146 pushd common_build
147 cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DTIZEN_PROFILE_WEARABLE=0 -DTIZEN_FEATURE_BT_HFP_AG=1
148 make VERBOSE=1
149 popd
150
151 %endif
152
153 %install
154 rm -rf %{buildroot}
155 # This usage of profile macro does NOT conflict 4.0 configurability.
156 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv"
157 # Original: wearable, ivi. Added: common, "undefined"
158 pushd wearable_build
159 %make_install
160 popd
161 pushd ivi_build
162 %make_install
163 popd
164 %endif
165
166 # This usage of profile macro does NOT conflict 4.0 configurability.
167 %if "%{?profile}" != "wearable" && "%{?profile}" != "ivi"
168 # Original: common, mobile, tv. Added: "undefined"
169 pushd common_build
170 %make_install
171 popd
172 %endif
173
174 install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-agent
175 install -D -m 0644 packaging/bluetooth-map-agent.service %{buildroot}%{_libdir}/systemd/user/bluetooth-map-agent.service
176 # This usage of profile macro does NOT conflict 4.0 configurability.
177 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv"
178 # Original: wearable, ivi. Added: common, "undefined"
179 mv %{buildroot}/usr/wearable/share/dbus-1/system-services/org.bluez.hf_agent.service %{buildroot}%{_datadir}/dbus-1/system-services/
180 mv %{buildroot}/usr/wearable/bin/bluetooth-hf-agent %{buildroot}%{_bindir}/
181 mv %{buildroot}/usr/ivi/bin/bluetooth-hf-agent %{buildroot}%{_bindir}/bluetooth-hf-agent.ivi
182 rm -Rf %{buildroot}/usr/ivi
183 rm -Rf %{buildroot}/usr/wearable
184 %endif
185 install -D -m 0644 packaging/bluetooth-pbap-agent.service %{buildroot}%{_libdir}/systemd/system/bluetooth-pbap-agent.service
186
187 %post
188 %if 0%{?sec_product_feature_bt_map_server_enable}
189 ln -sf %{_libdir}/systemd/user/bluetooth-map-agent.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
190 %endif
191 ln -sf %{_libdir}/systemd/system/bluetooth-pbap-agent.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
192
193 # This usage of profile macro does NOT conflict 4.0 configurability.
194 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv"
195 # Original: wearable, ivi. Added: common, "undefined"
196 %post profile_ivi
197 ln -sf bluetooth-hf-agent.ivi %{_bindir}/bluetooth-hf-agent
198 %preun profile_ivi
199 rm %{_bindir}/bluetooth-hf-agent
200 %endif
201
202 %files
203 %manifest %{name}.manifest
204 %defattr(-, root, root)
205 %{_datadir}/license/bluetooth-agent
206
207 # This usage of profile macro does NOT conflict 4.0 configurability.
208 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv"
209 # Original: wearable, ivi. Added: common, "undefined"
210 %files profile_wearable
211 %{_bindir}/bluetooth-hf-agent
212 %{_datadir}/dbus-1/system-services/org.bluez.hf_agent.service
213 %exclude %{_libdir}/systemd/user/bluetooth-map-agent.service
214 %exclude %{_libdir}/systemd/system/bluetooth-pbap-agent.service
215
216 %files profile_ivi
217 %{_bindir}/bluetooth-hf-agent.ivi
218 %{_datadir}/dbus-1/system-services/org.bluez.hf_agent.service
219 %exclude %{_libdir}/systemd/user/bluetooth-map-agent.service
220 %exclude %{_libdir}/systemd/system/bluetooth-pbap-agent.service
221 %endif
222
223 # This usage of profile macro does NOT conflict 4.0 configurability.
224 %if "%{?profile}" != "wearable" && "%{?profile}" != "ivi"
225 # Original: common, mobile, tv. Added: "undefined"
226 %files profile_common
227 %{_bindir}/bluetooth-ag-agent
228 %{_bindir}/bluetooth-map-agent
229 %{_bindir}/bluetooth-pb-agent
230 %{_datadir}/dbus-1/system-services/org.bluez.pb_agent.service
231 %{_datadir}/dbus-1/services/org.bluez.map_agent.service
232 %{_datadir}/dbus-1/system-services/org.bluez.ag_agent.service
233 %attr(0666,-,-) /var/lib/bluetooth/voice-recognition-blacklist
234 %{_sysconfdir}/dbus-1/system.d/bluetooth-ag-agent.conf
235 %{_libdir}/systemd/user/bluetooth-map-agent.service
236 %{_libdir}/systemd/system/bluetooth-pbap-agent.service
237 %endif