# $Id: PKGBUILD 137514 2015-07-27 18:29:01Z arojas $
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Gaetan Bisson <bisson@archlinux.org>

pkgname=pari-sage
_pkgver=2.8-1637-g489005a
pkgver=${_pkgver//-/.}
pkgrel=1
pkgdesc='Computer algebra system designed for fast computations in number theory. Development snapshot required by SageMath'
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')
conflicts=(pari)
provides=(pari)
# source=("http://www.sagemath.org/packages/upstream/pari/pari-$_pkgver.tar.gz"
source=("http://mirrors.mit.edu/sage/spkg/upstream/pari/pari-$_pkgver.tar.gz"
 'public_memory_functions.patch' 'perl_regex.patch')
md5sums=('41936ce2dce6bd00a662bf43a772685f'
         '9172b9faee975cd3fe0f97126ea61af8'
         '92b24f7e61c6268a4978636b819fba78')

prepare() {
  cd pari-${_pkgver}

# make some private functions public
  patch -p1 -i "$srcdir"/public_memory_functions.patch
# fix doc build with Perl 5.22
  patch -p1 -i "$srcdir"/perl_regex.patch
}

build() {
	cd pari-${_pkgver}
	./Configure \
		--prefix=/usr \
		--with-readline \
		--mt=pthread \
		--with-gmp \

	make all
}

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