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

# CLOCK_MONOTONIC, open_memstream
legacysupport.newest_darwin_requires_legacy 16

name                got
version             0.126
revision            0
distname            ${name}-portable-${version}
categories          devel
license             ISC
maintainers         {@artkiver gmail.com:artkiver} openmaintainer
description         Game of Trees (Got)
long_description    Game of Trees is a version control system which \
                    prioritizes ease of use and simplicity over flexibility. \
                    Got uses Git repositories to store versioned data. \
                    Git can be used for any functionality which has \
                    not yet been implemented in Got. It will always be \
                    possible to work with both Got and Git on the same \
                    repository.
homepage            https://gameoftrees.org/
#
# Thomas Adam, the upstream -portable maintainer has kindly created an official
# mirror here: https://xteddy.org/mirror/got-portable/
# Leaving the above FreeBSD mirror comment for the time being, to make sure
# that all is well with GitHub Actions Continuous Integration checks.
master_sites        https://xteddy.org/mirror/got-portable/
checksums           rmd160 bbcb7d3868b3954ba1787d0f89791007fbbfe1cf \
                    sha256 ad75dd883186af10a2f8ba25f5b4e6e9b2974d392f35c8e0a393b4ff134b482d \
                    size 2628997
# error: implicit declaration of function 'stravis' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
# https://trac.macports.org/ticket/71820
# backport vis.c wrapper from tmux
# can be removed as soon as it appears in upstream
if {${os.platform} eq "darwin" && ${os.major} < 22} {
    patchfiles-append   patch-vis-compat.diff
    # these dependencies are necessary to re-detect the headers
    depends_build-append \
                        port:autoconf \
                        port:automake
}
# memset_s() is not available on macOS <10.9, so
# emulate it with volatile memset().
if {${os.platform} eq "darwin" && ${os.major} < 13} {
    patchfiles-append   patch-use-volatile-memset.diff
}
# uses -std=gnu11 flag
compiler.c_standard 2011
# There is probably a smarter way to do this, see failed attempts at
# https://trac.macports.org/ticket/69827
# So, if you, like me, are using LibreSSL, remove the port:libretls line
# as that is only required for OpenSSL users to supply libtls which is
# already included with LibreSSL.
depends_lib-append  path:lib/libssl.dylib:openssl \
                    port:libretls \
                    port:ncurses \
                    port:ossp-uuid \
                    port:libevent
depends_build-append \
                    port:bison \
                    path:bin/pkg-config:pkgconfig
livecheck.type      regex
livecheck.url       https://gameoftrees.org/
livecheck.regex     "Game of Trees -portable (\\d+\\.\\d+)"
use_autoreconf      yes
    autoreconf.args     -fvi
configure.checks.implicit_function_declaration.whitelist-append strchr
