# $Id: PKGBUILD 128351 2015-02-27 11:18:31Z mtorromeo $
# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>

pkgname=libuv
pkgver=1.4.2
pkgrel=1
pkgdesc="Multi-platform support library with a focus on asynchronous I/O"
arch=('i686' 'x86_64')
url="https://github.com/libuv/libuv"
license=('custom')
depends=('glibc')
makedepends=('python-sphinx')
source=("https://github.com/libuv/libuv/archive/v$pkgver.tar.gz"
        "glibc-2.20.patch::https://github.com/libuv/libuv/commit/fd3cf20a37b95fe8a3cb4be045b5a1bad9e53cde.patch")

prepare() {
	cd "$srcdir"/$pkgname-$pkgver
	patch -p1 -i "$srcdir"/glibc-2.20.patch
}

build() {
	cd "$srcdir"/$pkgname-$pkgver
	./autogen.sh
	./configure --prefix=/usr
	make
	make man -C docs
}

check() {
	cd "$srcdir"/$pkgname-$pkgver
	make check
}

package() {
	cd "$srcdir"/$pkgname-$pkgver

	make DESTDIR="$pkgdir" install

	install -Dm644 LICENSE \
		"$pkgdir"/usr/share/licenses/$pkgname/LICENSE
	install -Dm644 AUTHORS \
		"$pkgdir"/usr/share/doc/$pkgname/AUTHORS
	install -Dm644 README.md \
		"$pkgdir"/usr/share/doc/$pkgname/README.md
	install -Dm644 ChangeLog \
		"$pkgdir"/usr/share/doc/$pkgname/ChangeLog
	install -Dm644 docs/build/man/libuv.1 \
		"$pkgdir"/usr/share/man/man1/libuv.1
}

sha256sums=('b9e424f69db0d1c3035c5f871cd9d7a3f4bace0a4db3e974bdbfa0cf95f6b741'
            '86247621352c906ea0252990ff0fa035dcd05a490e9f553bdac59a81b11f786d')
