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

github.setup    quassel quassel 0.13.1
revision        1

categories      irc
license         GPL-2 GPL-3
platforms       darwin
maintainers     {yan12125 @yan12125} openmaintainer
homepage        https://quassel-irc.org

checksums       rmd160  08557186caceb498f115c2cefac42bb09c148025 \
                sha256  2cca5457e69f0144d93c59ee7b559309d785601a358471ee67afec2d4a825388 \
                size    5453888

depends_lib-append \
                path:lib/libssl.dylib:openssl \
                port:zlib

qt5.depends_component qtmultimedia qtwebengine
qt5.depends_build_component qttools

cmake.out_of_source yes

configure.args  -DWANT_CORE=OFF \
                -DWANT_QTCLIENT=OFF \
                -DWANT_MONO=OFF \
                -DWITH_KDE=OFF \
                -DUSE_QT5=ON

if {${name} eq ${subport}} {
    description \
        Qt5 IRC client
    long_description \
        Quassel IRC is a modern, cross-platform IRC client. This port installs \
        the monolithic variant, which does not require a separate Quassel core.

    qt5.depends_runtime_component sqlite-plugin
    qt5.depends_component qtscript

    # QCA is needed for chat encryption (/keyx and friends)
    depends_lib-append port:qca-qt5-ossl

    configure.args-replace -DWANT_MONO=OFF -DWANT_MONO=ON

    destroot {
        copy "${build.dir}/Quassel.app" "${destroot}${applications_dir}"
    }
}

subport ${name}-client {
    description \
        Qt5 IRC client - client component
    long_description \
        Quassel IRC is a modern, cross-platform, distributed IRC client, \
        meaning that one (or multiple) client(s) can attach to and detach from \
        a central core - much like the popular combination of screen and a \
        text-based IRC client such as WeeChat, but graphical.

    configure.args-replace -DWANT_QTCLIENT=OFF -DWANT_QTCLIENT=ON

    destroot {
        copy "${build.dir}/Quassel Client.app" "${destroot}${applications_dir}"
    }
}