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

# O_CLOEXEC
legacysupport.newest_darwin_requires_legacy 10

boost.version       1.81

github.setup        facebook proxygen 2024.09.23.00 v
revision            0
categories          devel
license             BSD
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
description         Collection of C++ HTTP libraries including an easy to use HTTP server
long_description    This project comprises the core C++ HTTP abstractions used at Facebook. \
                    Internally, it is used as the basis for building many HTTP servers, proxies and clients. \
                    This release focuses on the common HTTP abstractions and our simple HTTPServer framework. \
                    Future releases will provide simple client APIs as well. The framework supports \
                    HTTP/1.1, SPDY/3, SPDY/3.1, HTTP/2 and HTTP/3. The goal is to provide a simple, \
                    performant and modern C++ HTTP library.
checksums           rmd160  7062380176df5e0aaf50bd3d67ade5d09af99962 \
                    sha256  a0f45a93b5a04d878fff48b20c35af3bcd4916b88ddd998897a4114233970da0 \
                    size    1198308
github.tarball_from archive

patchfiles          patch-tcpinfo.diff

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

set py_ver          3.11
set py_ver_nodot    [string map {. {}} ${py_ver}]
depends_build-append \
                    port:gperf \
                    port:python${py_ver_nodot}
depends_lib-append  port:folly \
                    port:fizz \
                    port:mvfst \
                    port:wangle \
                    port:zlib \
                    port:zstd \
                    port:${port_libfmt}

compiler.blacklist-append \
                    {clang < 1200}

compiler.cxx_standard 2017

# Due to: https://github.com/facebook/mvfst/issues/326
configure.args-append \
                    -DPROXYGEN_PYTHON=${prefix}/bin/python${py_ver} \
                    -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}]} {
    # ___atomic_compare_exchange_8, ___atomic_store_8, ___atomic_load_8
    configure.ldflags-append \
                    -latomic
}

github.livecheck.branch main
