# 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.18.0
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
	"
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="8a5beccb8f433b4cc22b292419e90fec9bae8253c2173c83582ae2c88244ecde7845b169358ab5ebd769f847b539c6365ebd5ef3f5347ca0aaa7dd1984b0c2d7  libuv-v1.18.0.tar.gz
478d25c8905cd393b9ced0f1b16e70794a7ef20fb9eb212fd74e50beca3f5a33a6a5267616abecf470426ed3d00efec51df468745ff43c0de05c0ad8234f1eb3  disable-setuid-test.patch"
