makedepends=(dbus libical libvorbis alsa-lib libusb-compat libsndfile cups glib python-docutils python-pygments)

description="The BlueZ package contains the Bluetooth protocol stack for Linux."
url="http://www.bluez.org/"

packager="Great-OS Team"
maintainer="Great-OS Team"

name=bluez
version=5.86
release=1

source=(http://www.kernel.org/pub/linux/bluetooth/$name-$version.tar.xz)
build() {

  cd $name-$version

  #sed 's/pause(/bluez_&/' -i profiles/audio/media.c

  ./configure --prefix=/usr \
              --sysconfdir=/etc \
              --localstatedir=/var \
              --enable-tools \
              --enable-cups \
              --disable-test \
              --enable-library \
              --with-systemdsystemunitdir=/usr/lib/systemd/system \
              --with-systemduserunitdir=/usr/lib/systemd/user

  make
  make DESTDIR=$PKG install

  install -v -dm755 $PKG/{etc/bluetooth,usr/sbin}

  ln -svf ../libexec/bluetooth/bluetoothd $PKG/usr/sbin
  ln -sv bluetooth.service  $PKG/usr/lib/systemd/system/dbus-org.bluez.service

  cat > $PKG/etc/bluetooth/rfcomm.conf << "EOF"
# rfcomm.conf
# Set up the RFCOMM configuration of the Bluetooth subsystem in the Linux kernel.
# Use one line per command
# See the rfcomm man page for options


# End of rfcomm.conf
EOF

  cat > $PKG/etc/bluetooth/uart.conf << "EOF"
#uart.conf
# Attach serial devices via UART HCI to BlueZ stack
# Use one line per device
# See the hciattach man page for options

# End of uart.conf
EOF


  install -m644 profiles/network/network.conf \
	  profiles/input/input.conf \
  	$PKG/etc/bluetooth

  install -v -dm755 $PKG/usr/share/doc/$name-$version
  install -v -m644 doc/*.txt $PKG/usr/share/doc/$name-$version
}
