# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Rémy Oudompheng <oudomphe@clipper.ens.fr>

pkgname=pynac
pkgver=0.7.29
pkgrel=3
pkgdesc='Python version of GiNaC, a C++ library for symbolic mathematical calculations'
arch=(x86_64)
url='http://pynac.org'
license=(GPL)
depends=(python singular) # giac disabled because of https://trac.sagemath.org/ticket/26427
source=(https://github.com/pynac/pynac/archive/$pkgname-$pkgver.tar.gz
        https://github.com/pynac/pynac/commit/c52366ca.patch)
sha256sums=('44c7628f23f48299dac538cb99a9f5e615fa730e4d48b89291fa72fda109bb64'
            '3b12ee82b3bb6478e6b59549aae6cc3ecb32d337d0fcb62cbb40965150f0c13a')

prepare() {
  cd pynac-pynac-$pkgver
  patch -p1 -i ../c52366ca.patch # Fix infinite loop
  ./bootstrap
}

build() {
  cd pynac-pynac-$pkgver

  ./configure --prefix=/usr
  #https://bugzilla.gnome.org/show_bug.cgi?id=655517
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd pynac-pynac-$pkgver
  make DESTDIR="$pkgdir" install
}
