# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py3-gobject3
pkgver=3.50.1
pkgrel=0
pkgdesc="Python bindings for the GObject library"
url="https://wiki.gnome.org/Projects/PyGObject/"
arch="all"
license="LGPL-2.1-or-later"
makedepends="
	glib-dev
	gobject-introspection-dev
	libffi-dev
	meson
	py3-cairo-dev
	py3-setuptools
	python3-dev
	"
checkdepends="py3-pytest gtk+3.0-dev xvfb-run ibus font-dejavu"
depends="python3"
subpackages="$pkgname-dev:_dev $pkgname-pyc"
options="!check" # Need ibus which is in community/
source="https://download.gnome.org/sources/pygobject/${pkgver%.*}/pygobject-$pkgver.tar.gz"
builddir="$srcdir"/pygobject-$pkgver

replaces="py-gobject3" # Backwards compatibility
provides="py-gobject3=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	abuild-meson \
		-Db_lto=true \
		-Dpycairo=enabled \
		. output

	meson compile -C output
}

check() {
	PYGI_TEST_VERBOSE="1" xvfb-run -a meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

_dev() {
	replaces="py-gobject3-dev" # Backwards compatibility
	provides="py-gobject3-dev=$pkgver-r$pkgrel" # Backwards compatibility

	default_dev
}

sha512sums="
5708756cbc8e2b697442953a7f3d391ace98f1b7811cb905b0d80185f020bf32a775d70c49d1620a9733e83a6862314f2a72fa1b77cb26a01e84b3bff72e068e  pygobject-3.50.1.tar.gz
"
