# -*- 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
# clock_gettime
legacysupport.newest_darwin_requires_legacy 16

github.setup        facebook mvfst 2024.09.23.00 v
revision            1
checksums           rmd160  3106ff31959c2a72fd360c178a918f249c67e922 \
                    sha256  08b6a49aada7d91fb7b51f2b4f306719c0947dbbec24a39c2969e6b7be153786 \
                    size    2012606
github.tarball_from archive

categories          devel net security
license             MIT
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer

description         Implementation of the QUIC transport protocol
long_description    {*}${description}

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

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

compiler.blacklist-append \
                    {clang < 1200}

compiler.cxx_standard   2017
cmake.generator     Ninja

# Dynamic libs fail to link: https://github.com/facebook/mvfst/issues/326
configure.args-append \
                    -DBUILD_TESTS=OFF \
                    -DBUILD_SHARED_LIBS=OFF

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

if {[string match *gcc* ${configure.compiler}] && ${configure.build_arch} in [list i386 ppc]} {
    configure.ldflags-append \
                    -latomic
}
