# -*- 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-sip
version             6.15.3
revision            0
epoch               1

categories-append   devel
platforms           {darwin any}
supported_archs     noarch
license             {GPL-2 GPL-3 PSF}
maintainers         {michaelld @michaelld} {reneeotten @reneeotten} openmaintainer

description         A Python bindings generator for C/C++ libraries
long_description    SIP is a tool that makes it very easy to create \
                    Python bindings for C and C++ libraries. It was \
                    originally developed to create PyQt, the Python \
                    bindings for the Qt toolkit, but can be used to \
                    create bindings for any C or C++ library.

homepage            https://www.riverbankcomputing.com/software/sip/

checksums           rmd160  8a801d22dd2aa5c917d3fdfe161a1acd969fa471 \
                    sha256  bb2516983f9f716d321e5157c00d0de0c12422eba73b8f43a44610a0f6622438 \
                    size    2590400

python.versions     310 311 312 313 314

if {${name} ne ${subport}} {
    depends_build-append \
                    port:py${python.version}-setuptools_scm

    depends_lib-append \
                    port:py${python.version}-packaging \
                    port:py${python.version}-setuptools \
                    port:py${python.version}-ply

    # 'ScopedName' object has no attribute 'replace'
    patchfiles-append \
                patch-ScopedName-str-conversion.diff \

    if {${python.version} < 311} {
        depends_lib-append \
                    port:py${python.version}-tomli
    }

    post-destroot {
        xinstall -d ${destroot}${prefix}/share/doc
        xinstall -m 0644 -W ${worksrcpath} LICENSE README.md \
              ${destroot}${prefix}/share/doc/${subport}
        system "${python.bin} ${python.libdir}/compileall.py ${destroot}${prefix}"
        system "${python.bin} -O ${python.libdir}/compileall.py ${destroot}${prefix}"
    }

    notes "${subport} is available under a PSF license with one addition: \n
    4. Licensee may not use SIP to generate Python bindings for any C or
       C++ library for which bindings are already provided by Riverbank. \n
GPL-2 or GPL-3 licenses are also available. For details see
${prefix}/share/doc/${subport}/LICENSE \[-GPL2 -GPL3\]\n\n"
}
