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

name            dbus-python
version         1.5.1
revision        0

maintainers     {mcalhoun @MarcusCalhoun-Lopez} openmaintainer
license         MIT {GPL-2+ AFL-2.1+}
categories      devel python
description     Python bindings libdbus
long_description \
    {*}${description}
homepage        https://www.freedesktop.org/wiki/Software/dbus/

if {${name} eq ${subport}} {
    PortGroup   stub 1.0

    revision    0
    supported_archs noarch
    platforms   any
}

set python_versions {310 311 312 313 314 315}

foreach python_version ${python_versions} {
    PortGroup   python 1.0

    categories-prepend  devel
    revision    0

    subport ${name}${python_version} {
        python.default_version ${python_version}
        python.pep517_backend meson

        checksums       rmd160  f3852c8be35b31e08ac2ab910cbc9556155bfc09 \
                        sha256  57423cf87d09b7d084f420b55b737fe654c33339b06df77945620d97795c6ac4 \
                        size    205464

        distname        dbus_python-${version}

        patchfiles  patch-pyproject.toml.diff

        build.args-append -Csetup-args=-Dpython=${python.bin}

        depends_build-append \
                        path:bin/pkg-config:pkgconfig \
                        port:patchelf

        depends_lib-append \
                        port:dbus \
                        port:gettext-runtime \
                        path:lib/pkgconfig/glib-2.0.pc:glib2

        # install examples
        post-destroot {
            set docdir ${prefix}/share/doc/${subport}
            set exdir ${docdir}/examples
            xinstall -d ${destroot}${exdir}
            xinstall -m 644 {*}[glob ${worksrcpath}/examples/*] ${destroot}${exdir}
        }
    }
}
