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

# O_CLOEXEC
legacysupport.newest_darwin_requires_legacy 10

boost.version       1.81

github.setup        facebookexperimental edencommon 2024.08.26.00 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            2
checksums           rmd160  fe50d40f6949bd0718b2d26036a97f0088b010d7 \
                    sha256  a18bf94d1df80705d05c004413ec172f8f86284f55095748d49afda8ca491cbe \
                    size    307426

categories          devel
license             BSD
maintainers         nomaintainer

description         Shared library for Watchman and Eden projects
long_description    {*}${description}

distname            ${name}-v${version}

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

depends_build-append \
                    port:cpptoml \
                    port:yarn \
                    port:gtest \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  port:bzip2 \
                    port:double-conversion \
                    port:fb303 \
                    port:fbthrift \
                    port:folly \
                    port:gflags \
                    port:google-glog \
                    port:libevent \
                    port:libsodium \
                    port:lz4 \
                    port:wangle \
                    port:zlib \
                    port:zstd \
                    port:${port_libfmt}

patchfiles          no-tests.diff \
                    patch-CMakeLists.diff

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

compiler.cxx_standard   2017
cmake.generator     Ninja

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

if {[string match *gcc* ${configure.compiler}]} {
    # ___atomic_fetch_add_8
    configure.ldflags-append  -latomic
}
