Rollback changes to submit TIZEN:COMMON project
[platform/core/connectivity/bluetooth-frwk.git] / packaging / bluetooth-frwk.spec
index de60cf1..d2e0410 100644 (file)
@@ -1,18 +1,18 @@
 %bcond_with bluetooth_frwk_libnotify
 %bcond_with bluetooth_frwk_libnotification
-%bcond_with multi_user
+%bcond_with x
 
 Name:       bluetooth-frwk
-Summary:    Bluetooth framework for BlueZ and Obexd.
+Summary:    Bluetooth framework for BlueZ and Obexd
 Version:    0.2.55
-Release:    2
-Group:      connectivity/bluetooth-frwk
-License:    Apache License, Version 2.0
+Release:    0
+Group:      Network & Connectivity/Bluetooth
+License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
-Source1001:    bluetooth-frwk.manifest
-Source1002:    bt-icon.png
+Source1001: bluetooth-frwk.manifest
+Source1002: bt-icon.png
+URL:        https://review.tizen.org/git/?p=platform/core/connectivity/bluetooth-frwk.git;a=summary
 Requires: dbus
-Requires: syspopup
 Requires: bluetooth-tools
 BuildRequires:  pkgconfig(aul)
 BuildRequires:  pkgconfig(dbus-glib-1)
@@ -22,26 +22,30 @@ BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(libnotify)
 BuildRequires:  pkgconfig(gdk-pixbuf-2.0)
 BuildRequires:  pkgconfig(gtk+-3.0)
-%else
+%elif %{without bluetooth_frwk_libnotification}
 BuildRequires:  pkgconfig(syspopup-caller)
+Requires:       syspopup
 %endif
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(libxml-2.0)
 BuildRequires:  pkgconfig(dbus-1)
+%if %{with x}
 BuildRequires:  pkgconfig(utilX)
+%endif
 BuildRequires:  pkgconfig(capi-network-tethering)
 BuildRequires:  pkgconfig(libprivilege-control)
 BuildRequires:  pkgconfig(status)
 BuildRequires:  pkgconfig(alarm-service)
 BuildRequires:  pkgconfig(notification)
-BuildRequires:  pkgconfig(security-server)
 BuildRequires:  cmake
+BuildRequires:  pkgconfig(libtzplatform-config)
 
-Requires(post): vconf
-Requires(postun): eglibc
+Requires(post): /usr/bin/vconftool
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
 
 %description
-Bluetooth framework for BlueZ and Obexd.
+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.
 
 
@@ -56,7 +60,7 @@ This package contains API set for BT GAP, BT SDP, and BT RFCOMM.
 
 %package service
 Summary:    Bluetooth Service daemon
-Group:      connectivity/bluetooth-frwk
+Group:      Network & Connectivity/Bluetooth
 Requires:   %{name} = %{version}-%{release}
 
 %description service
@@ -64,8 +68,9 @@ This package is Bluetooth Service daemon to manage BT services.
 
 %package core
 Summary:    Bluetooth Core daemon
-Group:      connectivity/bluetooth-frwk
+Group:      Network & Connectivity/Bluetooth
 Requires:   %{name} = %{version}-%{release}
+Requires:   connman
 
 %description core
 This package is Bluetooth core daemon to manage activation / deactivation.
@@ -76,15 +81,18 @@ cp %{SOURCE1001} .
 
 
 %build
-export CFLAGS+=" -fpie"
-export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
 
-cmake . -DCMAKE_INSTALL_PREFIX=/usr  \
-%if %{with multi_user}
-       -DMULTI_USER_SUPPORT=On \
+%ifarch x86_64
+export CFLAGS="${CFLAGS}   -Wall -g -fvisibility=hidden -fPIC"
+export LDFLAGS="${LDFLAGS} -Wl,--rpath=%{_libdir} -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs"
 %else
-       -DMULTI_USER_SUPPORT=Off \
+export CFLAGS="${CFLAGS} -fpie"
+export LDFLAGS="${LDFLAGS} -Wl,--rpath=%{_libdir} -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
 %endif
