Remove Profile Build Dependency
[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
89 %ifarch aarch64
90 echo arch64
91 export CFLAGS+=" -DARCH64"
92 export CXXFLAGS+=" -DARCH64"
93 export FFLAGS+=" -DARCH64"
94 %endif
95
96 %ifarch x86_64
97 echo x86_64
98 export CFLAGS+=" -DARCH64"
99 export CXXFLAGS+=" -DARCH64"
100 export FFLAGS+=" -DARCH64"
101 %endif
102
103 export CFLAGS+=" -fpie -DTIZEN_FEATURE_BP_PBAP_SIM -fvisibility=hidden "
104 export CXXFLAGS+=" -fpie -DTIZEN_FEATURE_BP_PBAP_SIM -fvisibility=hidden "
105
106 export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
107
108 export CFLAGS_DEFAULT="$CFLAGS"
109
110 # This usage of profile macro does NOT conflict 4.0 configurability.
111 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv"
112 # Original: wearable, ivi. Added: common, "undefined"
113
114 # Build Wearable
115 export CFLAGS="$CFLAGS_DEFAULT -DTIZEN_PROFILE_WEARABLE"
116 export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_LUNAR_DEVICE"
117 mkdir -p wearable_build
118 pushd wearable_build
119 cmake .. -DCMAKE_INSTALL_PREFIX=/usr/wearable -DTIZEN_PROFILE_WEARABLE=1 -DTIZEN_FEATURE_BT_HFP_AG=1
120 make VERBOSE=1
121 popd
122
123
124 # Build IVI
125 # TODO: BT-Agent Developers, Please Check if TIZEN_KIRAN is really need for ALL NON-WEARABLES.
126 export CFLAGS="$CFLAGS_DEFAULT -DTIZEN_FEATURE_BT_KIRAN_DEVICE"
127 export CFLAGS="$CFLAGS -DTIZEN_PROFILE_IVI"
128 mkdir -p ivi_build
129 pushd ivi_build
130 cmake .. -DCMAKE_INSTALL_PREFIX=/usr/ivi -DTIZEN_PROFILE_WEARABLE=0 -DTIZEN_PROFILE_IVI=1 -DTIZEN_FEATURE_BT_HFP_AG=1
131 make VERBOSE=1
132 popd
133
134 %endif
135
136
137 # This usage of profile macro does NOT conflict 4.0 configurability.
138 %if "%{?profile}" != "wearable" && "%{?profile}" != "ivi"
139 # Original: common, mobile, tv. Added: "undefined"
140
141 # Build All Others (common/tv/mobile)
142 # TODO: BT-Agent Developers, Please Check if TIZEN_KIRAN is really need for ALL NON-WEARABLES.
143 export CFLAGS="$CFLAGS_DEFAULT -DTIZEN_FEATURE_BT_KIRAN_DEVICE"
144 mkdir -p common_build
145 pushd common_build
146 cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DTIZEN_PROFILE_WEARABLE=0 -DTIZEN_FEATURE_BT_HFP_AG=1
147 make VERBOSE=1
148 popd
149
150 %endif
151
152 %install
153 rm -rf %{buildroot}
154 # This usage of profile macro does NOT conflict 4.0 configurability.
155 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv"
156 # Original: wearable, ivi. Added: common, "undefined"
157 pushd wearable_build
158 %make_install
159 popd
160 pushd ivi_build
161 %make_install
162 popd
163 %endif
164
165 # This usage of profile macro does NOT conflict 4.0 configurability.
166 %if "%{?profile}" != "wearable" && "%{?profile}" != "ivi"
167 # Original: common, mobile, tv. Added: "undefined"
168 pushd common_build
169 %make_install
170 popd
171 %endif
172
173 install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-agent
174 install -D -m 0644 packaging/bluetooth-map-agent.service %{buildroot}%{_libdir}/systemd/user/bluetooth-map-agent.service
175 # This usage of profile macro does NOT conflict 4.0 configurability.
176 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv"
177 # Original: wearable, ivi. Added: common, "undefined"
178 mv %{buildroot}/usr/wearable/share/dbus-1/system-services/org.bluez.hf_agent.service %{buildroot}%{_datadir}/dbus-1/system-services/
179 mv %{buildroot}/usr/wearable/bin/bluetooth-hf-agent %{buildroot}%{_bindir}/
180 mv %{buildroot}/usr/ivi/bin/bluetooth-hf-agent %{buildroot}%{_bindir}/bluetooth-hf-agent.ivi
181 rm -Rf %{buildroot}/usr/ivi
182 rm -Rf %{buildroot}/usr/wearable
183 %endif
184 install -D -m 0644 packaging/bluetooth-pbap-agent.service %{buildroot}%{_libdir}/systemd/system/bluetooth-pbap-agent.service
185
186 %post
187 %if 0%{?sec_product_feature_bt_map_server_enable}
188 ln -sf %{_libdir}/systemd/user/bluetooth-map-agent.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
189 %endif
190 ln -sf %{_libdir}/systemd/system/bluetooth-pbap-agent.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
191
192 # This usage of profile macro does NOT conflict 4.0 configurability.
193 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv"
194 # Original: wearable, ivi. Added: common, "undefined"
195 %post profile_ivi
196 ln -sf bluetooth-hf-agent.ivi %{_bindir}/bluetooth-hf-agent
197 %preun profile_ivi
198 rm %{_bindir}/bluetooth-hf-agent
199 %endif
200
201 %files
202 %manifest %{name}.manifest
203 %defattr(-, root, root)
204 %{_datadir}/license/bluetooth-agent
205
206 # This usage of profile macro does NOT conflict 4.0 configurability.
207 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv"
208 # Original: wearable, ivi. Added: common, "undefined"
209 %files profile_wearable
210 %{_bindir}/bluetooth-hf-agent
211 %{_datadir}/dbus-1/system-services/org.bluez.hf_agent.service
212 %exclude %{_libdir}/systemd/user/bluetooth-map-agent.service
213 %exclude %{_libdir}/systemd/system/bluetooth-pbap-agent.service
214
215 %files profile_ivi
216 %{_bindir}/bluetooth-hf-agent.ivi
217 %{_datadir}/dbus-1/system-services/org.bluez.hf_agent.service
218 %exclude %{_libdir}/systemd/user/bluetooth-map-agent.service
219 %exclude %{_libdir}/systemd/system/bluetooth-pbap-agent.service
220 %endif
221
222 # This usage of profile macro does NOT conflict 4.0 configurability.
223 %if "%{?profile}" != "wearable" && "%{?profile}" != "ivi"
224 # Original: common, mobile, tv. Added: "undefined"
225 %files profile_common
226 %{_bindir}/bluetooth-ag-agent
227 %{_bindir}/bluetooth-map-agent
228 %{_bindir}/bluetooth-pb-agent
229 %{_datadir}/dbus-1/system-services/org.bluez.pb_agent.service
230 %{_datadir}/dbus-1/services/org.bluez.map_agent.service
231 %{_datadir}/dbus-1/system-services/org.bluez.ag_agent.service
232 %attr(0666,-,-) /var/lib/bluetooth/voice-recognition-blacklist
233 %{_sysconfdir}/dbus-1/system.d/bluetooth-ag-agent.conf
234 %{_libdir}/systemd/user/bluetooth-map-agent.service
235 %{_libdir}/systemd/system/bluetooth-pbap-agent.service
236 %endif