# $Id: Portfile 141003 2015-10-07 19:31:19Z michaelld@macports.org $

PortSystem 1.0
PortGroup python 1.0
PortGroup qt4 1.0
PortGroup cmake 1.0
cmake.out_of_source yes

set realname        pyside-tools
name                py-${realname}
version             0.2.15
revision            1
python.versions     27 34 35
python.default_version 27
categories-append   devel
maintainers         openmaintainer mmoll
license             LGPL
description         Tools for developing PySide applications
long_description    ${description}
homepage            http://qt-project.org/wiki/PySide
platforms           darwin
license             LGPL
master_sites        https://github.com/PySide/Tools/archive/

checksums           md5     e542b9536bd9d35599ede225c9311cc8 \
                    rmd160  481654815c8fcdd5b805a155bc2ea9bfcbced9d4 \
                    sha1    b668d15e8d67e25a653db5abf8f542802e2ee2dd
distname            ${version}
worksrcdir          Tools-${version}

if {${name} ne ${subport}} {
    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
    configure.args-append -DBUILD_TESTS:BOOL=FALSE \
                    -DPYTHON_EXECUTABLE=${python.bin} \
                    -DSITE_PACKAGE=${python.pkgd}
    build.cmd       make
    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
    }
}

if {${name} eq ${subport}} {
    livecheck.type      regex
    livecheck.url       http://qt-project.org/wiki/PySideDownloads
    livecheck.regex     ${realname}-(\[0-9.\]+)\\.tar\\.gz
} else {
    livecheck.type      none
}
