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

boost.version       1.81

github.setup        facebook wangle 2024.09.23.00 v
revision            0
checksums           rmd160  75e62ffdaa13acaf31f8f60d09455cb383bd30ea \
                    sha256  175178389db07600cdf1724fe96fd5c0bee6d80bdfdfd456b197a82cdda3962a \
                    size    409429

categories          devel
license             BSD
maintainers         nomaintainer

description         Wangle is a framework providing a set of common \
                    client/server abstractions for building services \
                    in a consistent, modular, and composable way.
long_description    {*}${description}

github.tarball_from releases
distname            ${name}-v${version}
extract.mkdir       yes

set port_libfmt     libfmt11
cmake.prefix_path-append \
                    ${prefix}/lib/${port_libfmt}/cmake

# doesn't build with libressl as of 2016-09-05
depends_lib-append  port:double-conversion \
                    port:fizz \
                    port:folly \
                    port:google-glog \
                    port:libevent \
                    port:libsodium \
                    port:zlib \
                    port:${port_libfmt}

cmake.source_dir    ${worksrcpath}/${name}

if {${os.platform} eq "darwin" && ${os.major} < 15} {
    patchfiles-append patch-tcp.diff
}

# Fix error: invalid output constraint '=@ccc' in asm
compiler.blacklist-append \
                    {clang < 1400}

compiler.cxx_standard   2017
cmake.generator     Ninja

configure.args-append \
                    -DBUILD_TESTS=OFF \
                    -DBUILD_SHARED_LIBS=ON

legacysupport.newest_darwin_requires_legacy 19

if {[string match *clang* ${configure.compiler}]} {
    # Don’t use libcxx with gcc.
    legacysupport.use_mp_libcxx yes
}

if {[string match *gcc* ${configure.compiler}]} {
    # ___atomic_fetch_sub_8, ___atomic_compare_exchange_8, ___atomic_store_8, ___atomic_load_8, ___atomic_fetch_add_8
    configure.ldflags-append \
                    -latomic
}
