# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:
pkgname=kodi-platform
pkgver=20150323
_git_hash=68315f04d8a7c3bc4833af7bd56f5b7d905d351d
pkgrel=0
pkgdesc="Kodi platform support library"
url="https://github.com/xbmc/kodi-platform"
arch="x86 x86_64"
license="GPL"
depends=""
depends_dev="kodi-dev tinyxml-dev"
makedepends="$depends_dev cmake"
install=""
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/xbmc/kodi-platform/archive/$_git_hash.tar.gz
	check-for-glibc.patch"

_builddir="$srcdir"/$pkgname-$_git_hash

prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=/usr/lib \
		-DCMAKE_INSTALL_LIBDIR_NOARCH=/usr/lib \
		-DCMAKE_BUILD_TYPE=Release \
		. || return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
}

md5sums="3d69fa19f6db79283afb56eb6b16f367  kodi-platform-20150323.tar.gz
1d1510ec5caca1b87a7e83e5b903dccb  check-for-glibc.patch"
sha256sums="38b26976f9ee711dce7257d3dcdc6862f31ad52f3d181b91a8f7bc04439d4d31  kodi-platform-20150323.tar.gz
d9f4f57c1f48f1ff2df45597e2052190acc5ff8febdeb77973fdca049b128a3f  check-for-glibc.patch"
sha512sums="b730c14aa96aac4b58d433175c3e30056944dabb946946566df820dfa80d27c7999098719a1cbb82d12bebb577eb89b2540391a175af4cf2f69bffce9c8baa7a  kodi-platform-20150323.tar.gz
7189b9dc2fbcd8a003cf031b130b8d96226432237a80c6fdf24d6f238dcac8de886bc5ec39227dcf66efd4be201f13471ca300246ade8581ed3f6e7356850a0c  check-for-glibc.patch"