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

if {${os.platform} eq "darwin" && ${os.major} < 11} {
    PortGroup       qt4 1.0

    github.setup    lxqt qtermwidget 0.6.0
    revision        0
    checksums       rmd160  a0d55d58eff0d1f9ce8bc9ec916b3576f3ae22fa \
                    sha256  0b2d59221881fdf3f47d3417e2edcbbe1435873754135e697df9f7f661d7620b \
                    size    196611
    github.tarball_from archive

    patchfiles-append \
                    patch-qt4-plugins-path.diff

    configure.args-append \
                    -DUSE_QT5=OFF

    # Despite claims to the contrary, CMakeLists fail to handle these correctly:
    post-destroot {
        set dylib ${prefix}/lib/libqtermwidget4.0.dylib
        set plugin ${qt_plugins_dir}/designer/libqtermwidget4plugin.dylib
        system "install_name_tool -id ${dylib} ${destroot}${dylib}"
        system "install_name_tool -id ${plugin} ${destroot}${plugin}"
        system "install_name_tool -change libqtermwidget4.0.dylib ${dylib} ${destroot}${plugin}"
    }
} else {
    PortGroup       qt5 1.0

    qt5.min_version 5.15

    qt5.depends_build_component \
                    qttools

    github.setup    lxqt qtermwidget 1.4.0
    revision        0
    checksums       rmd160  f61e9691ff29d9521d7b82049fb018db3a960d17 \
                    sha256  e7253065f74fa056843c95f9543e690bcaf7a03647ef5e02379eec4eb162026b \
                    size    190320
    github.tarball_from releases
    use_xz          yes

    depends_build-append \
                    port:lxqt-build-tools

    compiler.cxx_standard \
                    2011
}

categories          devel
maintainers         nomaintainer
license             {BSD GPL-2+ LGPL-2+ public-domain}

description         The terminal widget for QTerminal

long_description    QTermWidget is an open-source project originally \
                    based on the KDE4 Konsole application, but it took \
                    its own direction later on. The main goal of this \
                    project is to provide a unicode-enabled, \
                    embeddable Qt widget for using as a built-in \
                    console (or terminal emulation widget).

# openssl is linked by QtNetwork only, and qtermwidget does not use QtNetwork
license_noconflict  openssl
