# -*- 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.51
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  0ac369d25748dd63d3844384a19995d4c74508f1 \
                    sha256  7f6a4dc1a25be00633dc7d96689db13e0717cd6daf2104d88e5c4be89e6974d2 \
                    size    2301549
github.tarball_from archive

worksrcdir          ${distname}/src

depends_lib-append  port:ncurses \
                    port:pcre

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
}
