# -*- 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 qterminal 0.6.0
    revision        0
    checksums       rmd160  1807982a9f1973c5e81c8bd591c6d1a422b87bea \
                    sha256  db1f82b274798d2439cb87030aac5c47dda3323e8389d576f048a0cf3f05a9c6 \
                    size    116865
    github.tarball_from archive

    patchfiles-append \
                    patch-0.6.0-config.h.diff \
                    patch-0.6.0-fix-icns-path.diff

    depends_lib-append \
                    port:desktop-file-utils

    configure.args-append \
                    -DAPPLEBUNDLE=ON \
                    -DUSE_QT5=OFF \
                    -DUSE_SYSTEM_QXT=OFF

    post-activate {
        system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
    }
} else {
    PortGroup       qt5 1.0

    qt5.min_version 5.15

    qt5.depends_build_component \
                    qttools

    github.setup    lxqt qterminal 1.4.0
    revision        0
    checksums       rmd160  0ab4a9e3d2a83fd0f1e5b6561d64e19a8d27c54d \
                    sha256  8313326ac3ef728924271cd60a8f79e17e5e755a6bfa4e4419a4b7a53528659f \
                    size    219500
    github.tarball_from releases
    use_xz          yes

    depends_build-append \
                    port:lxqt-build-tools
}

categories          sysutils
maintainers         nomaintainer
license             {GPL-2 GPL-3}

description         A lightweight Qt terminal emulator based on QTermWidget

long_description    {*}${description}

depends_lib-append  port:qtermwidget

if {${os.platform} ne "darwin"} {
    depends_lib-append \
                    port:xorg-libX11
}

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

post-destroot {
    move ${destroot}${prefix}/qterminal.app \
         ${destroot}${applications_dir}/qterminal.app
}
