# -*- 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-shapely
version             2.2.0
revision            0
python.versions     310 311 312 313 314 315
categories-append   devel
maintainers         {snc @nerdling} openmaintainer
license             BSD
homepage            https://shapely.readthedocs.io/en/stable/
description         Shapely is a Python package for manipulation \
                    and analysis of 2D geospatial geometries

long_description    Shapely is a Python package for manipulation and \
                    analysis of 2D geospatial geometries. It is based on \
                    GEOS (http://geos.refractions.net). Shapely 1.0 is not \
                    concerned with data formats or coordinate reference \
                    systems.

checksums           rmd160  b77eb712e99a23beef7c74b189152de93594e7b5 \
                    sha256  e8865e553d874a1ec4a032057ea81fca9def37b188cd8fb550af3b3480b3f88c \
                    size    380326

if {${name} ne ${subport}} {
    if {${python.version} == 310} {
        version             2.1.2
        revision            0
        checksums           rmd160  1db5c2910eff20f0dbb6894a04e0dff9d89182b6 \
                            sha256  2ed4ecb28320a433db18a5bf029986aa8afcfd740745e78847e330d5d94922a9 \
                            size    315489
    } else {
        python.pep517_backend   meson

        depends_build-append    path:bin/pkg-config:pkgconfig

        build.env-append        PKG_CONFIG_PATH=${python.pkgd}/numpy/_core/lib/pkgconfig

        test.run                yes
        test.dir                ${destroot}${python.pkgd}
    }

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

    depends_lib-append      port:geos \
                            port:py${python.version}-numpy

    build.env-append        CYTHON=${prefix}/bin/cython-${python.branch}

    # pycore_frame.h:134: error: ‘for’ loop initial declaration used outside C99 mode
    # Since it depends on py-numpy, which requires modern gcc, avoid Xcode one here.
    compiler.blacklist-append \
                            *gcc-4.0 *gcc-4.2
}
