# Contributor: Miguel Terron <miguel.a.terron@gmail.com>
# Maintainer: Miguel Terron <miguel.a.terron@gmail.com>
pkgname=units
pkgver=2.23
pkgrel=0
pkgdesc="Units conversion and calculation program"
url="https://www.gnu.org/software/units/"
arch="all"
license="GPL-3.0-only"
makedepends="readline-dev python3 py3-requests"
subpackages="$pkgname-doc $pkgname-cur-update:_cur"
source="https://ftp.gnu.org/gnu/units/units-$pkgver.tar.gz"

build() {
	export PYTHON="$(command -v python3)"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--sharedstatedir=/usr/share
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

_cur() {
	pkgdesc="$pkgdesc (currency database updater)"
	depends="units py3-requests python3"

	amove usr/bin/units_cur
}

sha512sums="
628aac3a560ed728f1aba91841f9fccc0b145375a0b8953b98ac00c71bcc7f647377d16c6ba7b59e987a6e7a74b44038a62f2576f757a43d7564be469be81ee8  units-2.23.tar.gz
"
