# Template file for 'gnucash'
pkgname=gnucash
version=5.8
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 boost-devel gc-devel glib-devel gtest-devel guile-devel
 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.gz"
checksum=b00cff635e8bc8ff996a9f7942fd92414f13ccf3415402cc33220ee58d6f12b8

pycompile_dirs="usr/share/gnucash/python"
conf_files="/etc/gnucash/environment"
nocross="fails to compile guile code when cross-compiling"

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