From ec95b1162b987b25ec6578457e407f684092e47b Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Wed, 18 Dec 2013 13:12:58 +0100
Subject: [PATCH] libmtp: cross build support.

---
 srcpkgs/libmtp/template | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/srcpkgs/libmtp/template b/srcpkgs/libmtp/template
index c88f3c66a97..b04d2941b8b 100644
--- a/srcpkgs/libmtp/template
+++ b/srcpkgs/libmtp/template
@@ -1,7 +1,7 @@
 # Template file for 'libmtp'
 pkgname=libmtp
 version=1.1.6
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--disable-static --with-udev=/usr/lib/udev
  ac_cv_func_memcmp_working=yes ac_cv_func_malloc_0_nonnull=yes"
@@ -13,10 +13,17 @@ homepage="http://libmtp.sourceforge.net"
 license="LGPL-2.1"
 distfiles="${SOURCEFORGE_SITE}/$pkgname/$pkgname-$version.tar.gz"
 checksum=3a1c1c83af91de4052eb54feb795c141b4c04a252e0031954ebbf6175970cb0a
-long_desc="
- libmtp is an implementation of Microsoft's Media Transfer Protocol (MTP)
- in the form of a library suitable primarily for POSIX compliant operating
- systems."
+
+if [ "$CROSS_BUILD" ]; then
+	# XXX needs host mtp-hotplug
+	hostmakedepends+=" libmtp"
+fi
+
+pre_configure() {
+	if [ "$CROSS_BUILD" ]; then
+		sed -e "s,\(util/mtp-hotplug \),mtp-hotplug ,g" -i Makefile.in
+	fi
+}
 
 post_install() {
 	sed -i "/^Unable to open/d" ${DESTDIR}/usr/lib/udev/rules.d/69-libmtp.rules