# Compiling Time: 0.42 SBU
# Maintainer: DeX77 <dex77@frugalware.org>

pkgname=bluez
pkgver=5.41
pkgrel=1
pkgdesc="Library to use the BlueZ Linux Bluetooth stack"
url="http://bluez.sourceforge.net/"
depends=('libsystemd>=227-14' 'dbus>=1.10.6-5' 'glib2>=2.46.2-3' 'libical>=1.0.1-3')
makedepends=('check>=0.10.0-3')
groups=('apps')
archs=('i686' 'x86_64')
up2date="Flasttar http://www.bluez.org/download/"
source=(http://www.kernel.org/pub/linux/bluetooth/$pkgname-$pkgver.tar.xz \
        0001-Allow-using-obexd-without-systemd-in-the-user-session.patch)
signatures=(${source[0]/.xz/.sign} '')
conflicts=('bluez-utils' 'bluez-libs' 'bluez-hcidump')
provides=('bluez-utils' 'bluez-libs' 'bluez-hcidump')
replaces=('bluez-utils' 'bluez-libs' 'bluez-hcidump')
backup=(etc/bluetooth/main.conf etc/dbus-1/system.d/bluetooth.conf)
## etc/dbus-1/system.d/bluetooth.conf <-- kill this from backup
_F_systemd_units=(bluetooth=e)
Finclude systemd

Fconfopts+=" --with-pic \
	--enable-pie \
	--enable-library \
	--enable-tools \
	--enable-cups \
	--enable-test \
	--enable-datafiles \
	--enable-experimental \
	--enable-sixaxis \
	--enable-deprecated \
	--with-systemdunitdir=/lib/systemd/system \
	--localstatedir=/var"

build() {
	Fsed 'group="lp"' 'group="netdev"' src/bluetooth.conf
	Fbuild

	for i in simple-agent test-device; do
		Fexerel test/$i /usr/bin/bluez-$i
	done

	Finstall 755 $_F_cd_path/src/main.conf etc/bluetooth/main.conf
	Fsed 'libexec/bluetooth/bluetoothd' 'libexec/bluetooth/bluetoothd -P sap' \
		$Fdestdir/lib/systemd/system/bluetooth.service

	Fgenscriptlet
}

# optimization OK
