# -*- 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
PortGroup           deprecated 1.0
PortGroup           meson 1.0

# py-gobject3 version 3.38.0 dropped support for Python 2.7 (EOL 2020-01-01)
deprecated.eol_version yes
livecheck.type      none

name                py27-gobject3
set my_name         pygobject
version             3.36.1
revision            3
set branch          [join [lrange [split ${version} .] 0 1] .]
categories-append   gnome
license             LGPL-2.1+
maintainers         nomaintainer
platforms           darwin
description         Python bindings for GObject, version 3

long_description    PyGObject is a Python dynamic module that enables developers to use the \
                    power of GObject, which is part of the GNOME platform.

homepage            https://pygobject.readthedocs.io/
master_sites        gnome:sources/${my_name}/${branch}/
distname            ${my_name}-${version}
use_xz              yes

checksums           rmd160  841eb0d9a4fb25d0c27dc8d25b0e38f2bbc3f387 \
                    sha256  d1bf42802d1cec113b5adaa0e7bf7f3745b44521dc2163588d276d5cd61d718f \
                    size    556568

python.versions     27

depends_build-append \
                    port:pkgconfig

depends_lib-append  path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:libffi \
                    port:py${python.version}-cairo \
                    path:lib/pkgconfig/gobject-introspection-1.0.pc:gobject-introspection

compiler.c_standard 2011

use_configure       yes

configure.pkg_config_path \
                    ${python.prefix}/lib/pkgconfig

configure.pre_args  --prefix='${python.prefix}'
configure.args      -Dpython=${python.bin}
configure.cppflags-append \
                    -I${python.prefix}/include

destroot.cmd        ${build.cmd}

# uses g-ir-scanner, which uses $CC from env
if {${universal_possible} && [variant_isset universal]} {
    foreach arch ${configure.universal_archs} {
        lappend merger_build_env(${arch})  "CC=${configure.cc} -arch ${arch}"
        lappend merger_destroot_env(${arch})  "CC=${configure.cc} -arch ${arch}"
    }
} else {
    build.env-append       "CC=${configure.cc} ${configure.cc_archflags}"
    destroot.env-append    "CC=${configure.cc} ${configure.cc_archflags}"
}
