# Template file for 'libosinfo'
pkgname=libosinfo
version=1.8.0
revision=1
wrksrc="${pkgname}-v${version}"
build_style=meson
build_helper="gir"
configure_args="-Denable-introspection=$(vopt_if gir enabled disabled)
 -Denable-vala=$(vopt_if vala enabled disabled)
 -Denable-gtk-doc=$(vopt_if gtk_doc true false)"
hostmakedepends="glib-devel intltool pkg-config wget hwids
 $(vopt_if gtk_doc gtk-doc)
 $(vopt_if vala vala)"
makedepends="libxslt-devel libglib-devel libsoup-devel"
depends="osinfo-db hwids"
short_desc="GObject based library API for managing info about operating systems"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later, LGPL-2.1-or-later"
homepage="https://libosinfo.org/"
changelog="https://gitlab.com/libosinfo/libosinfo/raw/master/NEWS"
distfiles="https://gitlab.com/libosinfo/libosinfo/-/archive/v${version}/libosinfo-v${version}.tar.gz"
checksum=da54dc1ef77e87b78aab0488cf4da3ae242cfb92555b106cd9a0fe976e5d4e25

build_options="gtk_doc gir vala"
desc_option_gtk_doc="Build GTK API docs"
build_options_default="gir vala"

if [ -z "$CROSS_BUILD" ] ; then
	build_options_default+=" gtk_doc"
fi

# Liberation
pre_patch() {
	# Remove docs having references to non-FSDG distros/OS
	rm -rfv docs
	# Remove NEWS having references to non-FSDG distros/OS
	rm -v NEWS
	# Remove non-FSDG referencing stuff
	rm -rfv {tests,ci,.gitlab-ci.yml}
}

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