# Template file for 'ghex'
pkgname=ghex
version=46.0
revision=1
build_style=meson
build_helper=gir
configure_args="$(vopt_feature gir introspection)
 $(vopt_bool gtk_doc gtk_doc)"
hostmakedepends="pkg-config iso-codes gettext itstool glib-devel
 desktop-file-utils gtk-update-icon-cache $(vopt_if gtk_doc gi-docgen)"
makedepends="gtk4-devel libadwaita-devel"
depends="hicolor-icon-theme desktop-file-utils iso-codes"
short_desc="Simple binary editor for GNOME"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-only, GFDL-1.1-only"
homepage="https://gitlab.gnome.org/GNOME/ghex"
changelog="https://gitlab.gnome.org/GNOME/ghex/-/raw/ghex-46/NEWS"
distfiles="${GNOME_SITE}/ghex/${version%.*}/ghex-${version}.tar.xz"
checksum=a1c46f3020cb358b8323025db3a539c97d994a4c46f701f48edc6357f7fbcbd1

build_options="gir gtk_doc"
build_options_default="gir gtk_doc"

pre_build() {
	# help gi-docgen find gi files on cross
	if [ -n "$CROSS_BUILD" ]; then
		export XDG_DATA_DIRS=/usr/$XBPS_CROSS_TRIPLET/usr/share/
	fi
}

libgtkhex_package() {
	short_desc+=" - runtime library"
	pkg_install() {
		vmove usr/lib/*.so.*
	}
}

ghex-devel_package() {
	depends="gtk4-devel libadwaita-devel libgtkhex>=${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_gtk_doc" ]; then
			vmove usr/share/doc
		fi
	}
}
