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

github.setup        apache qpid-proton 0.39.0
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0

description         Qpid Proton is a high-performance, lightweight AMQP \
                    1.0 messaging library.
long_description    Qpid Proton is a high-performance, lightweight messaging library. It can \
                    be used in the widest range of messaging applications, including brokers, \
                    client libraries, routers, bridges, proxies, and more. Proton makes it \
                    trivial to integrate with the AMQP 1.0 ecosystem from any platform, \
                    environment, or language.
categories          net
license             Apache-2
maintainers         {unifiedsoftworx.com:roddie.kieley @roddiekieley} openmaintainer
platforms           darwin freebsd linux
homepage            https://qpid.apache.org

checksums           rmd160  6b731bc0fc86f5fd93391161ee9adca6b6be87c1 \
                    sha256  663c58656a15a758ea6ecc8c139dcf9c1f9b4e11bb4ee871a1d63cddca8a9ae0 \
                    size    1494645

depends_build-append \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  port:jsoncpp \
                    path:lib/pkgconfig/libuv.pc:libuv

cmake.build_type    RelWithDebInfo

compiler.c_standard    1999
compiler.cxx_standard  2011

# Enabling lto may break the build, avoid it by default.
configure.args-append \
                    -DBUILD_GO=OFF \
                    -DBUILD_EXAMPLES=OFF \
                    -DBUILD_PERL=OFF \
                    -DBUILD_PYTHON=OFF \
                    -DBUILD_RUBY=OFF \
                    -DENABLE_JSONCPP=ON \
                    -DENABLE_LINKTIME_OPTIMIZATION=OFF \
                    -DENABLE_OPENTELEMETRYCPP=OFF \
                    -DENABLE_VALGRIND=OFF \
                    -DLIB_SUFFIX="" \
                    -DSASL_IMPL=none \
                    -DSSL_IMPL=none

# Revert a breakage caused by this commit:
# https://github.com/apache/qpid-proton/commit/6f2fdeb633575114c5f92f1387a21eba992b422a
patchfiles-append   patch-fix-macOS-build.diff

test.cmd            ${filespath}/runtests.sh
test.run            yes                                                 

default_variants    +openssl

variant openssl description {With built-in support for OpenSSL} {
    PortGroup       openssl 1.0

    configure.args-replace \
                    -DSSL_IMPL=none -DSSL_IMPL=openssl
}

variant swig description {With built-in support for SWIG so the bindings can be built} {
    configure.args-replace -DBUILD_PERL=OFF -DBUILD_PERL=ON
    configure.args-replace -DBUILD_PYTHON=OFF -DBUILD_PYTHON=ON
    configure.args-replace -DBUILD_GO=OFF -DBUILD_GO=ON
    configure.args-replace -DBUILD_RUBY=OFF -DBUILD_RUBY=ON

    depends_lib-append      port:swig \
                            port:swig-perl \
                            port:swig-python \
                            port:swig-go \
                            port:swig-ruby
}
