# -*- 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

# also update py-pycryptodome
name                py-pycryptodomex
version             3.23.0
revision            1

license             BSD
maintainers         nomaintainer

description         Cryptographic library for Python
long_description    {*}${description}

homepage            https://www.pycryptodome.org

checksums           rmd160  13604e1e7371688b65b5bfefc637a83dc61ab667 \
                    sha256  71909758f010c82bc99b0abf4ea12012c98962fbf0583c2164f8b84533c2e4da \
                    size    4922157

python.versions     27 310 311 312 313 314

if {${subport} ne ${name}} {
    PortGroup       legacysupport 1.1

    # posix_memalign
    legacysupport.newest_darwin_requires_legacy 9

    platform darwin {
        # src/ec_ws.c: error: ‘for’ loop initial declaration used outside C99 mode
        # For 3.12 python PG should do this, but does not; and 3.13+ use modern gcc.
        if {${python.version} < 313} {
            configure.cflags-append \
                    -std=c99
        }
        if {${os.major} < 10} {
            configure.cflags-append \
                    -isystem${prefix}/include/LegacySupport -DHAVE_POSIX_MEMALIGN \
                    -Wl,-lMacportsLegacySupport
        }
        build.cmd-prepend \
                    CFLAGS="${configure.cflags} [get_canonical_archflags cc]"
    }

    test.run        yes
    python.test_framework
    test.cmd        ${python.bin} setup.py test
}
