# Maintainer: Antonio Rojas < nqn76sw@gmail.com >

pkgname=linbox
pkgver=1.6.3
pkgrel=3
pkgdesc="A template library for exact, high-performance linear algebra computation with dense, sparse, and structured matrices over the integers and over finite fields"
arch=(x86_64)
url="https://linalg.org/"
license=(LGPL)
depends=(fflas-ffpack)
makedepends=(m4rie flint iml fplll)
source=("https://github.com/linbox-team/linbox/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz"
         linbox-fix-pc.patch)
sha256sums=('a58a188307b07c57964e844bceb99321d3043a8a4a1fccc082a54928bb9a0057'
            'd206f828fb7f4a5194e8e395e99e37c16462e29086c03a95cfdc51c02b4fc874')

prepare() {
  cd $pkgname-$pkgver
  patch -p1 -i ../linbox-fix-pc.patch # Fix bogus variable in pc file
}

build() {
  cd $pkgname-$pkgver

  ./configure --prefix=/usr --enable-sage --with-fplll=/usr \
    --disable-sse3 --disable-ssse3 --disable-sse41 --disable-sse42 --disable-avx --disable-avx2 --disable-fma
  #https://bugzilla.gnome.org/show_bug.cgi?id=655517
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

  make
}

check() {
  cd $pkgname-$pkgver
# make check
}

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