# Template file for 'libhandy'
pkgname=libhandy
version=0.0.13
revision=3
wrksrc="libhandy-v${version}"
build_style=meson
build_helper="gir"
configure_args="-Dexamples=true -Dtests=true
 $(vopt_bool gir vapi) -Dglade_catalog=$(vopt_if glade enabled disabled)
 -Dintrospection=$(vopt_if gir enabled disabled)"
hostmakedepends="glib-devel pkg-config $(vopt_if gir vala-devel)"
makedepends="gtk+3-devel libglib-devel $(vopt_if glade glade3-devel)"
checkdepends="xvfb-run"
short_desc="GTK+3 building blocks for modern adaptive applications"
maintainer="Michal Vasilek <michal@vasilek.cz>"
license="LGPL-2.1-or-later"
homepage="https://gitlab.gnome.org/GNOME/libhandy"
distfiles="https://gitlab.gnome.org/GNOME/libhandy/-/archive/v${version}/libhandy-v${version}.tar.gz"
checksum=138bec94e66d15a7a19350b65845d4529bcd969ea913ab3eb438f56fe47d5d37

build_options="gir glade"
desc_option_glade="Generate glade modules and catalog files"
build_options_default="gir glade"

# https://gitlab.gnome.org/GNOME/libhandy/-/merge_requests/559
CFLAGS="-DGPC_OBJECT_DELIMITER=GLADE_PROPERTY_DEF_OBJECT_DELIMITER"
CFLAGS+=" -Dglade_widget_action_get_class=glade_widget_action_get_def"
# https://gitlab.gnome.org/GNOME/glade/-/commit/bb626dd
CFLAGS+=" -DGWA_GET_CLASS=GLADE_WIDGET_ADAPTOR_GET_ADAPTOR_CLASS"

do_check() {
	xvfb-run ninja -C build test
}

libhandy-devel_package() {
	depends="${sourcepkg}>=${version}_${revision} gtk+3-devel"
	short_desc+=" - development files"
	pkg_install() {
		vmove "usr/lib/*.so"
		vmove usr/include
		vmove usr/lib/pkgconfig
		if [ "$build_option_glade" ]; then
			vmove usr/lib/glade
			vmove usr/share/glade
		fi
		if [ "$build_option_gir" ]; then
			vmove usr/share/gir-1.0
			vmove usr/share/vala
		fi
	}
}

libhandy-demo_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - demonstration application"
	pkg_install() {
		vmove usr/bin/handy-0.0-demo
	}
}
