242016e62033cb1e7863eb99308458f1302353fd
[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.6.0
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 BuildRequires:  pkgconfig(capi-media-audio-io)
15
16 # The profile macro usage with the following comments may be removed after
17 # Tizen OBS build projects are merged. However, each vendor may keep using
18 # such if/endif statement to skip building profiles not interested
19
20 # This usage of profile macro does NOT conflict 4.0 configurability.
21 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv"
22 # Original: wearable, ivi. Added: common, "undefined"
23 BuildRequires:  pkgconfig(alarm-service)
24 BuildRequires:  pkgconfig(capi-appfw-app-manager)
25 BuildRequires:  pkgconfig(capi-system-device)
26 %endif
27 # This usage of profile macro does NOT conflict 4.0 configurability.
28 %if "%{?profile}" != "wearable" && "%{?profile}" != "ivi"
29 # Original: common, mobile, tv. Added: "undefined"
30 BuildRequires:  pkgconfig(contacts-service2)
31 BuildRequires:  pkgconfig(msg-service)
32 BuildRequires:  pkgconfig(email-service)
33 %endif
34 BuildRequires:  pkgconfig(capi-system-info)
35 BuildRequires:  pkgconfig(dbus-1)
36 BuildRequires:  pkgconfig(tapi)
37 BuildRequires:  pkgconfig(dlog)
38 BuildRequires:  pkgconfig(vconf)
39 BuildRequires:  pkgconfig(appsvc)
40 BuildRequires:  pkgconfig(capi-appfw-application)
41 BuildRequires:  pkgconfig(capi-network-connection)
42 BuildRequires:  pkgconfig(capi-network-bluetooth)
43 BuildRequires:  pkgconfig(capi-media-image-util)
44 BuildRequires:  pkgconfig(contacts-service2)
45 BuildRequires:  pkgconfig(libexif)
46 BuildRequires:  pkgconfig(gio-2.0)
47 BuildRequires:  cmake
48 Requires: security-config
49 %if 0%{?gcov:1}
50 BuildRequires:  gtest-devel
51 BuildRequires:  lcov
52 %endif
53
54 #Requires:      %{name}-compat = %{version}-%{release}
55 #Recommends:    %{name}-profile_common = %{version}-%{release}
56
57 %description
58 Bluetooth agent packages that support various external profiles
59
60 %package hfp_ag
61 Summary:        Bluetooth agent for HFP(Hands-Free Profile)'s AG(Audio Gate) role
62 Requires:   %{name} = %{version}-%{release}
63 Group:      Network & Connectivity/Bluetooth
64 %description hfp_ag
65 Bluetooth agent binary compiled for HFP(Hands-Free Profile)'s AG(Audio Gate) role
66
67 %package hfp_hf
68 Summary:        Bluetooth agent for HFP(Hands-Free Profile)'s HF(Hands-Free) role
69 Requires:   %{name} = %{version}-%{release}
70 Group:      Network & Connectivity/Bluetooth
71 %description hfp_hf
72 Bluetooth agent binary compiled for HFP(Hands-Free Profile)'s HF(Hands-Free) role
73
74 %package map
75 Summary:        Bluetooth agent for MAP(Message Access Profile) server
76 Requires:   %{name} = %{version}-%{release}
77 Group:      Network & Connectivity/Bluetooth
78 %description map
79 Bluetooth agent binary compiled for MAP(Message Access Profile) server
80
81 %package pbap
82 Summary:        Bluetooth agent for PBAP(PhoneBook Access Profile) server
83 Requires:   %{name} = %{version}-%{release}
84 Group:      Network & Connectivity/Bluetooth
85 %description pbap
86 Bluetooth agent binary compiled for PBAP(PhoneBook Access Profile) server
87
88 %package hid
89 Summary:        Bluetooth agent for HID(Human Interface Device)'s device role
90 Requires:   %{name} = %{version}-%{release}
91 Group:      Network & Connectivity/Bluetooth
92 %description hid
93 Bluetooth agent binary compiled for HID(Human Interface Device)'s device role
94
95 %package ipsp
96 Summary:        Bluetooth agent for IPSP(Internet Protocol Support Profile)
97 Requires:   %{name} = %{version}-%{release}
98 Group:      Network & Connectivity/Bluetooth
99 %description ipsp
100 Bluetooth agent binary compiled for IPSP(Internet Protocol Support Profile)
101
102 %package tool
103 Summary:       Test Application for HF
104
105 %description tool
106 Test Application for HF
107
108 %prep
109 %setup -q
110 cp %{SOURCE1001} .
111
112 %build
113 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
114 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
115 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
116 export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_MEDIA_ENHANCE"
117 export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_HFP_AG"
118 export CFLAGS="$CFLAGS -DTIZEN_SUPPORT_DUAL_HF"
119
120 %ifarch aarch64 x86_64
121 echo arch64
122 export CFLAGS+=" -DARCH64"
123 export CXXFLAGS+=" -DARCH64"
124 export FFLAGS+=" -DARCH64"
125 %endif
126
127 export CFLAGS+=" -fpie -DTIZEN_FEATURE_BP_PBAP_SIM -fvisibility=hidden "
128 export CXXFLAGS+=" -fpie -DTIZEN_FEATURE_BP_PBAP_SIM -fvisibility=hidden "
129
130 export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
131
132 export CFLAGS_DEFAULT="$CFLAGS"
133
134 %if 0%{?gcov:1}
135 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
136 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
137 export FFLAGS+=" -fprofile-arcs -ftest-coverage"
138 export LDFLAGS+=" -lgcov"
139 %endif
140
141 # Build All (wearalbe/ivi/common/tv/mobile)
142 %cmake . -DCMAKE_INSTALL_PREFIX=/usr \
143         -DTIZEN_FEATURE_BT_HFP_AG=1 \
144         -DBUILD_GTESTS=%{?gcov:1}%{!?gcov:0} \
145         -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0}
146
147 make VERBOSE=1
148
149 %if 0%{?gcov:1}
150 mkdir -p gcov-obj
151 find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
152 %endif
153
154 %install
155 rm -rf %{buildroot}
156 %make_install
157
158 mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants/
159
160 # This usage of profile macro does NOT conflict 4.0 configurability.
161 #%if "%{?profile}" != "mobile" && "%{?profile}" != "tv"
162 # Original: wearable, ivi. Added: common, "undefined"
163 #mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services
164 #mkdir -p %{buildroot}%{_bindir}/
165 #install -D -m 0644 %{buildroot}/usr/share/dbus-1/system-services/org.bluez.hf_agent.service %{buildroot}%{_datadir}/dbus-1/system-services/
166 #install -D -m 0644 %{buildroot}/usr/share/dbus-1/system-services/org.bluez.ipsp_agent.service %{buildroot}%{_datadir}/dbus-1/system-services/
167 #install -D -m 0644 %{buildroot}/usr/bin/bluetooth-hf-agent %{buildroot}%{_bindir}/
168 #install -D -m 0644 %{buildroot}/usr/bin/bluetooth-ipsp-agent %{buildroot}%{_bindir}/
169 #%endif
170 install -D -m 0644 packaging/bluetooth-map-agent.service %{buildroot}%{_unitdir}/bluetooth-map-agent.service
171 install -D -m 0644 packaging/bluetooth-pbap-agent.service %{buildroot}%{_unitdir}/bluetooth-pbap-agent.service
172 install -D -m 0644 packaging/bluetooth-ag-agent.service %{buildroot}%{_unitdir}/bluetooth-ag-agent.service
173 install -D -m 0644 packaging/bluetooth-hf-agent.service %{buildroot}%{_unitdir}/bluetooth-hf-agent.service
174 install -D -m 0644 packaging/bluetooth-hid-agent.service %{buildroot}%{_unitdir}/bluetooth-hid-agent.service
175 ln -s ../bluetooth-hf-agent.service %{buildroot}%{_unitdir}/multi-user.target.wants/bluetooth-hf-agent.service
176
177 %if 0%{?gcov:1}
178 mkdir -p %{buildroot}%{_datadir}/gcov/obj/%{name}
179 install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj/%{name}/
180 %endif
181
182 %check
183 %if 0%{?gcov:1}
184 pushd unittest
185 ./run_coverage.sh
186 popd
187 %endif
188
189 %files
190 %manifest %{name}.manifest
191 %license LICENSE
192 %defattr(-, root, root)
193 %exclude %{_bindir}/gtest-bluetooth-agent
194 %exclude %{_libdir}/lib*
195 %exclude %{_datadir}/gcov/obj/*
196
197 %files hfp_ag
198 %manifest %{name}.manifest
199 %license LICENSE
200 %{_bindir}/bluetooth-ag-agent
201 %attr(0666,-,-) /var/lib/bluetooth/voice-recognition-blacklist
202 %{_datadir}/dbus-1/system-services/org.bluez.ag_agent.service
203 %{_sysconfdir}/dbus-1/system.d/bluetooth-ag-agent.conf
204 %{_unitdir}/bluetooth-ag-agent.service
205 #%exclude %{_unitdir}/bluetooth-map-agent.service
206 #%exclude %{_unitdir}/bluetooth-pbap-agent.service
207
208 %files hfp_hf
209 %manifest %{name}.manifest
210 %license LICENSE
211 %{_bindir}/bluetooth-hf-agent
212 %{_datadir}/dbus-1/system-services/org.bluez.hf_agent.service
213 %{_sysconfdir}/dbus-1/system.d/bluetooth-hf-agent.conf
214 %{_unitdir}/bluetooth-hf-agent.service
215 %{_unitdir}/multi-user.target.wants/bluetooth-hf-agent.service
216 #%exclude %{_unitdir}/bluetooth-map-agent.service
217 #%exclude %{_unitdir}/bluetooth-pbap-agent.service
218
219 %files map
220 %manifest %{name}.manifest
221 %license LICENSE
222 %{_bindir}/bluetooth-map-agent
223 %{_datadir}/dbus-1/system-services/org.bluez.map_agent.service
224 %{_unitdir}/bluetooth-map-agent.service
225 %{_sysconfdir}/dbus-1/system.d/bluetooth_map_agent.conf
226
227 %files pbap
228 %manifest %{name}.manifest
229 %license LICENSE
230 %{_bindir}/bluetooth-pb-agent
231 %{_datadir}/dbus-1/system-services/org.bluez.pb_agent.service
232 %{_unitdir}/bluetooth-pbap-agent.service
233 %{_sysconfdir}/dbus-1/system.d/bluetooth_pb_agent.conf
234
235 %files hid
236 %manifest %{name}.manifest
237 %license LICENSE
238 %{_bindir}/bluetooth-hid-agent
239 %{_datadir}/dbus-1/system-services/org.bluez.hid_agent.service
240 %{_unitdir}/bluetooth-hid-agent.service
241 %{_sysconfdir}/dbus-1/system.d/bluetooth-hid-agent.conf
242
243 %files ipsp
244 %manifest %{name}.manifest
245 %license LICENSE
246 %{_bindir}/bluetooth-ipsp-agent
247 %{_datadir}/dbus-1/system-services/org.bluez.ipsp_agent.service
248 %{_sysconfdir}/dbus-1/system.d/bluetooth-ipsp-agent.conf
249
250 %files tool
251 %{_bindir}/hf-test