# -*- 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           legacysupport 1.1
PortGroup           makefile 1.0

# getline, mkdirat, openat
legacysupport.newest_darwin_requires_legacy 13

name                catgirl
version             2.2a
revision            0
categories          net
license             GPL-3+
license_noconflict  openssl libressl
maintainers         {@ryanakca debian.org:rak} \
                    {causal.agency:june @causal-agent} \
                    openmaintainer

description         a TLS-only terminal IRC client

long_description    catgirl is a TLS-only terminal IRC client. Its features \
                    include tab completion, split scrolling, URL detection, nick \
                    colouring topic diffing, and message filtering.

homepage            https://git.causal.agency/catgirl/
master_sites        ${homepage}snapshot/

checksums           rmd160  77a6187f371f9d181a1dd94ab0524564a1bd1a12 \
                    sha256  c6d760aaee134e052586def7a9103543f7281fde6531fbcb41086470794297c2 \
                    size    69660

# https://trac.macports.org/ticket/67214
# Modern explicit_bzero uses memset_s, which is not
# available on macOS <10.9.
if {${os.platform} eq "darwin" && ${os.major} < 13} {
    patchfiles          patch-explicit-bzero.diff
}

depends_build       path:bin/pkg-config:pkgconfig

depends_lib         path:lib/libtls.dylib:libretls \
                    port:ncurses

compiler.c_standard 2011

use_configure       yes
configure.post_args --enable-sandman \
                    --prefix=${prefix} \
                    --mandir=${prefix}/share/man

if {[string match *gcc* ${configure.compiler}]} {
    # Broken due to usage of blocks:
    # sandman.m: error: expected expression before '^' token
    configure.post_args-replace \
                    --enable-sandman --disable-sandman
}

test.run            yes
test.target         check

livecheck.type      regex
livecheck.regex     ${name}-(\\d+\.\\d+\[a-z\]?).tar.gz
