+# Do not create provides from emulator .so files because the main package
+# should anchor any reverse-dependencies
+%global __provides_exclude_from ^(.*\\.emulator)$
+
%bcond_with x
%define _dumpdir /opt/etc/dump.d/module.d
%define _varlibdir /opt/var/lib
+%define _meshdir /opt/usr/mesh
Name: bluetooth-frwk
Summary: Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
-Version: 0.2.151
+Version: 0.6.0
Release: 1
Group: Network & Connectivity/Bluetooth
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
Source1001: bluetooth-frwk.manifest
-%if %{with bluetooth_frwk_libnotify} || %{with bluetooth_frwk_libnotification}
-Source1002: bt-icon.png
-%endif
-Requires: dbus
-Requires: syspopup
-%if "%{?profile}" != "mobile"
Requires: bluetooth-tools
-%endif
+
+%define bt_bluez_hal ENABLED
+%define bt_gatt_client_fd ENABLED
+%define bt_permanent_log DISABLED
+%define bt_http_proxy DISABLED
+%define bt_factory_mode DISABLED
+%define bt_vendor_operation DISABLED
+
BuildRequires: pkgconfig(aul)
-BuildRequires: pkgconfig(dbus-glib-1)
+%if %{bt_factory_mode} == ENABLED
+BuildRequires: pkgconfig(bincfg)
+%endif
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(gio-unix-2.0)
-%if %{with bluetooth_frwk_libnotify}
-BuildRequires: pkgconfig(libnotify)
-BuildRequires: pkgconfig(gdk-pixbuf-2.0)
-BuildRequires: pkgconfig(gtk+-3.0)
-%elif %{without bluetooth_frwk_libnotification}
-BuildRequires: pkgconfig(syspopup-caller)
-Requires: syspopup
-%else
BuildRequires: pkgconfig(syspopup-caller)
-%endif
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(libxml-2.0)
-BuildRequires: pkgconfig(dbus-1)
-%if %{with x}
-BuildRequires: pkgconfig(utilX)
-%endif
BuildRequires: pkgconfig(capi-network-connection)
BuildRequires: pkgconfig(alarm-service)
BuildRequires: pkgconfig(capi-content-mime-type)
-BuildRequires: pkgconfig(appcore-efl)
-BuildRequires: pkgconfig(pkgmgr)
-#BuildRequires: pkgconfig(journal)
BuildRequires: pkgconfig(eventsystem)
+%if %{bt_http_proxy} == ENABLED
BuildRequires: pkgconfig(libsoup-2.4)
-%if "%{?profile}" == "mobile"
-BuildRequires: pkgconfig(capi-network-tethering)
%endif
+BuildRequires: pkgconfig(capi-network-tethering)
BuildRequires: cmake
BuildRequires: pkgconfig(cynara-client)
BuildRequires: pkgconfig(cynara-creds-gdbus)
BuildRequires: pkgconfig(libtzplatform-config)
+BuildRequires: pkgconfig(json-c)
+BuildRequires: pkgconfig(ell)
BuildRequires: pkgconfig(storage)
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(capi-appfw-app-control)
+BuildRequires: pkgconfig(gmock)
+BuildRequires: pkgconfig(libactd)
+BuildRequires: pkgconfig(libsystemd-daemon)
Requires(post): /usr/bin/vconftool
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
-Requires: psmisc
%description
Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
- This package contains API set for BT GAP, BT SDP, and BT RFCOMM.
+This package contains API set for BT GAP, BT SDP, BT RFCOMM and BLE Mesh.
+
+%package profile_common
+Summary: bluetooth-frwk service and conf files for common profile
+Requires: %{name} = %{version}-%{release}
+Conflicts: %{name}-profile_mobile
+Conflicts: %{name}-profile_wearable
+Conflicts: %{name}-profile_tv
+Conflicts: %{name}-profile_ivi
+%description profile_common
+Bluetooth framework configuration and service files for Tizen common profile
+
+%package profile_mobile
+Summary: bluetooth-frwk service and conf files for mobile profile
+Requires: %{name} = %{version}-%{release}
+Conflicts: %{name}-profile_common
+Conflicts: %{name}-profile_wearable
+Conflicts: %{name}-profile_tv
+Conflicts: %{name}-profile_ivi
+%description profile_mobile
+Bluetooth framework configuration and service files for Tizen mobile profile
+
+# extension-TM1
+%ifarch %{ix86} || %{arm}
+%package extension-TM1
+Summary: bluetooth-frwk service and conf files for mobile TM1
+Requires: %{name}-profile_mobile = %{version}-%{release}
+%description extension-TM1
+Bluetooth framework configuration and service files for Tizen mobile TM1
+%endif
+%package profile_wearable
+Summary: bluetooth-frwk service and conf files for wearable profile
+Requires: %{name} = %{version}-%{release}
+Conflicts: %{name}-profile_mobile
+Conflicts: %{name}-profile_common
+Conflicts: %{name}-profile_tv
+Conflicts: %{name}-profile_ivi
+%description profile_wearable
+Bluetooth framework configuration and service files for Tizen wearable profile
+
+%package profile_tv
+Summary: bluetooth-frwk service and conf files for tv profile
+Requires: %{name} = %{version}-%{release}
+Conflicts: %{name}-profile_mobile
+Conflicts: %{name}-profile_wearable
+Conflicts: %{name}-profile_common
+Conflicts: %{name}-profile_ivi
+%description profile_tv
+Bluetooth framework configuration and service files for Tizen tv profile
+
+%package profile_ivi
+Summary: bluetooth-frwk service and conf files for ivi profile
+Requires: %{name} = %{version}-%{release}
+Conflicts: %{name}-profile_mobile
+Conflicts: %{name}-profile_wearable
+Conflicts: %{name}-profile_tv
+Conflicts: %{name}-profile_common
+%description profile_ivi
+Bluetooth framework configuration and service files for Tizen ivi profile
+
+%ifarch %{ix86} x86_64
+%package extension-emulator
+Summary: bluetooth-frwk service and conf files for emulator
+Requires: %{name} = %{version}-%{release}
+%description extension-emulator
+bluetooth-frwk service and conf files for emulator
+%endif // ifarch %{ix86} x86_64
%package devel
Summary: Bluetooth framework for BlueZ and Obexd
%description service
This package is Bluetooth Service daemon to manage BT services.
+%if %{bt_http_proxy} == ENABLED
%package httpproxy
Summary: Bluetooth HTTP Proxy Service daemon
-Group: TO_BE/FILLED
+Group: Network & Connectivity/Bluetooth
Requires: %{name} = %{version}-%{release}
%description httpproxy
This package is Bluetooth HTTP Proxy Service daemon
+%endif
+
+%package otp
+Summary: Bluetooth OTP Service daemon
+Group: Network & Connectivity/Bluetooth
+Requires: %{name} = %{version}-%{release}
+
+%description otp
+This package is Bluetooth OTP Service daemon
%package core
Summary: Bluetooth Core daemon
%description test
This package is Bluetooth test application.
+%package oal
+Summary: Bluetooth OAL
+Group: Network & Connectivity/Bluetooth
+Requires: %{name} = %{version}-%{release}
+
+%description oal
+This package is BT stack common interface.
+
+%package plugin-headed
+Summary: Bluetooth plugin Headed
+Group: Network & Connectivity/Bluetooth
+Requires: %{name} = %{version}-%{release}
+
+%description plugin-headed
+This package is Bluetooth plugin to manage UI and syspopup
+
+%package -n bluetooth-haltests
+Summary: HAL Test package for bluetooth OAL
+Group: TO_BE/FILLED
+Requires: %{name} = %{version}-%{release}
+
+%description -n bluetooth-haltests
+This package is C-API test application.
+
%prep
%setup -q
cp %{SOURCE1001} .
%build
export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_OBEX"
+export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_PAN_NAP"
+export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_IPSP"
export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
%define _servicedir starter.target.wants
%if "%{?profile}" == "mobile"
-export CFLAGS="$CFLAGS -DTIZEN_NETWORK_TETHERING_ENABLE -DTIZEN_BT_FLIGHTMODE_ENABLED -DTIZEN_MOBILE -DTIZEN_TELEPHONY_ENABLED"
+export CFLAGS="$CFLAGS -DTIZEN_FEATURE_NETWORK_TETHERING_ENABLE -DTIZEN_FEATURE_FLIGHTMODE_ENABLED -DTIZEN_PROFILE_MOBILE -DTIZEN_FEATURE_TELEPHONY_ENABLED"
%if "%{?tizen_target_name}" == "TM1"
%define _servicefile packaging/bluetooth-frwk-mobile-sprd.service
%else
%define _servicefile packaging/bluetooth-frwk-mobile.service
%endif
-%define _servicedir default.target.wants
+%define _servicedir multi-user.target.wants
%endif
%if "%{?profile}" == "wearable"
-export CFLAGS="$CFLAGS -DTIZEN_WEARABLE -DTIZEN_BT_FLIGHTMODE_ENABLED"
+export CFLAGS="$CFLAGS -DTIZEN_PROFILE_WEARABLE -DTIZEN_FEATURE_FLIGHTMODE_ENABLED"
%define _servicefile packaging/bluetooth-frwk-wearable.service
%define _servicedir multi-user.target.wants
%endif
%if "%{?profile}" == "tv"
export CFLAGS="$CFLAGS -DUSB_BLUETOOTH -DTIZEN_TV -DAUTO_ACCEPT"
-%define _servicefile packaging/bluetooth-frwk-mobile.service
+%define _servicefile packaging/bluetooth-frwk-tv.service
+%define _servicedir multi-user.target.wants
+%endif
+
+%if "%{?profile}" == "ivi"
+export CFLAGS="$CFLAGS -DTIZEN_PROFILE_IVI"
+%define _servicefile packaging/bluetooth-frwk-wearable.service
%define _servicedir multi-user.target.wants
%endif
%ifarch x86_64
-export CFLAGS="$CFLAGS -Wall -g -fvisibility=hidden -fPIC"
+#export CFLAGS="$CFLAGS -Wall -g -fvisibility=hidden -fPIC"
+export CFLAGS="$CFLAGS -fpie"
+export CFLAGS+=" -DARCH64"
+export CXXFLAGS+=" -DARCH64"
+export FFLAGS+=" -DARCH64"
%else
export CFLAGS="$CFLAGS -fpie"
export LDFLAGS="$CFLAGS -pie"
%endif
-export CFLAGS="$CFLAGS -DRFCOMM_DIRECT"
+%if %{bt_bluez_hal} == ENABLED
+export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_RFCOMM_DIRECT -DTIZEN_BT_HAL"
+%else
+export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_RFCOMM_DIRECT"
+%endif
export LDFLAGS="$CFLAGS -Wl,--rpath=%{_libdir} -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs"
-%if "%{?_with_emulator}" == "1"
-export CFLAGS="$CFLAGS -DEMUL"
-export CXXFLAGS="$CXXFLAGS -DEMUL"
-export FFLAGS="$FFLAGS -DEMUL"
+%if %{bt_gatt_client_fd} == DISABLED
+export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_GATT_CLIENT_FD_DISABLE"
+%endif
+
+%if %{bt_permanent_log} == ENABLED
+export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_PERMANENT_LOG"
+%endif
+
+%if %{bt_http_proxy} == ENABLED
+export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_HTTP_PROXY"
+%endif
+
+%if %{bt_factory_mode} == ENABLED
+export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_FACTORY_MODE"
%endif
+%if %{bt_vendor_operation} == ENABLED
+export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_VENDOR_OPERATION"
+%endif
+
+%if %{bt_bluez_hal} == ENABLED
+export BT_INCLUDE_OAL_BLUEZ=ENABLED
+export CFLAGS="$CFLAGS -DTIZEN_BT_INCLUDE_OAL_BLUEZ"
+%else
+export BT_INCLUDE_OAL_BLUEZ=DISABLED
+%endif
+
+export CFLAGS_DEFAULT="$CFLAGS"
+export CXXFLAGS_DEFAULT="$CXXFLAGS"
+export FFLAGS_DEFAULT="$FFLAGS"
+
+# extension-TM1
+%ifarch %{ix86} || %{arm}
+mkdir -p tm1
+export CFLAGS="$CFLAGS_DEFAULT -DTIZEN_FEATURE_BT_RFCOMM_DIRECT"
+export CXXFLAGS="$CXXFLAGS_DEFAULT -DTIZEN_FEATURE_BT_RFCOMM_DIRECT"
+export FFLAGS="$FFLAGS_DEFAULT -DTIZEN_FEATURE_BT_RFCOMM_DIRECT"
+
cmake . -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_LIB_DIR=%{_libdir} \
-DTZ_SYS_USER_GROUP=%TZ_SYS_USER_GROUP \
-DTZ_SYS_DEFAULT_USER=%TZ_SYS_DEFAULT_USER \
-%if %{with bluetooth_frwk_libnotify}
- -DLIBNOTIFY_SUPPORT=On \
-%else
-DLIBNOTIFY_SUPPORT=Off \
-%endif
-%if %{with bluetooth_frwk_libnotification}
- -DLIBNOTIFICATION_SUPPORT=On
-%else
-DLIBNOTIFICATION_SUPPORT=Off
+make %{?_smp_mflags}
+
+%cmake
+
+%make_install
+cp %{buildroot}%{_bindir}/bt-core tm1/bt-core.tm1
%endif
-make
+# extension-emulator
+%ifarch %{ix86} x86_64
+export CFLAGS="${CFLAGS} -DTIZEN_FEATURE_BT_RFCOMM_DIRECT"
+export CXXFLAGS="${CXXFLAGS} -DTIZEN_FEATURE_BT_RFCOMM_DIRECT"
+export FFLAGS="${FFLAGS} -DTIZEN_FEATURE_BT_RFCOMM_DIRECT"
-%cmake \
-%if "%{?profile}" == "wearable"
- -DTIZEN_WEARABLE=YES \
-%else
- -DTIZEN_WEARABLE=NO \
+mkdir -p build_emulator
+
+cmake . -DCMAKE_INSTALL_PREFIX=/usr \
+-DCMAKE_LIB_DIR=%{_libdir} \
+-DTZ_SYS_USER_GROUP=%TZ_SYS_USER_GROUP \
+-DTZ_SYS_DEFAULT_USER=%TZ_SYS_DEFAULT_USER \
+ -DLIBNOTIFY_SUPPORT=Off \
+ -DLIBNOTIFICATION_SUPPORT=Off
+make %{?_smp_mflags}
+
+%cmake
+
+%make_install
+cp %{buildroot}%{_libdir}/libbluetooth-api.so* build_emulator/
+pushd build_emulator/
+for FILE in libbluetooth-api.so*; do mv "${FILE}" "${FILE}.emulator"; done
+popd
%endif
-%if "%{?profile}" == "common"
- -DTIZEN_WEARABLE=NO \
+
+# non-extension-TM1 / non-extension-emulator
+
+export CFLAGS="$CFLAGS_DEFAULT -DTIZEN_FEATURE_BT_RFCOMM_DIRECT"
+export CXXFLAGS="$CXXFLAGS_DEFAULT -DTIZEN_FEATURE_BT_RFCOMM_DIRECT"
+export FFLAGS="$FFLAGS_DEFAULT -DTIZEN_FEATURE_BT_RFCOMM_DIRECT"
+
+%ifarch aarch64
+echo arch64
+export CFLAGS+=" -DARCH64"
+export CXXFLAGS+=" -DARCH64"
+export FFLAGS+=" -DARCH64"
%endif
+cmake . -DCMAKE_INSTALL_PREFIX=/usr \
+-DCMAKE_LIB_DIR=%{_libdir} \
+-DTZ_SYS_USER_GROUP=%TZ_SYS_USER_GROUP \
+-DTZ_SYS_DEFAULT_USER=%TZ_SYS_DEFAULT_USER \
+ -DLIBNOTIFY_SUPPORT=Off \
+ -DLIBNOTIFICATION_SUPPORT=Off
+make %{?_smp_mflags}
+
+%cmake
+
%install
rm -rf %{buildroot}
%make_install
-install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk
-install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk-service
-install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk-httpproxy
-install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk-devel
+mkdir -p %{buildroot}%{_unitdir}/starter.target.wants
+mkdir -p %{buildroot}%{_unitdir}/delayed.target.wants
+mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
+mkdir -p %{buildroot}/%{_prefix}/lib/udev/rules.d
+mkdir -p %{buildroot}%{_meshdir}
-#mkdir -p %{buildroot}%{_libdir}/systemd/user
-#install -m 0644 packaging/bluetooth-frwk-tv.service %{buildroot}%{_libdir}/systemd/user
-mkdir -p %{buildroot}/usr/lib/systemd/user/%{_servicedir}
-install -m 0644 %{_servicefile} %{buildroot}/usr/lib/systemd/user/bluetooth-frwk.service
-ln -s ../bluetooth-frwk.service %{buildroot}/usr/lib/systemd/user/%{_servicedir}/bluetooth-frwk.service
+cp packaging/99-bluetooth-rfkill.rules %{buildroot}/%{_prefix}/lib/udev/rules.d/99-bluetooth-rfkill.rules
-%if %{with bluetooth_frwk_libnotify} || %{with bluetooth_frwk_libnotification}
-mkdir -p %{buildroot}%{_datadir}/icons/default
-install -m 0644 %{SOURCE1002} %{buildroot}%{_datadir}/icons/default/bt-icon.png
+# extension-emulator
+%ifarch %{ix86} x86_64
+cp build_emulator/libbluetooth-api.so*.emulator %{buildroot}%{_libdir}/
+#mv %{buildroot}/%{_bindir}/bt-service-emul %{buildroot}/%{_bindir}/bt-service
%endif
-# On IVI bt-service needs to be run as 'app' even if there is a 'guest' user.
-%if "%{profile}"=="ivi"
-sed -i 's/%TZ_SYS_DEFAULT_USER/app/' %{buildroot}%{_datadir}/dbus-1/system-services/org.projectx.bt.service
+# Rename the postfix (.mobile, .tv, ..) at post script
+# mobile
+install -m 0644 packaging/bluetooth-frwk-mobile.service %{buildroot}%{_unitdir}/bluetooth-frwk.service.mobile
+
+# extension-TM1
+%ifarch %{ix86} || %{arm}
+cp tm1/bt-core.tm1 %{buildroot}%{_bindir}/
+install -m 0644 packaging/bluetooth-frwk-mobile-sprd.service %{buildroot}%{_unitdir}/bluetooth-frwk.service.tm1
%endif
+# wearable / ivi
+install -m 0644 packaging/bluetooth-frwk-wearable.service %{buildroot}%{_unitdir}/bluetooth-frwk.service.wearable
+# On IVI bt-service needs to be run as 'app' even if there is a 'guest' user.
+cp %{buildroot}%{_datadir}/dbus-1/system-services/org.projectx.bt.service %{buildroot}%{_datadir}/dbus-1/system-services/org.projectx.bt.service.ivi
+sed -i 's/%TZ_SYS_DEFAULT_USER/app/' %{buildroot}%{_datadir}/dbus-1/system-services/org.projectx.bt.service.ivi
+
+# tv
+install -m 0644 packaging/bluetooth-frwk-tv.service %{buildroot}%{_unitdir}/bluetooth-frwk.service.tv
+
+# common
+install -m 0644 packaging/bluetooth-frwk-common.service %{buildroot}%{_unitdir}/bluetooth-frwk.service.common
+
+# bt-core
+install -m 0644 bt-core/bluetooth-frwk-core.service %{buildroot}%{_unitdir}/bluetooth-frwk-core.service
-#%post
-#/sbin/ldconfig
-#%if "%{?profile}" == "wearable"
-#vconftool set -f -t int db/bluetooth/status "1" -g 6520
-#%endif
-#%if "%{?profile}" == "mobile"
-#vconftool set -f -t int db/bluetooth/status "0" -g 6520
-#%endif
-#%if "%{?profile}" == "common"
-#vconftool set -f -t int db/bluetooth/status "0" -g 6520
-#%endif
-
-#vconftool set -f -t int db/bluetooth/status "0" -s User
-#vconftool set -f -t int db/bluetooth/lestatus "0" -s User
-#vconftool set -f -t int file/private/bt-core/flight_mode_deactivated "0" -s User
-#vconftool set -f -t int file/private/bt-core/powersaving_mode_deactivated "0" -s User
-#vconftool set -f -t int file/private/bt-service/bt_off_due_to_timeout "0" -s User
-#vconftool set -f -t string memory/bluetooth/sco_headset_name "" -g 6520 -i
-#vconftool set -f -t int memory/bluetooth/device "0" -g 6520 -i
-#vconftool set -f -t bool memory/bluetooth/btsco "0" -g 6520 -i
-#vconftool set -f -t bool memory/bluetooth/dutmode "0" -g 6520 -i
-
-
-#%post service
-#mkdir -p %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
-#ln -sf %{_libdir}/systemd/user/bluetooth-frwk.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
+ln -s ../bluetooth-frwk.service %{buildroot}%{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
+ln -s ../bluetooth-frwk.service %{buildroot}%{_unitdir}/starter.target.wants/bluetooth-frwk.service
%postun -p /sbin/ldconfig
+%post service
+/usr/bin/chsmack -a '_' %{_varlibdir}/bluetooth/auto-pair-blacklist
+/usr/bin/chown network_fw:network_fw %{_varlibdir}/bluetooth/auto-pair-blacklist
+/usr/bin/chown network_fw:network_fw %{_meshdir}
+
%files
%manifest %{name}.manifest
+%license LICENSE
%defattr(-, root, root)
%{_libdir}/libbluetooth-api.so.*
-%{_datadir}/license/bluetooth-frwk
-/usr/lib/systemd/user/%{_servicedir}/bluetooth-frwk.service
-/usr/lib/systemd/user/bluetooth-frwk.service
+%exclude %{_libdir}/libbluetooth-api.so*.emulator
%files devel
%defattr(-, root, root)
%{_includedir}/bt-service/bluetooth-media-control.h
%{_includedir}/bt-service/bluetooth-scmst-api.h
%{_includedir}/bt-service/bluetooth-ipsp-api.h
+%{_includedir}/bt-service/bluetooth-gatt-server-api.h
+%{_includedir}/bt-service/bluetooth-gatt-client-api.h
+%{_includedir}/bt-service/bluetooth-mesh-api.h
%{_libdir}/pkgconfig/bluetooth-api.pc
%{_libdir}/libbluetooth-api.so
-%{_datadir}/license/bluetooth-frwk-devel
+
+# extension-emulator
+%ifarch %{ix86} x86_64
+%post extension-emulator
+pushd %{_libdir}
+for FILE in libbluetooth-api.so*.emulator; do mv "${FILE}" "${FILE%.emulator}"; done
+popd
+%preun extension-emulator
+pushd %{_libdir}
+for FILE in libbluetooth-api.so*; do mv "${FILE}" "${FILE}.emulator"; done
+popd
+%files extension-emulator
+%manifest %{name}.manifest
+%defattr(-, root, root)
+%{_libdir}/libbluetooth-api.so.*.emulator
+%{_libdir}/libbluetooth-api.so.emulator
+%endif
%files service
%manifest %{name}.manifest
+%license LICENSE
%defattr(-, root, root)
-%{_datadir}/dbus-1/services/org.projectx.bt.service
%{_bindir}/bt-service
-#%{_libdir}/systemd/user/bluetooth-frwk-tv.service
-/usr/lib/systemd/user/%{_servicedir}/bluetooth-frwk.service
-%{_sysconfdir}/dbus-1/session.d/bluetooth-frwk-service.conf
+%{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-service.conf
%{_bindir}/bluetooth-frwk-test
-#%{_bindir}/bluetooth-gatt-test
-#%{_bindir}/bluetooth-advertising-test
%{_varlibdir}/bluetooth
%{_prefix}/etc/bluetooth
-#%attr(0666,-,-) %{_varlibdir}/bluetooth/auto-pair-blacklist
-#%attr(0666,-,-) %{_prefix}/etc/bluetooth/stack_info
-#%{_dumpdir}/bluetooth_log_dump.sh
-%{_datadir}/license/bluetooth-frwk-service
-%if %{with bluetooth_frwk_libnotify} || %{with bluetooth_frwk_libnotification}
-%{_datadir}/icons/default/bt-icon.png
-%endif
+%{_meshdir}
+%attr(-,network_fw,network_fw) %{_varlibdir}/bluetooth/auto-pair-blacklist
+%if %{bt_http_proxy} == ENABLED
%files httpproxy
%manifest %{name}.manifest
+%license LICENSE
%defattr(-, root, root)
%{_bindir}/bt-httpproxy
-%{_datadir}/license/bluetooth-frwk-httpproxy
%{_datadir}/dbus-1/system-services/org.projectx.httpproxy.service
%{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-httpproxy.conf
+%endif
+
+%files otp
+%manifest %{name}.manifest
+%license LICENSE
+%defattr(-, root, root)
+%{_bindir}/bt-otp
+%{_datadir}/dbus-1/system-services/org.projectx.otp.service
+%{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-otp.conf
%files core
%manifest %{name}.manifest
+%license LICENSE
%defattr(-, root, root)
+%{_unitdir}/bluetooth-frwk-core.service
%{_datadir}/dbus-1/system-services/org.projectx.bt_core.service
%{_bindir}/bt-core
%{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-core.conf
+%{_prefix}/lib/udev/rules.d/99-bluetooth-rfkill.rules
%files test
%manifest %{name}.manifest
+%license LICENSE
%defattr(-, root, root)
%{_bindir}/bluetooth-frwk-test
-%{_bindir}/bluetooth-gatt-test
-%{_bindir}/bluetooth-advertising-test
+#%{_bindir}/bluetooth-gatt-test
+#%{_bindir}/bluetooth-advertising-test
+
+%files plugin-headed
+%manifest %{name}.manifest
+%license LICENSE
+%defattr(-, root, root)
+%{_libdir}/bt-plugin-headed.so
+
+%post profile_common
+pushd %{_unitdir}
+mv bluetooth-frwk.service.common bluetooth-frwk.service
+popd
+%preun profile_common
+pushd %{_unitdir}
+mv bluetooth-frwk.service bluetooth-frwk.service.common
+popd
+%files profile_common
+%license LICENSE
+%{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
+%exclude %{_unitdir}/starter.target.wants/bluetooth-frwk.service
+%{_unitdir}/bluetooth-frwk.service.common
+%{_datadir}/dbus-1/system-services/org.projectx.bt.service
+
+%post profile_mobile
+pushd %{_unitdir}
+mv bluetooth-frwk.service.mobile bluetooth-frwk.service
+popd
+%preun profile_mobile
+pushd %{_unitdir}
+mv bluetooth-frwk.service bluetooth-frwk.service.mobile
+popd
+%files profile_mobile
+%license LICENSE
+%{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
+%{_unitdir}/bluetooth-frwk.service.mobile
+%{_datadir}/dbus-1/system-services/org.projectx.bt.service
+
+# extension-TM1
+%ifarch %{ix86} || %{arm}
+%post extension-TM1
+pushd %{_unitdir}
+mv bluetooth-frwk.service.tm1 bluetooth-frwk.service
+popd
+pushd %{_bindir}
+mv bt-core.tm1 bt-core
+popd
+%preun extension-TM1
+pushd %{_unitdir}
+mv bluetooth-frwk.service bluetooth-frwk.service.tm1
+popd
+pushd %{_bindir}
+mv bt-core bt-core.tm1
+popd
+%files extension-TM1
+%{_unitdir}/bluetooth-frwk.service.tm1
+%license LICENSE
+%defattr(-, root, root)
+%{_bindir}/bt-core.tm1
+%endif
+
+%post profile_wearable
+pushd %{_unitdir}
+mv bluetooth-frwk.service.wearable bluetooth-frwk.service
+popd
+%preun profile_wearable
+pushd %{_unitdir}
+mv bluetooth-frwk.service bluetooth-frwk.service.wearable
+popd
+%files profile_wearable
+%license LICENSE
+%{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
+%{_unitdir}/bluetooth-frwk.service.wearable
+%{_datadir}/dbus-1/system-services/org.projectx.bt.service
+
+%post profile_tv
+pushd %{_unitdir}
+mv bluetooth-frwk.service.tv bluetooth-frwk.service
+popd
+%preun profile_tv
+pushd %{_unitdir}
+mv bluetooth-frwk.service bluetooth-frwk.service.tv
+popd
+%files profile_tv
+%license LICENSE
+%{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
+%{_unitdir}/bluetooth-frwk.service.tv
+%{_datadir}/dbus-1/system-services/org.projectx.bt.service
+
+# Note: ivi reuses bluetooth-frwk.service.wearable
+%post profile_ivi
+pushd %{_unitdir}
+mv bluetooth-frwk.service.wearable bluetooth-frwk.service
+popd
+pushd %{_datadir}/dbus-1/system-services
+mv org.projectx.bt.service.ivi org.projectx.bt.service
+popd
+%preun profile_ivi
+pushd %{_unitdir}
+mv bluetooth-frwk.service bluetooth-frwk.service.wearable
+popd
+pushd %{_datadir}/dbus-1/system-services
+mv org.projectx.bt.service org.projectx.bt.service.ivi
+popd
+%files profile_ivi
+%license LICENSE
+%{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
+%{_unitdir}/bluetooth-frwk.service.wearable
+%{_datadir}/dbus-1/system-services/org.projectx.bt.service.ivi
+
+%files oal
+%manifest %{name}.manifest
+%defattr(-, root, root)
+%{_libdir}/libbt-oal.so*
+%{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-gap-agent.conf
+
+%if %{bt_bluez_hal} == ENABLED
+%{_libdir}/libbluetooth.default.so*
+%endif
+
+%files -n bluetooth-haltests
+%manifest %{name}.manifest
+%{_bindir}/bluetooth-haltests