# $Id: PKGBUILD 128041 2015-02-20 17:54:31Z bisson $
# Maintainer: Gaetan Bisson <bisson@archlinux.org>

pkgname=pari
pkgver=2.7.3
pkgrel=1
pkgdesc='Computer algebra system designed for fast computations in number theory'
url='http://pari.math.u-bordeaux.fr/'
license=('GPL')
arch=('i686' 'x86_64')
depends=('gmp' 'readline' 'libx11')
makedepends=('perl' 'texlive-core')
optdepends=('perl: gphelp, tex2mail')
source=("http://pari.math.u-bordeaux.fr/pub/pari/unix/${pkgname}-${pkgver}.tar.gz"
        'err_handle.patch')
sha1sums=('fa01d548839301958564a2bec39928ba3c9c9d39'
          '182066ab765eddb0b7fd98b441c158304545f5ec')

prepare() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	sed 's/\$addlib64//g' -i config/get_libpth
	patch -p1 -i ../err_handle.patch # sage-5.6 uses this¸ from upstream trunk
}

build() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	./Configure \
		--prefix=/usr \
		--with-readline \
		--mt=pthread \
		--with-gmp \

	make all
}

check() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	make bench
}

package() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	make DESTDIR="${pkgdir}" install
	ln -sf gp.1.gz "${pkgdir}"/usr/share/man/man1/pari.1
}
