# Contributor: Jose-Luis Rivas <ghostbar@riseup.net>
# Conttributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libuv
pkgver=1.19.2
pkgrel=0
pkgdesc="Cross-platform asychronous I/O"
url="http://libuv.org"
arch="all"
license="MIT BSD ISC"
makedepends="automake autoconf libtool linux-headers"
subpackages="$pkgname-dev $pkgname-dbg"
source="https://dist.libuv.org/dist/v$pkgver/$pkgname-v$pkgver.tar.gz
	disable-setuid-test.patch
	test-connection-unspecified.patch
	"
builddir="$srcdir/$pkgname-v$pkgver"

prepare() {
	default_prepare
	cd "$builddir"
	sh autogen.sh
}

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make CFLAGS="$CFLAGS -D__USE_MISC" BUILDTYPE=Release
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	install -Dm644 LICENSE \
		"$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

sha512sums="8f317bb9c173af32d19e8f9f5c64e2cb50178166a109e84218ea630667a5cbd8c6c700c53baf89d2754e615b8526c22d5514bf3c2fe123913b297fbe5727be5e  libuv-v1.19.2.tar.gz
7471ec9bd513c50cd38f9c38ece5fe45c3dc02c9e941a6db4b480efc6d0dfc86a7a32608735ca49439d23653369fa8444eb70e41b99d6dcbf32db0375ec92793  disable-setuid-test.patch
e3faf7b148ce2fb4d28de27c8b096282a7d93bdd4ca253c89b33f17bcc2a123698b8ed9aada6aa6ba502d3a261a1ac36fa2faa245df4969c85a60ee5da0f96fa  test-connection-unspecified.patch"
