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

# getline
legacysupport.newest_darwin_requires_legacy 10

github.setup        MisterTea EternalTerminal 7.0.0 et-v
revision            0
name                et
categories          net
license             Apache-2
maintainers         {l2dy @l2dy} openmaintainer
description         remote shell that automatically reconnects without interrupting the session
long_description    Eternal Terminal (ET) is a {*}${description}.

checksums           rmd160  1c06aa6a1b447c84bc52524b6a61b8ab8bd00289 \
                    sha256  3580962861589c0b69efd6b385ff92ad8fdf688c91d1a0edc1a83278205e28e8 \
                    size    29020443
github.tarball_from archive

installs_libs       no

patchfiles          patch-src-base-Headers.hpp.diff \
                    patch-CMakeLists.diff

depends_build-append \
                    port:bash-completion \
                    port:cxxopts \
                    port:nlohmann-json \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  port:abseil \
                    port:cpp-httplib \
                    port:libsodium \
                    path:lib/libssl.dylib:openssl \
                    port:protobuf \
                    port:zlib \
                    port:zstd

depends_test-append port:catch2

compiler.cxx_standard \
                    2017

configure.args-append \
                    -DBUILD_TESTING:BOOL=OFF \
                    -DDISABLE_SENTRY:BOOL=ON \
                    -DDISABLE_TELEMETRY:BOOL=ON \
                    -DDISABLE_VCPKG:BOOL=ON

if {(${os.platform} eq "darwin" && ${os.major} < 19) \
    && ${configure.cxx_stdlib} eq "libc++"} {
    PortGroup       boost 1.0

}

variant cxx17 conflicts cxx20 description "Use C++17" {
    require_active_variants abseil cxx17
    require_active_variants protobuf cxx17
}

variant cxx20 conflicts cxx17 description "Use C++20" {
    require_active_variants abseil cxx20
    require_active_variants protobuf cxx20
    compiler.cxx_standard   2020
    configure.args-append \
                    -DCMAKE_CXX_STANDARD=20
}

if ![variant_isset cxx17] {
    default_variants +cxx20
}
