# Template file for 'glib-bootstrap'
# keep in sync with glib
#
# This aloing with gobject-introspection-bootstrap is unfortunately necessary as a part of the
#   libgirepository-1.0 to libgirepository-2.0 migration.
pkgname=glib-bootstrap
version=2.82.1
revision=1
build_style=meson
# static version is necessary for qemu-user
# also disable LTO, otherwise there are multiple failures when linking qemu
configure_args="-Dman=true -Dselinux=disabled
 --default-library=both -Db_lto=false -Dintrospection=disabled"
hostmakedepends="gettext pkg-config libxslt docbook-xsl python3-packaging python3-docutils"
makedepends="zlib-devel pcre2-devel libffi-devel dbus-devel elfutils-devel libmount-devel"
depends="${makedepends}"
checkdepends="desktop-file-utils shared-mime-info dbus python3-pytest"
short_desc="GNU library of C routines"
maintainer="Orphaned <orphan@voidlinux.org>"
license="LGPL-2.1-or-later"
homepage="https://wiki.gnome.org/Projects/GLib"
changelog="https://gitlab.gnome.org/GNOME/glib/raw/glib-2-82/NEWS"
#changelog="https://gitlab.gnome.org/GNOME/glib/raw/main/NEWS"
distfiles="${GNOME_SITE}/glib/${version%.*}/glib-${version}.tar.xz"
checksum=478634440bf52ee4ec4428d558787398c0be6b043c521beb308334b3db4489a6
make_check_pre="dbus-run-session"

repository=bootstrap
conflicts="glib libglib-devel glib-devel"
provides="glib-${version}_${revision}"

post_patch() {
	# Timer test is flaky on 32 bit (does float comparisons)
	if [ "${XBPS_TARGET_WORDSIZE}" = "32" ]; then
		vsed -e "s/'timer' : {},//" -i glib/tests/meson.build
	fi
	# Test fails in CI
	vsed -e '/test_cleanup_handles_errors)/d' -i glib/tests/utils-isolated.c
}

pre_check() {
	# machine-id is a random, non-zero value
	echo 'dcb30309cd6c8b7cc20383d85a5c7012' > /etc/machine-id
}

post_check() {
	rm /etc/machine-id
}
