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

github.setup        librats librats 2.1.3
revision            0
categories          devel net p2p
maintainers         nomaintainer
license             MIT
description         P2P native library for big networks
long_description    High-performance, light-weight {*}${description}.
checksums           rmd160  5f15a4e6a60e2e95dfe8769815da4013a955f98f \
                    sha256  332e535c75d0da7c25b39fe93e189b82729a25117d0742e7463e80f61560fce4 \
                    size    1257714
github.tarball_from archive

compiler.cxx_standard   2017

# FIXME: enabling dynamic lib disables static:
# https://github.com/librats/librats/issues/27

configure.args-append   -DRATS_BINDINGS=ON \
                        -DRATS_BUILD_EXAMPLES=ON \
                        -DRATS_BUILD_TESTS=OFF \
                        -DRATS_SEARCH_FEATURES=ON \
                        -DRATS_SHARED_LIBRARY=ON \
                        -DRATS_STATIC_LIBRARY=ON \
                        -DRATS_STORAGE=OFF

post-destroot {
    xinstall -m 755 ${cmake.build_dir}/bin/rats-client ${destroot}${prefix}/bin/
    system "install_name_tool -change @rpath/librats.1.dylib ${prefix}/lib/librats.dylib ${destroot}${prefix}/bin/rats-client"
}
