# Template file for 'ledger'
pkgname=ledger
version=3.3.2
revision=5
build_style=cmake
makedepends="boost-devel-minimal libboost_filesystem libboost_iostreams
 libboost_nowide libboost_unit_test_framework
 gmp-devel mpfr-devel gettext-devel libedit-devel"
short_desc="Double-entry accounting system with a command-line reporting interface"
maintainer="Orphaned <orphan@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://www.ledger-cli.org/"
distfiles="https://github.com/ledger/${pkgname}/archive/v${version}.tar.gz"
checksum=555296ee1e870ff04e2356676977dcf55ebab5ad79126667bc56464cb1142035

post_extract() {
	# see upstream: https://github.com/ledger/ledger/issues/1783
	# > It seems to fail in a non-deterministic manner. If you run it long
	# > enough, it might fail.
	rm -f test/baseline/cmd-pricedb.test
	rm -f test/baseline/cmd-prices.test
}

post_install() {
	rm -Rf ${DESTDIR}/usr/local
	if [ -e ${DESTDIR}/usr/lib64 ]; then
		mv ${DESTDIR}/usr/lib64 ${DESTDIR}/usr/lib
	fi

	vcompletion contrib/ledger-completion.bash bash

	vlicense LICENSE.md
}

libledger_package() {
	short_desc+=" - library files"
	pkg_install() {
		vmove "usr/lib/*.so.*"
	}
}

libledger-devel_package() {
	short_desc+=" - development files"
	depends="libledger>=${version}_${revision} ${makedepends}"
	pkg_install() {
		vmove "usr/lib/*.so"
		vmove usr/include
	}
}
