%bcond_with systemd

Summary: 	Full featured bluetooth manager for GNOME/GTK
Summary(ja): 	GNOME/GTK 用の高機能な Bluetooth マネージャ
Name: 		blueman
Version: 	2.1.4
Release: 	1%{?_dist_release}%{?with_systemd:.systemd}
Group: 		system
Vendor:		Project Vine
Distribution:	Vine Linux
Packager:	daisuke

License: 	GPLv2+
URL: 		https://github.com/blueman-project/blueman
Source0: 	https://github.com/blueman-project/blueman/releases/download/%{version}/%{name}-%{version}.tar.xz

Buildroot: 	%{_tmppath}/%{name}-%{version}
BuildRequires:	bluez-libs-devel >= 4.37
BuildRequires:  desktop-file-utils
BuildRequires:  gdk-pixbuf2-devel
BuildRequires:  glib2-devel
BuildRequires:  gtk3-devel
BuildRequires:  intltool
BuildRequires:  libappindicator-devel
BuildRequires:	NetworkManager-libnm-devel
BuildRequires:  polkit-devel
BuildRequires:	pygobject3-devel
BuildRequires:	python3-Cython
BuildRequires:	python3-dbus
BuildRequires:	python3-devel
BuildRequires:	python3-pycairo-devel
Requires:	bluez
Requires:	obex-data-server
Requires:	python3-dbus
Requires:	python3-pygobject
Requires:	polkit

Provides:       dbus-bluez-pin-helper
Obsoletes: 	bluez-gnome < 1.9

%description
Blueman is designed to provide simple, yet effective means for 
controlling BlueZ API and simplifying bluetooth tasks such as:

* Connecting to 3G/EDGE/GPRS via dial-up
* Connecting to/Creating bluetooth networks
* Connecting to input devices
* Connecting to audio devices
* Sending/Receiving/Browsing files via OBEX
* Pairing

Blueman also integrates with Network Manager 0.7, so any Dialup/Network
 connections will be made available (via HAL) to Network Manager.


%debug_package


%prep
%setup -q
sed -e 's|/usr/sbin/bluetoothd|%{_libexecdir}/bluetooth/bluetoothd|g' -i apps/blueman-report.in


%build
export PYTHON=%{_bindir}/python3

# Override the "_configure" macro - the name of the script
# in this repo is ./autogen.sh, not ./configure
%global _configure ./autogen.sh
%configure \
	--disable-static \
	--enable-thunar-sendto=no \
	--disable-schemas-compile
%make_build


%install
rm -rf %{buildroot}
%{make_install}

find %{buildroot} -name '*.la' -exec rm -f {} ';'
rm -rf %{buildroot}%{_datadir}/doc/blueman/

%find_lang blueman

# we need to own this, not only because of SELinux
mkdir -p %{buildroot}/var/lib/blueman
touch %{buildroot}/var/lib/blueman/network.state

%if !%{with systemd}
rm -rf %{buildroot}/usr/lib/systemd
%endif


%clean
rm -rf %{buildroot}


%if %{with systemd}
%post
%systemd_post blueman-mechanism.service
%systemd_user_post blueman-applet.service

%postun
%systemd_postun_with_restart blueman-mechanism.service

%preun
%systemd_preun blueman-mechanism.service
%systemd_user_preun blueman-applet.service
%endif


%files -f %{name}.lang
%license COPYING
%doc CHANGELOG.md FAQ README.md
%defattr(-,root,root)
%{_bindir}/*
%{_libexecdir}/%{name}-*
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/org.%{name}*.conf
%{_sysconfdir}/xdg/autostart/%{name}.desktop
%{_datadir}/applications/%{name}-*.desktop
%{_datadir}/icons/hicolor/*/*/*
%{_datadir}/pixmaps/%{name}
%{_datadir}/%{name}
%{_datadir}/dbus-1/services/*.service
%{_datadir}/dbus-1/system-services/*.service
%{_datadir}/glib-2.0/schemas/*
%{_datadir}/polkit-1/actions/org.%{name}.policy
%{_datadir}/polkit-1/rules.d/%{name}.rules
%{_mandir}/man1/%{name}*1.*
%{python3_sitelib}/*
%if "%_lib" == "lib64"
%{python3_sitearch}/*
%endif
%dir /var/lib/blueman
%ghost %attr(0644,root,root) /var/lib/blueman/network.state
%if %{with systemd}
%{_unitdir}/blueman-mechanism.service
%{_userunitdir}/blueman-applet.service
%endif


%changelog
* Tue Mar 09 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.1.4-1
- new upstream release.
- dropped scriptlets.
- added systemd support (disabled as default).

* Wed Jun 15 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.0.4-1
- new upstream release

* Tue Jan 26 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.0.3-1
- new upstream release
  (including security fix for CVE-2015-8612)

* Sun Nov 01 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.0.1-2
- rebuild with bluez-5.36

* Sat Oct 10 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.0.1-1
- new upstream release

* Sun Sep 06 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.0-2
- remove Requires: polkit-gnome, gnome-python
- add Requires: polkit

* Sun Jul 05 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.0-1
- update to 2.0
- add BuildRequires: polkit-devel, pygobject3-devel, Cython
- remove BuildRequires: pygobject-devel

* Sat Jan 04 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.23-4
- rebuild with VineSeed environment

* Sat Oct 06 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.23-3
- change Requires: polkit-gnome instead of PolicyKit-gnome

* Sun Feb 19 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.23-2
- rebuild with python-2.7.2

* Tue Jan 03 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.23-1
- new upstream release

* Mon Apr 18 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.21-4
- rebuild with rpm-4.8.1

* Sun Feb 07 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.21-3
- add BuildRequires: gtk2-devel

* Wed Feb 03 2010 Shu KONNO <owa@bg.wakwak.com> 1.21-2
- rebuilt with python-2.6.4

* Mon Jan 04 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 1.21-1
- new upstream release

* Mon Jan 04 2010 Shu KONNO <owa@bg.wakwak.com> 1.10-2
- added _blueman to %%files (if lib64)

* Tue May 26 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.10-1
- initial build for Vine Linux

* Fri Mar 27 2009 Emmanuel Andry <eandry@mandriva.org> 1.02-4mdv2009.1
+ Revision: 361574
- don't explicitely requires notification-daemon

* Mon Mar 02 2009 Emmanuel Andry <eandry@mandriva.org> 1.02-3mdv2009.1
+ Revision: 347587
- requires python-blueman

* Mon Mar 02 2009 Emmanuel Andry <eandry@mandriva.org> 1.02-2mdv2009.1
+ Revision: 347346
- fix files
- BR python-dbus
- fix BR
- BR python-devel
- import blueman


