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

# strndup, clock_gettime
legacysupport.newest_darwin_requires_legacy 15

github.setup        Softmotions iwnet 1.1.0 v
revision            0
epoch               1
categories          net devel
license             MIT
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
description         Pure C asynchronous HTTP framework
long_description    {*}${description} providing websockets client/server, SSL, \
                    reverse proxy and routing.
# Due to: https://github.com/Softmotions/iwnet/issues/5
platforms           {darwin > 9}
checksums           rmd160  8d1154d44478b8481ba9731f5f05f117f81c509b \
                    sha256  d27ecd03729749ec306d98ddd336327efca31e9a98d1c46deeaa780700664c15 \
                    size    830721
github.tarball_from archive

depends_lib-append  port:iowow

compiler.c_standard 2011

configure.args-append \
                    -DBUILD_SHARED_LIBS=ON \
                    -DBUILD_TESTS:BOOL=ON

# https://github.com/Softmotions/iwnet/issues/6
if {[string match *gcc* ${configure.compiler}] && ${configure.build_arch} in [list arm i386 ppc]} {
    configure.ldflags-append \
                    -latomic
}

# Only some tests run, while other freeze, at least on PowerPC.
# Script-based ones wonʼt succeed due to a broken sed syntax:
# https://github.com/Softmotions/iwnet/issues/7
test.run            yes
