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

github.setup        eclipse paho.mqtt.c 1.3.15 v
github.tarball_from archive
revision            0
categories          net
maintainers         nomaintainer
license             EPL-2

description         Library to enable applications to connect to an MQTT broker to publish and receive messages.

long_description    MQTT and MQTT-SN are lightweight publish/subscribe \
                    messaging transports for TCP/IP and connectionless \
                    protocols (such as UDP) respectively. The Eclipse \
                    Paho project provides open source, mainly client side, \
                    implementations of MQTT and MQTT-SN in a variety of \
                    programming languages.

# clock_gettime
legacysupport.newest_darwin_requires_legacy 15

# https://github.com/eclipse/paho.mqtt.c/pull/1523
patchfiles-append   0001-Thread-fix-dispatch-usage-on-macOS.patch \
                    0002-Thread.c-fix-Availability-macros.patch

# We enable SSL so that the paho.mqtt.cpp library builds without issues
configure.args-append \
                    -DPAHO_BUILD_SHARED=ON \
                    -DPAHO_BUILD_STATIC=ON \
                    -DPAHO_ENABLE_TESTING=ON \
                    -DPAHO_WITH_SSL=ON

checksums           rmd160  f66d54bd4712445bb9da6ac4f85a858be516f640 \
                    sha256  60ce2cfdc146fcb81c621cb8b45874d2eb1d4693105d048f60e31b8f3468be90 \
                    size    1163925

configure.pre_args-replace \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

# FIXME: https://github.com/eclipse/paho.mqtt.c/issues/1524
test.run            yes
