# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=libbson
pkgver=1.9.3
pkgrel=0
pkgdesc="routines related to building, parsing, and iterating BSON documents"
url="https://github.com/mongodb/libbson"
arch="all"
license="Apache-2.0"
depends=
depends_dev=
makedepends="$depends_dev autoconf automake libtool py3-sphinx"
checkdepends="bash"
install=
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/mongodb/$pkgname/archive/$pkgver.tar.gz"

builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	cd "$builddir"
	NOCONFIGURE=1 ./autogen.sh
}

build() {
	cd "$builddir"
	SPHINX_BUILD=/usr/bin/sphinx-build-3 ./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-man-pages=yes \
		--enable-tests=yes
	make
}

check() {
	cd "$builddir"
	make TEST_ARGS=--no-fork check
}

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

sha512sums="0095ca0b1757cccf311eef9fccd8facb2deef4fe50ca41b2659eab4360537e7a04732565a841a2c1c985595b209c36b41066eb7922563708400583c89adcbc4f  libbson-1.9.3.tar.gz"
