From 4fb22fde61ac7fc190c801a0e69c31b1d069e27c Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Tue, 7 May 2013 17:25:36 +0200
Subject: [PATCH] libatasmart: update to 0.19.

---
 .../libatasmart-strpool-cross-flags.patch     | 42 +++++++++++++++++++
 srcpkgs/libatasmart/template                  | 17 +++++---
 2 files changed, 54 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/libatasmart/patches/libatasmart-strpool-cross-flags.patch

diff --git a/srcpkgs/libatasmart/patches/libatasmart-strpool-cross-flags.patch b/srcpkgs/libatasmart/patches/libatasmart-strpool-cross-flags.patch
new file mode 100644
index 0000000000..82f7f30b94
--- /dev/null
+++ b/srcpkgs/libatasmart/patches/libatasmart-strpool-cross-flags.patch
@@ -0,0 +1,42 @@
+From 730158700ea7a554c37f24bfbf5f4985f7280f3e Mon Sep 17 00:00:00 2001
+From: Peter Korsgaard <jacmet@sunsite.dk>
+Date: Wed, 6 Feb 2013 14:07:02 +0100
+Subject: [PATCH] strpool: don't mix up host/build flags when cross compiling
+
+Submitted upstream as https://bugs.freedesktop.org/show_bug.cgi?id=60364
+
+Commit b71035ce89 (build-sys: modernize build system) changed the strpool
+(which needs to be built for the build machine) compilation to use
+AM_CFLAGS / AM_LDFLAGS rather than CFLAGS / LDFLAGS. This is wrong, as
+The AM_ version is used TOGETHER with (the user supplied) CFLAGS/LDFLAGS,
+causing strpool to use both CFLAGS (for host) and CCFLAGS_FOR_BUILD (for
+build) flags, breaking cross compilation with errors like:
+
+cc1: error: unrecognized command line option "-mabi=spe"
+
+Instead overwrite the (user supplied) CFLAGS with the (user supplied)
+CFLAGS_FOR_BUILD (and similar for LDFLAGS) like we used to do.
+
+Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
+---
+ strpool/Makefile.am |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/strpool/Makefile.am b/strpool/Makefile.am
+index b041cea..5b335a5 100644
+--- strpool/Makefile.am
++++ strpool/Makefile.am
+@@ -17,8 +17,8 @@
+ # <http://www.gnu.org/licenses/>.
+ 
+ CC = @CC_FOR_BUILD@
+-AM_CFLAGS = @BUILD_CFLAGS@
+-AM_LDFLAGS = @BUILD_LDFLAGS@
++CFLAGS = @BUILD_CFLAGS@
++LDFLAGS = @BUILD_LDFLAGS@
+ 
+ noinst_PROGRAMS = \
+ 	strpool
+-- 
+1.7.10.4
+
diff --git a/srcpkgs/libatasmart/template b/srcpkgs/libatasmart/template
index fdbc475c3d..c1f7603036 100644
--- a/srcpkgs/libatasmart/template
+++ b/srcpkgs/libatasmart/template
@@ -1,7 +1,7 @@
 # Template file for 'libatasmart'
 pkgname=libatasmart
-version=0.17
-revision=8
+version=0.19
+revision=1
 build_style=gnu-configure
 configure_args="--disable-static"
 hostmakedepends="pkg-config"
@@ -10,12 +10,19 @@ short_desc="ATA S.M.A.R.T. Reading and Parsing Library"
 homepage="http://0pointer.de/blog/projects/being-smart.html"
 license="LGPL-2.1"
 maintainer="Juan RP <xtraeme@gmail.com>"
-distfiles="http://0pointer.de/public/$pkgname-$version.tar.gz"
-checksum=2d62a11274f32cde2f074adef9ceb662bf205618dfc8f8e74b9be6a8b1ed5ffd
+distfiles="http://0pointer.de/public/$pkgname-$version.tar.xz"
+checksum=61f0ea345f63d28ab2ff0dc352c22271661b66bf09642db3a4049ac9dbdb0f8d
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" automake libtool"
+	pre_configure() {
+		autoreconf -fi
+	}
+fi
 
 libatasmart-devel_package() {
 	depends="libudev-devel libatasmart-${version}_${revision}"
-	short_desc+=" -- development files"
+	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
 		vmove usr/lib/pkgconfig