# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: Max Rees <maxcrees@me.com>
pkgname=talloc
pkgver=2.3.0
pkgrel=0
pkgdesc="Memory pool management library"
url="https://talloc.samba.org"
arch="all"
license="LGPL-3.0+ AND GPL-3.0+ AND ISC AND LGPL-2.1+ AND BSD-3-Clause AND PostgreSQL"
replaces="samba-common"
depends=""
makedepends="cmd:which docbook-xsl libxslt python3-dev"
subpackages="$pkgname-dev py3-$pkgname:py3 $pkgname-doc"
source="https://samba.org/ftp/$pkgname/$pkgname-$pkgver.tar.gz"

build() {
	PYTHON=python3 ./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--bundled-libraries=NONE \
		--builtin-libraries=replace \
		--disable-rpath \
		--disable-rpath-install
	make
}

check() {
	make check
}

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

py3() {
	pkgdesc="Python 3 binding for libtalloc"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libpytalloc-util.cpython* \
		"$pkgdir"/usr/lib/python3* "$subpkgdir"/usr/lib/
}

sha512sums="f0020d83520ea24711040c44600180fabae7b0e0668a961a66f5d4f77d89b09d799ddadf781ee2d044ad059b2d6a2e5232068fd77b300a8366592c0ce2289837  talloc-2.3.0.tar.gz"