# -*- 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-pyside-tools
version             0.2.15
revision            1

categories-append   devel
maintainers         nomaintainer
license             LGPL
description         Tools for developing PySide applications
long_description    {*}${description}
homepage            https://contribute.qt-project.org/wiki/PySide
master_sites        https://github.com/PySide/Tools/archive/

checksums           sha256  8a7fe786b19c5b2b4380aff0a9590b3129fad4a0f6f3df1f39593d79b01a9f74 \
                    rmd160  481654815c8fcdd5b805a155bc2ea9bfcbced9d4 \
                    size    78989
distname            ${version}
worksrcdir          Tools-${version}

python.versions     39 310 311

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

    patch {
        reinplace "s|find_package(Shiboken 1.1.1 REQUIRED)|set(SHIBOKEN_PYTHON_INTERPRETER \"${python.bin}\")|g" ${worksrcpath}/CMakeLists.txt
        reinplace "s|find_package(PySide 1.0.6 REQUIRED)||g" ${worksrcpath}/CMakeLists.txt
    }
    depends_lib-append port:py${python.version}-pyside port:python${python.version}
    use_configure   yes
    # 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 \
                    -DPYTHON_EXECUTABLE=${python.bin} \
                    -DSITE_PACKAGE=${python.pkgd}
    build.target    all
    destroot.cmd    make
    destroot.destdir DESTDIR=${destroot}
    post-destroot {
        move ${destroot}${prefix}/bin/pyside-lupdate ${destroot}${prefix}/bin/pyside-lupdate-${python.branch}
        move ${destroot}${prefix}/bin/pyside-rcc ${destroot}${prefix}/bin/pyside-rcc-${python.branch}
        move ${destroot}${prefix}/bin/pyside-uic ${destroot}${prefix}/bin/pyside-uic-${python.branch}
        move ${destroot}${prefix}/share/man/man1/pyside-lupdate.1 ${destroot}${prefix}/share/man/man1/pyside-lupdate-${python.branch}.1
        move ${destroot}${prefix}/share/man/man1/pyside-rcc.1 ${destroot}${prefix}/share/man/man1/pyside-rcc-${python.branch}.1
        move ${destroot}${prefix}/share/man/man1/pyside-uic.1 ${destroot}${prefix}/share/man/man1/pyside-uic-${python.branch}.1
    }
} else {
    livecheck.type      regex
    livecheck.url       http://qt-project.org/wiki/PySideDownloads
    livecheck.regex     ${python.rootname}-(\[0-9.\]+)\\.tar\\.gz
}
