pkgname=mpfr
_pkgver=4.2.2
_patchver=0
if (( _patchver == 0 )); then
  pkgver=$_pkgver
else
  pkgver=$_pkgver.p$_patchver
fi
pkgdesc='Multiple-precision floating-point library'
homepage='https://www.mpfr.org/'
# NOTE: download potentially existing patches from upstream:
# `curl patches.diff -o https://www.mpfr.org/mpfr-${_pkgver}/allpatches`
sources=("${pkgname}-${_pkgver}.tar.xz")
urls=("https://ftp.gnu.org/gnu/${pkgname}/${sources[0]}")
md5sums=("7c32c39b8b6e3ae85f25156228156061")


src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  ./configure --prefix=/usr        \
              --disable-static     \
              --enable-thread-safe \
              --docdir=/usr/share/doc/mpfr-${_pkgver}
  make
  make html
}

src_check() {
  make check
}

src_install() {
  make DESTDIR="$pkgdir" install
  make DESTDIR="$pkgdir" install-html
}