+
+%cmake . \
+-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
@@ -96,36 +104,38 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr  \
  -DLIBNOTIFICATION_SUPPORT=Off
 %endif
 
-make
+%__make
 
 %install
 rm -rf %{buildroot}
 %make_install
-%if !%{with multi_user}
-       mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc3.d/
-       mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc5.d/
-       ln -s %{_sysconfdir}/rc.d/init.d/bluetooth-frwk-service %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S80bluetooth-frwk-service
-       ln -s %{_sysconfdir}/rc.d/init.d/bluetooth-frwk-service %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S80bluetooth-frwk-service
-%else
-       mv %{buildroot}%{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-service_user.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-service.conf
-%endif
 
 mkdir -p %{buildroot}%{_unitdir_user}
-mkdir -p %{buildroot}%{_unitdir_user}/tizen-middleware.target.wants
 install -m 0644 bt-service/bluetooth-frwk-service.service %{buildroot}%{_unitdir_user}
-ln -s ../bluetooth-frwk-service.service %{buildroot}%{_unitdir_user}/tizen-middleware.target.wants/bluetooth-frwk-service.service
 
-%if %{with bluetooth_frwk_libnotify}
+%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
 %endif
 
-%post -p /sbin/ldconfig
-vconftool set -tf int db/bluetooth/status "0" -g 6520
-vconftool set -tf int file/private/bt-service/flight_mode_deactivated "0" -g 6520 -i
-vconftool set -tf string memory/bluetooth/sco_headset_name "" -g 6520 -i
-vconftool set -tf int memory/bluetooth/device "0" -g 6520 -i
-vconftool set -tf int memory/bluetooth/btsco "0" -g 6520 -i
+# 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
+%endif
+
+%post
+/sbin/ldconfig
+vconftool set -f -t int db/bluetooth/status "0" -g 6520
+vconftool set -f -t int file/private/bt-service/flight_mode_deactivated "0" -g 6520 -i
+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 int memory/bluetooth/btsco "0" -g 6520 -i
+# set 'User' smack label to vconf keys in order to allow bt-service to access them.
+chsmack -a 'User' %TZ_SYS_CONFIG/db/bluetooth/status
+chsmack -a 'User' %TZ_SYS_CONFIG/file/private/bt-service/flight_mode_deactivated
+chsmack -a 'User' %TZ_SYS_CONFIG/memory_init/memory/bluetooth/sco_headset_name
+chsmack -a 'User' %TZ_SYS_CONFIG/memory_init/memory/bluetooth/device
+chsmack -a 'User' %TZ_SYS_CONFIG/memory_init/memory/bluetooth/btsco
 
 %postun -p /sbin/ldconfig
 
@@ -148,18 +158,13 @@ vconftool set -tf int memory/bluetooth/btsco "0" -g 6520 -i
 %files service
 %manifest %{name}.manifest
 %defattr(-, root, root)
-%if !%{with multi_user}
-       %{_datadir}/dbus-1/system-services/org.projectx.bt.service
-       %{_sysconfdir}/rc.d/init.d/bluetooth-frwk-service
-       %{_sysconfdir}/rc.d/rc3.d/S80bluetooth-frwk-service
-       %{_sysconfdir}/rc.d/rc5.d/S80bluetooth-frwk-service
-%endif
+%{_datadir}/dbus-1/system-services/org.projectx.bt.service
+
 %{_bindir}/bt-service
-%{_unitdir_user}/tizen-middleware.target.wants/bluetooth-frwk-service.service
 %{_unitdir_user}/bluetooth-frwk-service.service
 %attr(0666,-,-) /opt/var/lib/bluetooth/auto-pair-blacklist
 %{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-service.conf
-%if %{with bluetooth_frwk_libnotify}
+%if %{with bluetooth_frwk_libnotify} || %{with bluetooth_frwk_libnotification}
 %{_datadir}/icons/default/bt-icon.png
 %endif