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

# _strnlen
legacysupport.newest_darwin_requires_legacy 10

github.setup        eclipse-cyclonedds cyclonedds 0.10.5
github.tarball_from archive
revision            0
categories          devel
license             EPL-2
maintainers         {@sikmir disroot.org:sikmir} \
                    {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer
description         Eclipse Cyclone DDS project
long_description    {*}${description}
homepage            https://cyclonedds.io/

checksums           rmd160  f8ae32da57f51de102662bf77efcd161b1474f98 \
                    sha256  ec3ec898c52b02f939a969cd1a276e219420e5e8419b21cea276db35b4821848 \
                    size    6982715

depends_lib-append  path:lib/libssl.dylib:openssl

compiler.thread_local_storage yes

compiler.c_standard 1999

# https://github.com/eclipse-cyclonedds/cyclonedds/issues/2019
if {${os.platform} eq "darwin" && ${os.major} < 17} {
    patchfiles-append \
                    0001-threads.c-fix-for-pthread_threadid_np-on-macOS.patch \
                    0002-threads.c-provide-def-of-MAXTHREADNAMESIZE-when-unde.patch \
                    0003-ddsi_udp.c-use-ip_mreqn-where-it-is-actually-availab.patch \
                    0004-crypto_transform.c-fix-memcpy.patch \
                    0005-Fix-unresolved-symbol-on-big-endian-architectures.patch

    configure.args-append \
                    -DENABLE_IPV6=0 \
                    -DENABLE_SOURCE_SPECIFIC_MULTICAST=0

    platform powerpc {
        configure.args-append \
                    -DENABLE_LTO=OFF
    }
}
