# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           python 1.0

name                py-bigfloat
version             0.4.0
revision            0

categories-append   math
license             LGPL-3
maintainers         {reneeotten @reneeotten} openmaintainer

description         Arbitrary-precision correctly-rounded floating-point arithmetic, via MPFR.
long_description    {*}${description}

homepage            https://github.com/mdickinson/bigfloat

checksums           rmd160  cf8fda5b51bea79861d4635b30f32080493c7b7c \
                    sha256  58b96bde872aca5989d13d82eba3acf2aa1b94e22117dd72a16ba5911b0c0cb8 \
                    size    258208

python.versions     39 310 311 312 313

if {${name} ne ${subport}} {
    # make sure that the files are cythonized
    post-extract {
        file delete ${worksrcpath}/mpfr.c ${worksrcpath}/PKG-INFO
    }

    depends_build-append \
                    port:py${python.version}-cython

    depends_lib-append \
                    port:py${python.version}-six \
                    port:gmp \
                    port:mpfr

    # pycore_frame.h: error: ‘for’ loop initial declaration used outside C99 mode
    if {${python.version} == 312} {
        build.cmd-prepend   CFLAGS=-std=c99
    }

    test.run        yes
    python.test_framework unittest

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} COPYING.LESSER COPYING \
           INSTALL.rst README.rst CHANGELOG.rst ${destroot}${docdir}
        xinstall -m 0644 {*}[glob ${worksrcpath}/examples/*] \
            ${destroot}${prefix}/share/doc/${subport}/examples
    }
}
