# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libplist
pkgver=2.4.0
pkgrel=1
pkgdesc="library to handle Apple Property List format whereas it's binary or XML"
url="https://libimobiledevice.org/"
arch="all"
license="GPL-2.0-or-later AND LGPL-2.1-or-later"
makedepends="
	cython
	glib-dev
	py3-setuptools
	python3-dev
	swig
	"
checkdepends="diffutils"
subpackages="
	$pkgname-static
	$pkgname-dev
	py3-$pkgname:_py3
	$pkgname-util
	$pkgname++:cxx
	$pkgname-doc
	"
source="https://github.com/libimobiledevice/libplist/releases/download/$pkgver/libplist-$pkgver.tar.bz2"
options="!check" # 'huge' test fails on aarch64 builders but passes when ran manually and everywhere else (?)

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--mandir=/usr/share/man
	make
}

check() {
	make check || {
		cat test/test-suite.log
		return 1
	}
}

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

util() {
	pkgdesc="Util for libplist"
	amove usr/bin
}

_py3() {
	pkgdesc="Python bindings for libplist"
	amove usr/lib/python3*
}

cxx() {
	pkgdesc="C++ bindings to libplist"
	amove usr/lib/*++*.so.*
}

sha512sums="
2a1a95eccef4d4897494f0f8be027b9ef6e1cbe75953c2c485552c13157db9639ae1d4fbf996fe903b7a5f3fb9e9e3c5a1fbba468c87b82db1f8bf1599c40cf1  libplist-2.4.0.tar.bz2
"