# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=vte3
pkgver=0.78.5
pkgrel=0
pkgdesc="Virtual Terminal Emulator library"
url="https://gitlab.gnome.org/GNOME/vte"
arch="all"
license="LGPL-2.0-or-later"
subpackages="$pkgname-dbg $pkgname-dev $pkgname-gtk4 $pkgname-lang"
makedepends="
	bash
	gnutls-dev
	gobject-introspection-dev
	gperf
	gtk+3.0-dev
	gtk4.0-dev
	gtk-doc
	icu-dev
	libxml2-utils
	linux-headers
	lz4-dev
	meson
	ncurses-dev
	pango-dev
	pcre2-dev
	vala
	"
source="https://gitlab.gnome.org/GNOME/vte/-/archive/$pkgver/vte-$pkgver.tar.gz
	fix-W_EXITCODE.patch
	"

builddir="$srcdir/vte-$pkgver"

build() {
	abuild-meson \
		-Dgtk4=true \
		-Ddocs=false \
		-D_systemd=false \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

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

gtk4() {
	pkgdesc="$pkgdesc (gtk4 component)"

	amove usr/bin/vte-*-gtk4
	amove usr/lib/libvte-*-gtk4.so.*
}

sha512sums="
8d8d13ca78da0c6c08824e17b0f907c91f35a39e078d7a90ed9eb59b23d7ebc6298b1e4c1da5f3e47c823fb26df9434108b3aa34a755008eb500947aadd14cb7  vte-0.78.5.tar.gz
b6c1856bf075c2e3e91a0d4aff700c59e738bd6abe4122a11d680f104a2dab9d99f7d836a3ef3020b25ceff0a37231a6561eb917f0e4b9f90837eb634d8f7f20  fix-W_EXITCODE.patch
"
