# Template file for 'gnucash'
pkgname=gnucash
version=5.16
revision=1
build_style=cmake
make_check_target=check
configure_args="-DWITH_PYTHON=1 -DCOMPILE_GSCHEMAS=OFF"
hostmakedepends="pkg-config guile python3-setuptools libxslt perl gettext swig"
makedepends="aqbanking-devel icu-devel gc-devel glib-devel gtest-devel guile-devel
 boost-devel-minimal
 gwenhywfar-devel ktoblzcheck-devel libofx-devel libsecret-devel
 libxslt-devel libwebkit2gtk41-devel python3-devel gwenhywfar-gtk3 tzdata
 libdbi-devel libdbi-drivers-devel"
depends="dconf guile perl"
short_desc="Financial-accounting software"
maintainer="ManfredU <mu@usselmann.it>"
license="GPL-2.0-or-later"
homepage="http://www.gnucash.org"
changelog="https://raw.githubusercontent.com/Gnucash/gnucash/stable/NEWS"
distfiles="https://github.com/Gnucash/gnucash/releases/download/${version}/gnucash-${version}.tar.bz2"
checksum=bb9b6c67ebb6a3e06d9ff4f4e0417a97bef0159d26912be9b0e75a32901fd493

pycompile_dirs="usr/share/gnucash/python"
conf_files="/etc/gnucash/environment"
nocross="dlopen build target files"

CXXFLAGS="-Wno-error"
CFLAGS="-Wno-error"
export LC_ALL="C"

if [ "$XBPS_TARGET_ENDIAN" = "be" ]; then
	broken="Segmentation fault"
fi

post_install() {
	vdoc "${FILESDIR}/README.voidlinux"
	# startup fails in scheme code when the locale is set to anything else on musl
	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
		vsed -i ${DESTDIR}/usr/share/applications/gnucash.desktop \
			-e 's/Exec=gnucash/Exec=env LANG=C gnucash/'
	fi
	# Delete the gnucash-valgrind executable because the source files
	# are not included with the package and the executable is hardlinked
	# to the location that it was built at.
	rm -f "${DESTDIR}/usr/bin/gnucash-valgrind"
}

gnucash-devel_package() {
	short_desc+=" - development files"
	depends="gnucash>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
	}
}
