# Template file for 'libbytesize'
pkgname=libbytesize
version=2.5
revision=2
build_style=gnu-configure
hostmakedepends="gettext python3"
makedepends="mpfr-devel pcre2-devel"
checkdepends="python3-six"
short_desc="Library for operations with sizes in bytes"
maintainer="skmpz <dem.procopiou@gmail.com>"
license="LGPL-2.1-or-later"
homepage="https://github.com/storaged-project/libbytesize"
changelog="https://raw.githubusercontent.com/storaged-project/libbytesize/master/NEWS.rst"
distfiles="https://github.com/storaged-project/libbytesize/releases/download/${version}/libbytesize-${version}.tar.gz"
checksum=6305addae2b7be313dbfc36b96094ec0544d5144859ab4a5685ca6d314d6fdda
# checks fails in libbytesize_unittest.sh
make_check=no

pre_check() {
	# Disable test that depends on unpackaged pocketlint
	sed -i 's|canary_tests.sh$||g' tests/Makefile
	# Default locale doesn't work
	sed -i 's|DEFAULT_LOCALE =.*|DEFAULT_LOCALE = "C"|g' tests/libbytesize_unittest.py
}

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

libbytesize-python3_package() {
	depends="python3-six ${sourcepkg}>=${version}_${revision}"
	short_desc+=" - Python3 bindings"
	pkg_install() {
		vmove usr/lib/python3*
	}
}
