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

PortSystem          1.0

name                dbusmenu-qt
categories          devel kde4 kde
maintainers         gmail.com:rjvbertin mk
license             GPL-2
description         expose menus on DBus
long_description    A DBus interface to expose notification area menus on DBus.

homepage            https://launchpad.net/libdbusmenu-qt

subport dbusmenu-qt5 {
    description-append \
                    \; Qt5 version
    long_description-append \
                    Qt5 version.
}

if {${subport} eq "${name}"} {
    PortGroup       kde4 1.1
    version         0.9.2
    revision        1
    master_sites    ${homepage}/trunk/${version}/+download/
    use_bzip2       yes
    checksums       rmd160  e50cbffbf57329a26742ddf32d0f54248fe672cc \
                    sha256  ae6c1cb6da3c683aefed39df3e859537a31d80caa04f3023315ff09e5e8919ec
    configure.args-append \
                    -DUSE_QT4=ON -DUSE_QT5=OFF
    post-destroot {
        # CMake is not installing all of the src headers; install them
        # manually here.  Destination directory already exists.
        foreach header [exec find ${worksrcpath}/src -name "*.h" | \
                            sed -e "s@${worksrcpath}/src/@@g" | \
                            grep -v "_p\.h"] {
            xinstall -m 644 -W ${worksrcpath}/src ${header} \
                ${destroot}${prefix}/include/${name}
        }
    }
    test.run        yes
} else {
    # this port is mostly used by KF5 ports so we indicate
    # that we'd prefer to use port:qt5-kde if it's available
    # (iow, installed, or installable because port:qt5 isn't).
    set qt5.prefer_kde 1
    platform darwin {
        PortGroup   cxx11 1.0
    }
    PortGroup       qt5 1.0
    PortGroup       cmake 1.0
    set cmake.out_of_source \
                    yes
    fetch.type      bzr
    bzr.url         lp:~dbusmenu-team/libdbusmenu-qt/trunk
    bzr.revision    271
    version         0.9.3.16.04
    distname        ldbusmenu-qt-0.9.3
    worksrcdir      ldbusmenu-qt-0.9.3

    # libdbusmenu-qt5 use QtCore, QtWidgets and QtDBus all of which
    # are provided by port:qt5-qtbase if port:qt5-kde isn't being used.
    # (port:qt5-qtbase is pulled in by default in that case).
    configure.args-append \
                    -DUSE_QT4=OFF -DUSE_QT5=ON
    test.run        no
}

platforms           darwin

# if {${os.platform} ne "linux"} {
#     depends_lib-append  port:qjson
# }

distname            lib${name}-${version}

if {![variant_isset docs]} {
    configure.args-append   -DWITH_DOC=Off
}

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     "Latest version is (.*)"