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

# version 6.0 dropped support for Python 3.5 and earlier
deprecated.eol_version yes
livecheck.type      none

name                py27-pyobjc
python.rootname     pyobjc-core

categories-append   devel
license             MIT
maintainers         nomaintainer
platforms           darwin
description         bidirectional bridge between python and Objective C
long_description    The PyObjC project aims to provide a bridge between \
                    the Python and Objective-C programming languages. The \
                    bridge is intended to be fully bidirectional, allowing \
                    the Python programmer to take full advantage of the \
                    power provided by various Objective-C based toolkits \
                    and the Objective-C programmer transparent access to \
                    Python based functionality.
homepage            https://pyobjc.readthedocs.io

version             5.3
revision            6

checksums           rmd160 6c2f3aa3d444bc5d577a3b59a116241374787587 \
                    sha256 07554c7fb02a980a2a648f567441cd0bf031a15a7afe284cda197bd4d8b443e3 \
                    size   811139

python.versions     27

subport py35-pyobjc {
    python.versions 35
}

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

patchfiles          patch-method-signature.m.diff \
                    patch-setup.py.diff

post-patch {
    reinplace "s|use-system-libffi = 0|\\
use-system-libffi = 1\\
deployment-target = ${macosx_deployment_target}\\
|" ${worksrcpath}/setup.cfg
    }

    if {${configure.sdkroot} eq ""} {
        set sdkroot "/"
    } else {
        set sdkroot ${configure.sdkroot}
    }

    build.env-append    SDKROOT=${sdkroot}
    destroot.env-append SDKROOT=${sdkroot}

    platform darwin 8 {
        depends_lib
        pre-fetch {
            ui_error "${subport} @${version} requires Mac OS X 10.5 or later"
            return -code error "incompatible Mac OS X version"
        }
    }

    post-destroot {
        xinstall -m 0644 -W ${worksrcpath} HISTORIC.txt License.txt README.txt \
            ${destroot}${prefix}/share/doc/${subport}
        delete ${destroot}${prefix}/share/doc/${subport}/examples
        copy ${worksrcpath}/Examples \
            ${destroot}${prefix}/share/doc/${subport}/examples
    }

if {${configure.sdkroot} eq ""} {
    set sdkroot "/"
} else {
    set sdkroot ${configure.sdkroot}
}

build.env-append \
                SDKROOT=${sdkroot}
destroot.env-append \
                SDKROOT=${sdkroot}

platform darwin 8 {
    depends_lib
    pre-fetch {
        ui_error "${subport} @${version} requires Mac OS X 10.5 or later"
        return -code error "incompatible Mac OS X version"
    }
}

post-destroot {
    xinstall -m 0644 -W ${worksrcpath} HISTORIC.txt License.txt README.txt \
        ${destroot}${prefix}/share/doc/${subport}
    delete ${destroot}${prefix}/share/doc/${subport}/examples
    copy ${worksrcpath}/Examples \
        ${destroot}${prefix}/share/doc/${subport}/examples
}
