# Template file for 'gwenhywfar'
pkgname=gwenhywfar
version=5.10.2
revision=2
build_style=gnu-configure
configure_args="--disable-binreloc --disable-network-checks
 --with-qt5-moc=/usr/lib/qt5/bin/moc --with-qt5-uic=/usr/lib/qt5/bin/uic"
hostmakedepends="automake pkg-config libgcrypt-devel libtool which
 gettext-devel"
makedepends="libgcrypt-devel gnutls-devel gtk+-devel qt5-devel gtk+3-devel"
short_desc="OS abstraction functions for various projects"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="LGPL-2.1-or-later"
homepage="https://github.com/aqbanking/gwenhywfar"
distfiles="https://github.com/aqbanking/gwenhywfar/archive/refs/tags/${version}.tar.gz"
checksum=2b0b9dd49b95f025f4e0c0346ba88e20b893407c444fccf6403a4da349954f04

if [ "$CROSS_BUILD" ]; then
	hostmakedepends+=" qt5-host-tools qt5-devel"
fi

pre_configure() {
	export QT_SELECT=5
	autoreconf -fi
	if [ "$CROSS_BUILD" ]; then
		cat > "${wrksrc}/qt.conf" <<- _EOF
			[Paths]
			Sysroot=${XBPS_CROSS_BASE}
			Prefix=${XBPS_CROSS_BASE}/usr
			ArchData=${XBPS_CROSS_BASE}/usr/lib/qt5
			Data=${XBPS_CROSS_BASE}/usr/share/qt5
			Documentation=${XBPS_CROSS_BASE}/usr/share/doc/qt5
			Headers=${XBPS_CROSS_BASE}/usr/include/qt5
			Libraries=${XBPS_CROSS_BASE}/usr/lib
			LibraryExecutables=/usr/lib/qt5/libexec
			Binaries=/usr/lib/qt5/bin
			Tests=${XBPS_CROSS_BASE}/usr/tests
			Plugins=/usr/lib/qt5/plugins
			Imports=${XBPS_CROSS_BASE}/usr/lib/qt5/imports
			Qml2Imports=${XBPS_CROSS_BASE}/usr/lib/qt5/qml
			Translations=${XBPS_CROSS_BASE}/usr/share/qt5/translations
			Settings=${XBPS_CROSS_BASE}/etc/xdg
			Examples=${XBPS_CROSS_BASE}/usr/share/qt5/examples
			HostPrefix=/usr
			HostData=/usr/lib/qt5
			HostBinaries=/usr/lib/qt5/bin
			HostLibraries=/usr/lib
			Spec=linux-g++
			TargetSpec=linux-g++
			_EOF
		configure_args+=" --with-qt5-config=${wrksrc}/qt.conf"
	fi
}

gwenhywfar-gtk3_package() {
	short_desc+=" - gtk+3 bindings"
	pkg_install() {
		vmove usr/lib/*-gtk3*
	}
}

gwenhywfar-qt5_package() {
	short_desc+=" - qt5 bindings"
	pkg_install() {
		vmove usr/lib/*-qt5*
	}
}

gwenhywfar-devel_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/bin/gwenhywfar-config
		vmove usr/share/aclocal
		vmove usr/lib/cmake
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
	}
}
