# -*- 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.61
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  4c1e2fc6c3b1d0471c6fe3c1c4a4edcc2d177a06 \
                    sha256  aa85517d04ea4129171aa093876729c9ce7dfa4fc894f890bc96283c7b3d0e24 \
                    size    2343351
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
}
