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

# _fmemopen, _open_memstream, _strnlen
legacysupport.newest_darwin_requires_legacy 16

github.setup        scandum tintin 2.02.60
revision            0
name                tintinxx
categories          net games
homepage            https://tintin.mudhalla.net
license             GPL-3
maintainers         {gmail.com:intact79 @intactio} \
                    openmaintainer
description         ncurses-based MUD client with triggers, aliases, colors
long_description    TinTin++, aka TT++, is a free Mud client for Windows, \
                    Linux and Mac OS X. A Windows/Vista port named WinTin++, \
                    using the PuTTY terminal, is available for those who do not \
                    use Cygwin (A Linux/Unix emulator for Windows). Besides \
                    MUDs (which are free online text games), TinTin++ can also \
                    be used as a client to play MUSH, MUCK, MOO, MU* or Rogue \
                    games, which are online text game variants. Connecting to \
                    a Linux server or a telnet BBS is possible as well.

checksums           rmd160  ca00c3c004d94e00d55cc5983f19cb68da43ef66 \
                    sha256  2d6abdbb807bd0c096e4c3f25a7e7db41686e8cd814b22f2a1b3c164ceb6002a \
                    size    2342685
github.tarball_from archive

worksrcdir          ${distname}/src

depends_lib-append  path:lib/pkgconfig/gnutls.pc:gnutls \
                    port:ncurses \
                    port:pcre2 \
                    port:zlib

configure.args      --includedir=${prefix}/include

# parse.c:464: error: ‘for’ loop initial declaration used outside C99 mode
# Using -std=c99 is not sufficient to fix it now:
# trigger.c:347: error: ‘struct listnode’ has no member named ‘val16’
compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2 {clang < 421}

# Honor CFLAGS:
build.cmd-prepend   CFLAGS="${configure.cflags} [get_canonical_archflags cc]"

destroot {
    xinstall -m 755 ${worksrcpath}/tt++ ${destroot}${prefix}/bin
    set doc_dest_dir ${destroot}${prefix}/share/doc/tintin++
    file mkdir $doc_dest_dir
    xinstall -m 644 {*}[glob ${workpath}/${distname}/docs/*] $doc_dest_dir
}
