# -*- 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
# O_CLOEXEC
legacysupport.newest_darwin_requires_legacy 10

github.setup        facebook proxygen 2026.07.27.00 v
revision            0
categories          devel
license             BSD
maintainers         {@barracuda156 macos-powerpc.org:barracuda}
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  4ca264545cda419b3ff5fbde5e3b6e3e06830347 \
                    sha256  5e7fff8df12cd95fa84d6d7e0eca80c08ef3fe1a74c245e709b9059371b62647 \
                    size    1808324
github.tarball_from archive

# Fix macOS compat:
patchfiles          patch-tcpinfo.diff

# Fix broken linking:
patchfiles-append   patch-fix-monolith-httpserver-link.diff

# hq(93915) malloc: *** error for object 0xa04da754: pointer being freed was not allocated
legacysupport.redirect_bins hq proxygen_curl proxygen_echo proxygen_h3datagram_client \
                            proxygen_httperf2 proxygen_proxy proxygen_push proxygen_static

set libfmt_v        12
cmake.prefix_path-append \
                    ${prefix}/lib/libfmt${libfmt_v}/cmake

set py_ver          3.14
set py_ver_nodot    [string map {. {}} ${py_ver}]
depends_build-append \
                    port:gperf \
                    port:python${py_ver_nodot}
depends_lib-append  port:c-ares \
                    port:folly \
                    port:fizz \
                    port:libfmt${libfmt_v} \
                    port:libsodium \
                    port:mvfst \
                    port:wangle \
                    port:zlib \
                    port:zstd

compiler.blacklist-append \
                    {clang < 1200}
# As of 2025.08.04.00, still uses C++17:
compiler.cxx_standard 2017

configure.args-append \
                    -DBUILD_SHARED_LIBS=ON \
                    -DPROXYGEN_PYTHON=${prefix}/bin/python${py_ver}

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 arm i386 ppc]} {
    # ___atomic_compare_exchange_8, ___atomic_store_8, ___atomic_load_8
    configure.ldflags-append \
                    -latomic
}

github.livecheck.branch main
