# $Id: Portfile 52292 2009-06-13 17:02:19Z vinc17@macports.org $

PortSystem 1.0

# Although mpfr builds without a custom universal variant,
# it is not the same as builing the archs differently
# due to the variable HAVE_LDOUBLE_IEEE_EXT_LITTLE.
PortGroup  muniversal 1.0

name                mpfr
set base_version    2.4.1
set patch_level     4
version             ${base_version}-p${patch_level}
revision            1
categories          devel math
platforms           darwin
maintainers         vinc17

description     C library for multiple-precision floating-point computations
long_description \
    MPFR is a portable C library for arbitrary-precision binary \
    floating-point computation with correct rounding, based on the GMP \
    multiple-precision library. The computation is both efficient and \
    has a well-defined semantics. It copies the good ideas from the \
    ANSI/IEEE-754 standard for fixed-precision floating-point arithmetic.

distname        ${name}-${base_version}
homepage        http://www.mpfr.org/
master_sites    http://www.mpfr.org/${distname}/

use_lzma            yes
depends_build       bin:unlzma:lzmautils

checksums \
    patch01 \
        md5     106f37855e1c4a5e54da5613e49e3a38 \
        sha1    82eb4c34685b6d655d33e0dfcea003248a8967d9 \
        rmd160  a68a65e3ba90fabb8d634d69b172a32162488661 \
    patch02 \
        md5     a440bcd882d8868e9b47a0082f8877a2 \
        sha1    49ae9b7d23d5ba1013687a99d28ac2c1d674af55 \
        rmd160  d1ff268cae4d0659d805d7e22bc5c8e245c86587 \
    patch03 \
        md5     394ac993308d6bfd0e88ce4b79e0e2e0 \
        sha1    282066b0104ec41931126acb57e6ef6140dcacbd \
        rmd160  97b3cc3b761addf812420433d658ba400e0f8d4b \
    patch04 \
        md5     5b22dd389f5724594398686b5db072eb \
        sha1    a32e20029351eb34cee941d22566044693a91b93 \
        rmd160  209acd4081774b4e63d58700dc8355e66238ac8d \
    [suffix ${distname}] \
        md5     22402995cf2496d8faea42c8da02ce1f \
        sha1    6145947361fac880b87976e21e28fab12ccf4881 \
        rmd160  e848db799fc3b6a4681de3b38df8809c2369f266

use_parallel_build  yes

depends_lib     port:gmp

dist_subdir     ${name}/${base_version}

patch_sites     ${master_sites}
patch.args      -p1

for {set i 1} {${i} <= ${patch_level}} {incr i} {
    patchfiles-append patch[format %02d ${i}]
}

test.run        yes
test.target     check

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${name}
    file mkdir ${docdir}
    xinstall -m 644 -v -W ${worksrcpath} \
      AUTHORS BUGS COPYING.LIB FAQ.html NEWS TODO ${docdir}
}

livecheck.url    http://www.mpfr.org/mpfr-current/
livecheck.regex  "mpfr-(\\d+(?:\\.\\d+)*)${extract.suffix}"
