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

openssl.branch      1.1

github.setup        Determinant salticidae 0.3.1 v
revision            0
categories          devel net
license             BSD
maintainers         nomaintainer
description         ${name} is a minimal C++ asynchronous network library
long_description    {*}${description}
checksums           rmd160  fd022a52921ac7b728f251b3beabc51ee6004952 \
                    sha256  f62819106cd06f9d48145355a40811b78cff24a6fff6e45122875a7c50f893ed \
                    size    72969
github.tarball_from archive

compiler.c_standard     2011
compiler.cxx_standard   2014

# This does not work automatically.
# Notice, these should reflect the actual settings.
post-extract {
    move ${worksrcpath}/src/config.h.in ${worksrcpath}/include/salticidae/config.h
}
patchfiles-append   patch-config.diff

# https://github.com/Determinant/salticidae/pull/11
patchfiles-append   0001-ref.h-add-missing-cstdint.patch \
                    0002-util.h-add-missing-stdexcept.patch \
                    0003-test_msgnet_c.c-add-missing-salticidae-endian.h.patch

depends_lib-append  port:libevent \
                    path:lib/pkgconfig/libuv.pc:libuv

configure.args-append \
                    -DBUILD_SHARED=ON \
                    -DBUILD_TEST=ON \
                    -DSALTICIDAE_CBINDINGS=ON \
                    -DSALTICIDAE_DEBUG_LOG=OFF \
                    -DSALTICIDAE_MSG_STAT=ON \
                    -DSALTICIDAE_NOCHECK=OFF \
                    -DSALTICIDAE_NOCHECKSUM=OFF \
                    -DSALTICIDAE_NORMAL_LOG=ON

post-build {
    # For some reason the port tends to installed artifacts from patching.
    # Remove those.
    fs-traverse f ${worksrcpath}/include/${name} {
        if {[file isfile ${f}] && [file extension ${f}] == ".orig"} {
            delete ${f}
        }
    }
}

# https://github.com/Determinant/salticidae/issues/12
# test.run            yes
