# -*- 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 wdt ee01f20850558d5c6a0e1fc3cf9d12cd1702c18a
version             2026.07.26
revision            0
categories          net
license             BSD
maintainers         {@barracuda156 macos-powerpc.org:barracuda}

description         Warp speed Data Transfer (WDT)
long_description    {*}${description}

checksums           rmd160  cbfe8a70f8d43656860c394b10a9f3a5b6583068 \
                    sha256  dc63ebaf8aa6546430cf59ab4f7fef62d29fd47c474fe629979df8b79a439cf7 \
                    size    260233
github.tarball_from archive

# https://github.com/facebook/wdt/issues/213
post-extract {
    ln -sf ${worksrcdir} ${workpath}/${name}
}

patchfiles          0001-CMakeLists-drop-hardcoded-x86-flag.patch \
                    0002-use-cxx20.patch

cmake.generator     Ninja

set libfmt_v        12

depends_lib-append  port:double-conversion \
                    port:folly \
                    port:gflags \
                    port:google-glog \
                    port:libfmt${libfmt_v}

# The build requires fmt, but does not actually bother to add it...
cmake.prefix_path-append \
                    ${prefix}/lib/libfmt${libfmt_v}/cmake
configure.cppflags-append \
                    -I${prefix}/include/libfmt${libfmt_v}

# Unstream requirement is wrong, it needs C++20.
compiler.cxx_standard   2020

# Building dylib would require more patching and not needed anyway.
# https://github.com/facebook/wdt/issues/243
configure.args-append \
                    -DBUILD_SHARED_LIBS=OFF \
                    -DWDT_USE_SYSTEM_FOLLY=ON

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