# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Rémy Oudompheng <oudomphe@clipper.ens.fr>
# Contributor: Alessandro "jakedust" Andrioni <jakedust@gmail.com>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - disable LTO via -DIPO_SUPPORTED=FALSE

pkgname=flint
pkgver=3.1.3
pkgrel=2
pkgdesc='A C library for doing number theory'
arch=(x86_64)
url='http://www.flintlib.org'
license=(LGPL-3.0-only)
depends=(cblas
         glibc
         gmp
         mpfr)
makedepends=(cmake
             git
             python)
replaces=(antic
          arb)
source=(git+https://github.com/flintlib/flint#tag=v$pkgver
        https://github.com/flintlib/flint/commit/1b93e73d.patch)
sha256sums=('085708b2cc50a98fd0e25d910eba66dfbc257acf37ce188b473ef9f741a3c322'
            'd95327465594a0d52fa583347c64f8e79854fbee7a64527becbc15659af646ec')

prepare() {
  cd $pkgname
  patch -p1 -i ../1b93e73d.patch # Fix conflicts with complex.h
}

build() {
  cmake -B build -S $pkgname \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DHAS_FLAG_GCC_MARCH_NATIVE=OFF \
    -DIPO_SUPPORTED=FALSE
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}