#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=mpfr
_pkgver=4.2.0
_patchver=9
pkgrel=01
pkgver=${_pkgver}.p${_patchver}
#pkgver=$_pkgver
pkgdesc='Multiple-precision floating-point library'
url='https://www.mpfr.org/'
depends=('glibc' 'gmp')
makedepends=('autoconf-archive' 'automake')
#options=(debug)  ### uncomment here for debug pkg
source=(https://ftp.gnu.org/gnu/mpfr/mpfr-${_pkgver}.tar.xz{,.sig}
        tsprintf.patch::https://gitlab.inria.fr/mpfr/mpfr/-/commit/5172494c09718ffcb7ef1f19b3b211e3bce8781a.patch
        patches.diff) # wget https://www.mpfr.org/mpfr-${_pkgver}/allpatches -O patches.diff
##  options=(debug)  ## uncomment this to produce the debug pkg

prepare() {
  cd $pkgname-${_pkgver}

  patch -Np1 < ../tsprintf.patch
  # sed -i '/check_vsprintf ("+1,234,567/d' tests/tsprintf.c
  autoreconf -fiv
}

build() {
  cd $pkgname-${_pkgver}
  ./configure --prefix=/usr \
    --enable-thread-safe \
    --enable-shared
  make
}

check() {
  cd $pkgname-${_pkgver}
  make check
  make check-exported-symbols
}

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

#---- arch license gpg-key & sha256sums ----

arch=(x86_64)

license=('GPL3' 'LGPL3')

validpgpkeys=('07F3DBBECC1A39605078094D980C197698C3739D'
              'A534BE3F83E241D918280AEB5831D11A0D4DB02A') # Vincent Lefevre <vincent@vinc17.net>

sha256sums=(06a378df13501248c1b2db5aa977a2c8126ae849a9d9b7be2546fb4a9c26d993  # mpfr-4.2.0.tar.xz
	8151b7ef1b84c6384a08b05e007fa42da877a18528c44206b64d78b9baedcb7a  # mpfr-4.2.0.tar.xz.sig
	c05587045fb064853bfd5d2953f95bbc9f3630787a9c45e77e6509f3ebabbcd3  # tsprintf.patch
	06da0b2a56e365f7e74ac241926f61d2574a0754548ff8116e9ddee0dabacda0) # patches.diff

b2sums=('dd88ae3a6a910ad8faeb791b49c3b1085de5d0d4c49c637c124bf4d9bc79fb621d0d1d69e07d0642b9b678f6d355a5830d083dfd189e1e91d0e04c970c10bd64'
        'SKIP'
        'SKIP'
        'a1f85dba4f0d69c64a76cd2287edc4f05f109a809b28a2b004f40564bed33aaa01bcbca02062a5c0634ef18bc39427679ef9e278e8f1f31aa01fae9912489e86')


##  f86a4f6ea9fd8eb7d2551213da97de541a0434ba660009d8608039e76d9a3984  mpfr-4.2.0.p9-01-x86_64.pkg.tar.lz
