# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=libbsd
pkgver=0.9.1
pkgrel=0
pkgdesc="Commonly used BSD functions not implemented by all libcs"
url="https://libbsd.freedesktop.org/"
arch="all"
license="BSD-2-Clause-NetBSD AND BSD-3-Clause AND BSD-4-Clause AND BSD-5-Clause AND Expat AND ISC AND Public-Domain AND Beerware"
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="https://libbsd.freedesktop.org/releases/$pkgname-$pkgver.tar.xz
	0001-Replace-__BEGIN_DECLS-and-__END_DECLS.patch
	disable-fpurge-test.patch
	headers.patch
	"

prepare() {
	default_prepare

	cd "$builddir"
	autoreconf -fi
}

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

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

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
}

sha512sums="435822b8f2495a5e2705e5ab5c834a4f0f3a177b3e5c46a7c6162924507ca984e957e94a512b5ebd0067ecb413bac458fade357709ef199e9b75edf0315de91c  libbsd-0.9.1.tar.xz
5a3302601e9534ce8493122b20cc53fe320e0d884ca4abf041a8d151175c076e26ac9ef521c65b1654ea2295bd0251b70b0bdc80ed8a03c98777aab8502719ca  0001-Replace-__BEGIN_DECLS-and-__END_DECLS.patch
34ab57a9b67c0d6035312dff78e6dd0d1c48442c6a1b6e769b6ebb6dccb0dac80ccc2c309724e39c097cdac944bdbd9522582f93f2567da8c6615990e2d0238b  disable-fpurge-test.patch
594d598bc7f6d34bff080a26f8d726bf779d3827423f242ee7caa9a58fc89c89d80e0677c03e9c640e0074afbdc34636fa8ffa47a99fd9c576845e3039a7ccbd  headers.patch"