From 5b05d269d795e1734f3f1b0ca08edc91ff372576 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Fri, 7 Mar 2014 17:33:55 +0000
Subject: bluez: update to 5.15 and update binary path. ref #961

---
 ...obexd-without-systemd-in-the-user-session.patch |  59 ++++++
 abs/extra/bluez/PKGBUILD                           | 200 +++++++++++++--------
 abs/extra/bluez/__changelog                        |   3 +
 abs/extra/bluez/audio-streaming.patch              |  13 --
 abs/extra/bluez/bluetooth.conf.d                   |  30 ----
 abs/extra/bluez/bluetooth.modprobe                 |   3 +
 abs/extra/bluez/bluez.install                      |   2 +-
 abs/extra/bluez/org.bluez.service                  |   5 -
 8 files changed, 194 insertions(+), 121 deletions(-)
 create mode 100644 abs/extra/bluez/0001-Allow-using-obexd-without-systemd-in-the-user-session.patch
 delete mode 100644 abs/extra/bluez/audio-streaming.patch
 delete mode 100644 abs/extra/bluez/bluetooth.conf.d
 create mode 100644 abs/extra/bluez/bluetooth.modprobe
 delete mode 100644 abs/extra/bluez/org.bluez.service

diff --git a/abs/extra/bluez/0001-Allow-using-obexd-without-systemd-in-the-user-session.patch b/abs/extra/bluez/0001-Allow-using-obexd-without-systemd-in-the-user-session.patch
new file mode 100644
index 0000000..fe3c513
--- /dev/null
+++ b/abs/extra/bluez/0001-Allow-using-obexd-without-systemd-in-the-user-session.patch
@@ -0,0 +1,59 @@
+From 3027cb7141fb65cf3eeda69c688db8c4045e2d3f Mon Sep 17 00:00:00 2001
+From: Giovanni Campagna <gcampagna-cNUdlRotFMnNLxjTenLetw@public.gmane.org>
+Date: Sat, 12 Oct 2013 17:45:25 +0200
+Subject: [PATCH] Allow using obexd without systemd in the user session
+
+Not all sessions run systemd --user (actually, the majority
+doesn't), so the dbus daemon must be able to spawn obexd
+directly, and to do so it needs the full path of the daemon.
+---
+ Makefile.obexd                      | 4 ++--
+ obexd/src/org.bluez.obex.service    | 4 ----
+ obexd/src/org.bluez.obex.service.in | 4 ++++
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+ delete mode 100644 obexd/src/org.bluez.obex.service
+ create mode 100644 obexd/src/org.bluez.obex.service.in
+
+diff --git a/Makefile.obexd b/Makefile.obexd
+index 3760867..142e7c3 100644
+--- a/Makefile.obexd
++++ b/Makefile.obexd
+@@ -2,12 +2,12 @@
+ if SYSTEMD
+ systemduserunitdir = @SYSTEMD_USERUNITDIR@
+ systemduserunit_DATA = obexd/src/obex.service
++endif
+ 
+ dbussessionbusdir = @DBUS_SESSIONBUSDIR@
+ dbussessionbus_DATA = obexd/src/org.bluez.obex.service
+-endif
+ 
+-EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service
++EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service.in
+ 
+ obex_plugindir = $(libdir)/obex/plugins
+ 
+diff --git a/obexd/src/org.bluez.obex.service b/obexd/src/org.bluez.obex.service
+deleted file mode 100644
+index a538088..0000000
+--- a/obexd/src/org.bluez.obex.service
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[D-BUS Service]
+-Name=org.bluez.obex
+-Exec=/bin/false
+-SystemdService=dbus-org.bluez.obex.service
+diff --git a/obexd/src/org.bluez.obex.service.in b/obexd/src/org.bluez.obex.service.in
+new file mode 100644
+index 0000000..9c815f2
+--- /dev/null
++++ b/obexd/src/org.bluez.obex.service.in
+@@ -0,0 +1,4 @@
++[D-BUS Service]
++Name=org.bluez.obex
++Exec=@libexecdir@/obexd
++SystemdService=dbus-org.bluez.obex.service
+-- 
+1.8.3.1
+
+
diff --git a/abs/extra/bluez/PKGBUILD b/abs/extra/bluez/PKGBUILD
index 758e858..9465acb 100644
--- a/abs/extra/bluez/PKGBUILD
+++ b/abs/extra/bluez/PKGBUILD
@@ -3,86 +3,142 @@
 # Contributor: Andrea Scarpino <andrea@archlinux.org>
 # Contributor: Geoffroy Carrier <geoffroy@archlinux.org>
 
-pkgname=bluez
-pkgver=4.101
+pkgbase=bluez
+pkgname=('bluez' 'bluez-utils' 'bluez-libs' 'bluez-cups' 'bluez-hid2hci' 'bluez-plugins')
+pkgver=5.15
 pkgrel=1
-pkgdesc="Libraries and tools for the Bluetooth protocol stack"
 url="http://www.bluez.org/"
 arch=('i686' 'x86_64')
 license=('GPL2')
-depends=('dbus-core' 'python2' 'udev')
-makedepends=('gstreamer0.10-base' 'libusb-compat' 'libsndfile' 'libusb')
-optdepends=("gstreamer0.10-base: bluetooth GStreamer support"
-            "alsa-lib: Audio bluetooth devices support"
-            "dbus-python: to run bluez-simple-agent"
-            "pygobject: to run bluez-simple-agent"
-            "libusb-compat: USB adapters support"
-            "cups: CUPS backend")
-conflicts=('bluez-libs' 'bluez-utils')
-provides=('bluez-libs' 'bluez-utils')
-replaces=('bluez-libs' 'bluez-utils')
-options=('!libtool')
-backup=(etc/bluetooth/{main,rfcomm,audio,network,input,serial}.conf
-        'etc/conf.d/bluetooth' 'etc/dbus-1/system.d/bluetooth.conf')
-source=("http://www.kernel.org/pub/linux/bluetooth/${pkgname}-${pkgver}.tar.bz2"
-        'bluetooth.conf.d'
-	'org.bluez.service'
-        'audio-streaming.patch')
+makedepends=('dbus' 'libical' 'systemd')
+source=(http://www.kernel.org/pub/linux/bluetooth/${pkgname}-${pkgver}.tar.xz
+        0001-Allow-using-obexd-without-systemd-in-the-user-session.patch
+        bluetooth.modprobe)
+# see https://www.kernel.org/pub/linux/bluetooth/sha256sums.asc
+sha256sums=('487bd75697e565793bf5bc4fbd5fa6a602788313b0c694f7542b81689fc0aa87'
+            '896a1403d9b7258c4fb0d41f3a6f70fd51eaa1115ab3f4259f3dbbe02b55766b'
+            '46c021be659c9a1c4e55afd04df0c059af1f3d98a96338236412e449bf7477b4')
+
+prepare() {
+  cd $pkgname-$pkgver
+  # patch not upstreamable for obex file transfer - FS#37773 taken from FC
+  # http://www.hadess.net/2013/11/bluetooth-file-sharing-obexpush-in.html
+  patch -Np1 -i ${srcdir}/0001-Allow-using-obexd-without-systemd-in-the-user-session.patch
+  autoreconf -vfi
+}
 
 build() {
-  cd "${srcdir}/${pkgname}-${pkgver}"
-
-# Add setting that allows audio streaming out-of-the-box
-  patch -Np1 -i ${srcdir}/audio-streaming.patch || return 1
-
-  cp ../org.bluez.service src/
-
-  ./configure --prefix=/usr \
-    --sysconfdir=/etc \
-    --localstatedir=/var \
-    --libexecdir=/lib \
-    --enable-gstreamer \
-    --enable-alsa \
-    --enable-usb \
-    --enable-tools \
-    --enable-bccmd \
-    --enable-dfutool \
-    --enable-hid2hci \
-    --enable-hidd \
-    --enable-pand \
-    --enable-dund \
-    --enable-cups \
-    --enable-wiimote \
-    --disable-test \
-    --with-systemdunitdir=/usr/lib/systemd/system
-
-  make
+  cd ${pkgname}-${pkgver}
+  ./configure \
+          --prefix=/usr \
+          --mandir=/usr/share/man \
+          --sysconfdir=/etc \
+          --localstatedir=/var \
+          --libexecdir=/usr/lib \
+          --enable-sixaxis \
+          --enable-library # this is deprecated
+#          --enable-experimental \
+
+  make all V=1
+}
+
+check() {
+  cd $pkgname-$pkgver
+  make check
+}
+
+
+package_bluez() {
+  pkgdesc="Daemons for the bluetooth protocol stack"
+  depends=('libical' 'dbus' 'glib2')
+  backup=('etc/dbus-1/system.d/bluetooth.conf'
+          'etc/bluetooth/main.conf')
+  conflicts=('obexd-client' 'obexd-server')
+
+  cd ${pkgbase}-${pkgver}
+  #make DESTDIR=${pkgdir} install
+  #return 1
+  
+  make DESTDIR=${pkgdir} \
+       install-libexecPROGRAMS \
+       install-dbussessionbusDATA \
+       install-systemdsystemunitDATA \
+       install-systemduserunitDATA \
+       install-dbussystembusDATA \
+       install-dbusDATA \
+       install-man8
+
+  # ship upstream main config file
+  install -dm755 ${pkgdir}/etc/bluetooth
+  install -Dm644 ${srcdir}/${pkgbase}-${pkgver}/src/main.conf ${pkgdir}/etc/bluetooth/main.conf
+
+  # add basic documention
+  install -dm755 ${pkgdir}/usr/share/doc/${pkgbase}/dbus-apis
+  cp -a doc/*.txt ${pkgdir}/usr/share/doc/${pkgbase}/dbus-apis/
+  # fix module loading errors
+  install -dm755 ${pkgdir}/usr/lib/modprobe.d
+  install -Dm644 ${srcdir}/bluetooth.modprobe ${pkgdir}/usr/lib/modprobe.d/bluetooth-usb.conf	
+}
+
+package_bluez-utils() {
+  pkgdesc="Development and debugging utilities for the bluetooth protocol stack"
+  depends=('dbus' 'systemd')
+  conflicts=('bluez-hcidump')
+  provides=('bluez-hcidump')
+  replaces=('bluez-hcidump' 'bluez<=4.101')
+
+  cd ${pkgbase}-${pkgver}
+  make DESTDIR=${pkgdir} \
+       install-binPROGRAMS \
+       install-man1
+
+  # libbluetooth.so* are part of libLTLIBRARIES and binPROGRAMS targets
+  #make DESTDIR=${pkgdir} uninstall-libLTLIBRARIES
+  #rmdir ${pkgdir}/usr/lib
+  rm -rf ${pkgdir}/usr/lib
+  
+  # move the hid2hci man page out
+  mv ${pkgdir}/usr/share/man/man1/hid2hci.1 ${srcdir}/
+}
+
+package_bluez-libs() {
+  pkgdesc="Deprecated libraries for the bluetooth protocol stack"
+  depends=('glibc')
+  license=('LGPL2.1')
+
+  cd ${pkgbase}-${pkgver}
+  make DESTDIR=${pkgdir} \
+       install-includeHEADERS \
+       install-libLTLIBRARIES \
+       install-pkgconfigDATA
 }
 
-package() {
-  cd ${srcdir}/${pkgname}-${pkgver}
-  make DESTDIR=${pkgdir} install
+package_bluez-cups() {
+  pkgdesc="CUPS printer backend for Bluetooth printers"
+  depends=('cups')
 
-  install -d ${pkgdir}/etc/bluetooth
-  install -m644 network/network.conf \
-                input/input.conf \
-                audio/audio.conf \
-                serial/serial.conf \
-    ${pkgdir}/etc/bluetooth/
+  cd ${pkgbase}-${pkgver}
+  make DESTDIR=${pkgdir} install-cupsPROGRAMS
+}
+
+package_bluez-hid2hci() {
+  pkgdesc="Put HID proxying bluetooth HCI's into HCI mode"
+  depends=('systemd')
+
+  cd ${pkgbase}-${pkgver}
+  make DESTDIR=${pkgdir} \
+       install-udevPROGRAMS \
+       install-rulesDATA
   
-  install -Dm644 ${srcdir}/bluetooth.conf.d \
-    ${pkgdir}/etc/conf.d/bluetooth
-
-  # FS#27630
-  install -Dm755 test/simple-agent "${pkgdir}"/usr/bin/bluez-simple-agent
-  install -Dm755 test/test-device "${pkgdir}"/usr/bin/bluez-test-device
-  install -Dm755 test/test-input "${pkgdir}"/usr/bin/bluez-test-input
-  sed -i 's#/usr/bin/python#/usr/bin/python2#' \
-    "${pkgdir}"/usr/bin/bluez-simple-agent \
-    "${pkgdir}"/usr/bin/bluez-test-device \
-    "${pkgdir}"/usr/bin/bluez-test-input
+  install -dm755 ${pkgdir}/usr/share/man/man1
+  mv ${srcdir}/hid2hci.1 ${pkgdir}/usr/share/man/man1/hid2hci.1
+}
+
+package_bluez-plugins() {
+  pkgdesc="bluez plugins (PS3 Sixaxis controller)"
+  depends=('systemd')
+
+  cd ${pkgbase}-${pkgver}
+  make DESTDIR=${pkgdir} \
+       install-pluginLTLIBRARIES
 }
-md5sums=('902b390af95c6c5d6d1a17d94c8344ab'
-         '7412982b440f29fa7f76a41a87fef985'
-         '54c7de598327bf11d56592235d0702f4'
-         'cc9c86af1ced7ad46fc7be114d32adfb')
diff --git a/abs/extra/bluez/__changelog b/abs/extra/bluez/__changelog
index e6448b6..47f870d 100644
--- a/abs/extra/bluez/__changelog
+++ b/abs/extra/bluez/__changelog
@@ -22,3 +22,6 @@ re-add audio-streaming.patch for ootb audio streaming
 - change 'systemd-tools' dependency back to 'udev'
 - change 'libusbx' dependency back to 'libusb'
 - remove refrences to rc.bluetooth
+
+2014-03-07
+- update bluez 5.15 arch pkgbuild no changes
diff --git a/abs/extra/bluez/audio-streaming.patch b/abs/extra/bluez/audio-streaming.patch
deleted file mode 100644
index 83705c5..0000000
--- a/abs/extra/bluez/audio-streaming.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- bluez-4.98/audio/audio.conf.orig	2012-02-27 23:52:30.960349047 +0000
-+++ bluez-4.98/audio/audio.conf	2012-02-27 23:54:19.768069787 +0000
-@@ -4,6 +4,11 @@
- # particular interface
- [General]
- 
-+# Allow audio streaming with bluez-4.98 and alsa-lib 1.0.24.1
-+# https://wiki.archlinux.org/index.php/Bluetooth#Audio_streaming
-+
-+Enable=Socket
-+
- # Switch to master role for incoming connections (defaults to true)
- #Master=true
diff --git a/abs/extra/bluez/bluetooth.conf.d b/abs/extra/bluez/bluetooth.conf.d
deleted file mode 100644
index 1c1e025..0000000
--- a/abs/extra/bluez/bluetooth.conf.d
+++ /dev/null
@@ -1,30 +0,0 @@
-# Bluetooth configuraton file
-
-# Bluetooth services (allowed values are "true" and "false")
-
-# Run the bluetoothd daemon (default: true)
-#DAEMON_ENABLE="false"
-
-# Run the sdp daemon (default: false)
-# If this is disabled, hcid's internal sdp daemon will be used
-#SDPD_ENABLE="true"
-
-# Run the bluetooth HID daemon (default: false)
-#HIDD_ENABLE="true"
-
-# Activate rfcomm ports (default: false)
-#RFCOMM_ENABLE="true"
-
-# Run bluetooth dial-up networking daemon (default: false)
-#DUND_ENABLE="true"
-
-# Run bluetooth PAN daemon (default: false)
-#PAND_ENABLE="true"
-
-# rfcomm configuration file (default: /etc/bluetooth/rfcomm.conf)
-#RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"
-
-# Options for hidd, dund and pand (default: none)
-HIDD_OPTIONS="--server"
-#DUND_OPTIONS=""
-#PAND_OPTIONS=""
diff --git a/abs/extra/bluez/bluetooth.modprobe b/abs/extra/bluez/bluetooth.modprobe
new file mode 100644
index 0000000..3072d78
--- /dev/null
+++ b/abs/extra/bluez/bluetooth.modprobe
@@ -0,0 +1,3 @@
+# use "reset=1" as default, since it should be safe for recent devices and
+# solves all kind of problems.
+options btusb reset=1
diff --git a/abs/extra/bluez/bluez.install b/abs/extra/bluez/bluez.install
index 30bd262..9cfe793 100644
--- a/abs/extra/bluez/bluez.install
+++ b/abs/extra/bluez/bluez.install
@@ -9,7 +9,7 @@ post_install() {
 pre_remove() {
     for d in { bluetoothd,hidd,dund,pand,sdpd,rfcomm,hid2hci } ; do
       if [ -d /var/service/${d} ] ; then
-        remove_servcie.sh $d
+        remove_service.sh $d
       fi
     done
 }
diff --git a/abs/extra/bluez/org.bluez.service b/abs/extra/bluez/org.bluez.service
deleted file mode 100644
index dd7ae8f..0000000
--- a/abs/extra/bluez/org.bluez.service
+++ /dev/null
@@ -1,5 +0,0 @@
-[D-BUS Service]
-Name=org.bluez
-Exec=/bin/false
-User=root
-SystemdService=dbus-org.bluez.service
-- 
cgit v0.12

