# Contributor: Alex Yam <alex@alexyam.com>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=pari
pkgver=2.17.2
pkgrel=0
pkgdesc="Computer algebra system designed for fast computations in number theory"
url="https://pari.math.u-bordeaux.fr/"
arch="all"
license="GPL-2.0-or-later"
depends="$pkgname-libs=$pkgver-r$pkgrel"
depends_dev="
	$pkgname=$pkgver-r$pkgrel
	gmp-dev
	readline-dev
	"
makedepends="
	$depends_dev
	perl
	"
checkdepends="diffutils" # BusyBox diff: unrecognized option: c
subpackages="$pkgname-dev $pkgname-libs $pkgname-doc"
source="https://pari.math.u-bordeaux.fr/pub/pari/unix/pari-$pkgver.tar.gz"

build() {
	export CFLAGS="${CFLAGS//-Os/-O2} -flto=auto"
	export CPPFLAGS="${CPPFLAGS//-Os/-O2} -flto=auto"
	./Configure \
		--prefix=/usr \
		--mt=pthread \
		--with-readline \
		--with-gmp \
		--graphic=svg
	make all
}

check() {
	make dobench
}

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

doc() {
	default_doc

	amove \
		usr/share/pari/doc \
		usr/share/pari/examples
}

sha512sums="
3b981771fe7673470f0684351518ea88b5f71255a39ea39d72ae972dfc816d12468d81956400ec6bac1c6e191086007e696f63a342bf2e63c4ea8a2879e3fa50  pari-2.17.2.tar.gz
"
