# -*- 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

name                znc
version             1.8.2
revision            4
categories          irc
platforms           darwin
maintainers         nomaintainer
license             Apache-2
description         An advanced IRC bouncer
long_description    ZNC is an IRC bounce/proxy with many advanced features \
                    like detaching, multiple users, multiple clients per \
                    user, channel/query playback buffers, SSL, IPv6, \
                    transparent DCC bouncing, C++/Perl/Tcl module support, \
                    party line, and Web administration.

homepage            https://znc.in/
master_sites        ${homepage}releases/archive/

checksums           rmd160  33d05a35c47e8212d40b9878ec816ae29521a93a \
                    sha256  ff238aae3f2ae0e44e683c4aee17dc8e4fdd261ca9379d83b48a7d422488de0d \
                    size    2101215

universal_variant   no

depends_lib         path:lib/libssl.dylib:openssl port:tcl port:perl5 path:lib/pkgconfig/icu-uc.pc:icu

configure.args      --disable-python \
                    --enable-perl \
                    --enable-tcl \
                    --with-tcl=${prefix}/lib \
                    ac_cv_path_BREW=

compiler.cxx_standard   2011
if {[string match *clang* ${configure.cxx}] && ${configure.cxx_stdlib} ne ""} {
    configure.ldflags-append -stdlib=${configure.cxx_stdlib}
}

# Disable silent rules
build.args-append   V=1

set python_versions {38 39 310 311 312}

# declare all +python* variants, with conflicts
foreach pyver ${python_versions} {
    # Conflicting python versions
    set other_python_versions {}
    foreach other_pyver ${python_versions} {
        if {${other_pyver} ne ${pyver}} {
            if {${other_pyver} ni ${other_python_versions}} {
                lappend other_python_versions python${other_pyver}
            }
        }
    }

    set python_branch "[string index ${pyver} 0].[string range ${pyver} 1 end]"

    variant python${pyver} conflicts {*}${other_python_versions} description "Enable Python modules, using ${python_branch}" {
        configure.args-replace --disable-python --enable-python
        depends_build-append port:pkgconfig
        depends_lib-append port:python${pyver}
        configure.pkg_config_path ${frameworks_dir}/Python.framework/Versions/${python_branch}/lib/pkgconfig/
    }
}

# Fails regardless due to gtest
test.run            no

livecheck.type      regex
livecheck.url       ${homepage}releases/
livecheck.regex     ${name}-(\[0-9.\]+)${extract.suffix}
