# Template file for 'imath'
pkgname=imath
version=3.1.9
revision=4
build_style=cmake
configure_args="-DPYTHON=ON"
hostmakedepends="python3-numpy"
makedepends="boost-devel boost-python3 python3-devel python3-numpy"
short_desc="C++/Python library for 2D/3D vector/matrix/math operations"
maintainer="André Cerqueira <acerqueira021@gmail.com>"
license="BSD-3-Clause"
homepage="https://imath.readthedocs.io/"
changelog="https://raw.githubusercontent.com/AcademySoftwareFoundation/Imath/main/CHANGES.md"
distfiles="https://github.com/AcademySoftwareFoundation/Imath/archive/v${version}/imath-${version}.tar.gz"
checksum=f1d8aacd46afed958babfced3190d2d3c8209b66da451f556abd6da94c165cf3

if [ "$XBPS_CHECK_PKGS" ]; then
	configure_args+=" -DBUILD_TESTING=ON"
else
	configure_args+=" -DBUILD_TESTING=OFF"
fi

if [ "$XBPS_MACHINE" = "i686" ]
then
	make_check=no # Test Fails in i686
	# See upstream: https://github.com/AcademySoftwareFoundation/Imath/issues/151
fi

post_install() {
	vlicense LICENSE.md
}

imath-python3_package() {
	short_desc+=" - Python module"
	pkg_install() {
		vmove "usr/lib/libPyImath*.so.*"
		vmove "${py3_sitelib}"
	}
}

imath-python3-devel_package() {
	depends="imath-python3>=${version}_${revision} python3-devel boost-devel
	 imath-devel>=${version}_${revision}"
	short_desc+=" - Python module - development files"
	pkg_install() {
		vmove "usr/include/Imath/Py*"
		vmove "usr/lib/cmake/PyImath*"
		vmove usr/lib/pkgconfig/PyImath.pc
		vmove "usr/lib/libPyImath*.so"
	}
}

imath-devel_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove "usr/include/Imath/half*"
		vmove "usr/include/Imath/Imath*"
		vmove "usr/lib/cmake/Imath*"
		vmove usr/lib/pkgconfig/Imath.pc
		vmove "usr/lib/libImath*.so"
	}
}
