# Template file for 'flintlib'
pkgname=flintlib
version=2.9.0
revision=1
build_style=configure
configure_args="--prefix=/usr $(vopt_with ntl)
 $(vopt_if openblas --with-blas=${XBPS_CROSS_BASE}/usr/include/openblas)"
makedepends="mpfr-devel $(vopt_if ntl ntl-devel)
 $(vopt_if openblas openblas-devel)"
short_desc="Fast Library for Number Theory"
maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
license="LGPL-2.1-or-later"
homepage="https://flintlib.org"
changelog="https://raw.githubusercontent.com/wbhart/flint2/trunk/NEWS"
distfiles="https://flintlib.org/flint-${version}.tar.gz"
checksum=2fc090d51033c93208e6c10d406397a53c983ae5343b958eb25f72a57a4ce76a

build_options="ntl openblas"
desc_option_ntl="enable NTL support"

if [ -z "$CROSS_BUILD" ]; then
	build_options_default+=" ntl"
fi

case "$XBPS_TARGET_MACHINE" in
	x86_64*|i686*|aarch64*|arm*|ppc64*) build_options_default+=" openblas";;
esac

CFLAGS="-D_GNU_SOURCE" # needed for cpu_set_t

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