# -*- 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.14.0
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  bc8563ba4d0721048fff7d89b4e87139a11ea3d6 \
                    sha256  20c086aba387707b34cf47fd96d1a978d01e2b95807e86f8aaa960081f163b28 \
                    size    2349267

python.versions     39 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"
}
