# Template file for 'gwenhywfar'
pkgname=gwenhywfar
version=5.6.0
revision=1
build_style=gnu-configure
configure_args="--disable-binreloc
 --with-qt5-moc=/usr/lib/qt5/bin/moc --with-qt5-uic=/usr/lib/qt5/bin/uic"
hostmakedepends="automake pkg-config libgcrypt-devel libtool which"
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/${version}.tar.gz"
checksum=9f2876770824a283d02fd730bb1f7a98970fa6f20121f4af433d6698831c3a84

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

pre_configure() {
	export QT_SELECT=5
	# Build all GUIs
	vsed -i configure.ac -e's;"qt4 gtk2";"qt5 gtk2 gtk3";'
	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-gtk_package() {
	short_desc+=" - gtk+2 bindings"
	pkg_install() {
		vmove usr/lib/*-gtk2*
	}
}

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"
	}
}
