# Template file for 'libdex'
pkgname=libdex
version=0.4.3
revision=1
build_style=meson
build_helper=gir
configure_args="-Dexamples=false
 $(vopt_bool gtk_doc docs)
 $(vopt_feature gir introspection)
 $(vopt_bool vala vapi)"
hostmakedepends="pkg-config glib-devel gettext
 $(vopt_if vala vala) $(vopt_if gtk_doc gi-docgen)"
makedepends="glib-devel libgirepository-devel
 liburing-devel $(vopt_if vala 'vala vala-devel')"
short_desc="Future-based programming for GLib-based applications"
maintainer="oreo639 <oreo6391@gmail.com>"
license="LGPL-2.1-or-later"
homepage="https://gitlab.gnome.org/GNOME/libdex"
changelog="https://gitlab.gnome.org/GNOME/libdex/-/raw/main/NEWS"
distfiles="${GNOME_SITE}/libdex/${version%.*}/libdex-${version}.tar.xz"
checksum=adead71f660e1e44f182c037a48ae528540c028445c1b6715d1ea3a5cac64580

# Package build options
build_options="gir vala gtk_doc"
build_options_default="gir vala gtk_doc"

if [ "$XBPS_TARGET_LIBC" = musl ]; then
	makedepends+=" libucontext-devel"
	CFLAGS="-D_GNU_SOURCE"
fi

if [ "$XBPS_CHECK_PKGS" ]; then
	configure_args+=" -Dtests=true"
else
	configure_args+=" -Dtests=false"
fi

libdex-devel_package() {
	depends="${sourcepkg}-${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
		if [ "$build_option_gir" ]; then
			vmove usr/share/gir-1.0
		fi
		if [ "$build_option_vala" ]; then
			vmove usr/share/vala
		fi
		if [ "$build_option_gtk_doc" ]; then
			vmove usr/share/doc
		fi
	}
}
