# Template file for 'flintlib'
pkgname=flintlib
version=3.1.2
revision=1
build_style=gnu-configure
configure_args="--prefix=/usr --disable-arch $(vopt_with ntl)
 $(vopt_if openblas --with-blas-include=${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=fdb3a431a37464834acff3bdc145f4fe8d0f951dd5327c4c6f93f4cbac5c2700

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/pkgconfig
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
	}
}

arb_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - transitional dummy package"
	build_style=meta
}

arb-devel_package() {
	depends="${sourcepkg}-devel>=${version}_${revision}"
	short_desc+=" - transitional dummy package"
	build_style=meta
}
