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

#NOTE: requires C++14

github.setup        mujx nheko 0.5.2 v
categories          net chat
platforms           darwin
license             GPL-3
maintainers         {@scarface-one gmail.com:sireeshkodali1}
description         A matrix chat client
long_description    Nheko is a native desktop matrix \
                    chat client. It aims to be more \
                    like a chat app and less like an \
                    IRC client

checksums           rmd160  be32b10c51960a1d27dd4fa410f82e5dd1e98534 \
                    sha256  d7c189efd04ffa032b46c5eb24cf076ade5ddec3434b937ec9d0de952bb8f79b \
                    size    4526124

#C++14 was first fully supported by clang 3.4 aka apple clang 503.0.38
# But TLS was first implemented by apple clang 800.0.38
compiler.blacklist-append {clang < 800.0.38}

if {(${os.major} < 16)} {
    pre-fetch {
        ui_error "${name} ${version} requires features in the macOS 10.12 or greater SDK to run"
        return -code error "incompatible OS X version"
    }
}

configure.cxxflags-append -fno-sized-deallocation

depends_build-append port:lmdbxx \
                    port:matrix-structs \
                    port:mtxclient \
                    port:olm \
                    port:tweeny

depends_lib-append  port:boost \
                    port:fontconfig \
                    port:libsodium \
                    port:lmdb \
                    port:spdlog

qt5.depends_component qtbase \
                    qtmacextras \
                    qtmultimedia \
                    qtsvg \
                    qttools

destroot {
    copy ${workpath}/build/nheko.app ${destroot}${applications_dir}/Nheko.app
}