# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=libbsd
pkgver=0.8.6
pkgrel=1
pkgdesc="commonly-used BSD functions not implemented by all libcs"
url="http://libbsd.freedesktop.org/"
arch="all"
license="BSD"
depends="musl>=1.1.16-r22"
depends_dev="bsd-compat-headers linux-headers"
makedepends="$depends_dev autoconf automake libtool"
subpackages="$pkgname-dev $pkgname-doc"
source="http://libbsd.freedesktop.org/releases/$pkgname-$pkgver.tar.xz
	0001-Replace-__BEGIN_DECLS-and-__END_DECLS.patch
	"

builddir="$srcdir/$pkgname-$pkgver"
prepare() {
	default_prepare || return 1

	cd "$builddir"
	autoreconf -fi || return 1
}

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		|| return 1
	make || return 1
}

package() {
	make DESTDIR="$pkgdir" -C "$builddir" \
		install || return 1
}

sha512sums="ece01ced324f840c2cee6321c7dcf97ff123d55ea9f203c1ce35e1b46643dc7b34ef6dc6c8d128252b36848624850b40823411cc96b99a66a401eb1e9d8cea6b  libbsd-0.8.6.tar.xz
4ef5d664f04af21da17c5ac9eed6fec4c0c7d06ff3af70e93bfdfdf926c7473954649e315158ec8f90cef93f82524431fa4fbc60374d20007f1234d6afe9edcd  0001-Replace-__BEGIN_DECLS-and-__END_DECLS.patch"