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

github.setup        pyside PySide 1.2.4
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
name                py-pyside
revision            0
set                 qt.ver 4.8
python.versions     39 310 311
categories-append   devel
maintainers         nomaintainer
license             LGPL
description         LGPL-licensed Python bindings for Qt
long_description    The PySide project provides LGPL-licensed Python bindings \
                    for the Qt cross-platform application and UI framework. \
                    PySide Qt bindings allow both free open source and \
                    proprietary software development and ultimately aim to \
                    support all of the platforms as Qt itself.

checksums           rmd160  7a13c41e91011849ad22f57dc50d2826a500a6b5 \
                    sha256  412133c4f37697296e4631aa5a9435336727df3ec0835b0b5eef536e0ace0a86 \
                    size    3905032

if {${name} ne ${subport}} {
    PortGroup qt4 1.0
    PortGroup cmake 1.1

    patchfiles      patch-cmakepkgconfig.diff
    if {${python.version} >= 311} {
        patchfiles-append \
                    patch-py311-compatibility.diff
    }
    depends_lib-append port:py${python.version}-shiboken
    use_configure   yes
    configure.env-append CMAKE_PREFIX_PATH=${python.prefix}
    # build.cmd must be set before configure.args is changed
    #    (see https://github.com/macports/macports-ports/commit/63c9c8e6e312c8e36603cb118d94f995aa8a6e67)
    build.cmd       make
    configure.args-append -DBUILD_TESTS:BOOL=FALSE \
                          -DSITE_PACKAGE=${python.pkgd} \
                          -DPYTHONBRANCH=${python.branch} \
                          -DPYTHONPREFIX=${python.prefix}
    build.target    all
    destroot.cmd    make
    destroot.destdir DESTDIR=${destroot}
    post-destroot {
        move ${destroot}${prefix}/include/PySide ${destroot}${prefix}/include/PySide-${python.branch}
        move ${destroot}${prefix}/share/PySide ${destroot}${prefix}/share/PySide-${python.branch}
        move ${destroot}${prefix}/lib/cmake ${destroot}${python.prefix}/lib/cmake
        move ${destroot}${prefix}/lib/pkgconfig ${destroot}${python.prefix}/lib/pkgconfig
    }

    livecheck.type      none
}
