# -*- 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               openssl 1.0
PortGroup               muniversal 1.0
PortGroup               github 1.0

github.setup            cisco libsrtp 2.6.0 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
revision                0
categories              net devel
maintainers             {db.org:aeh @alfredh} openmaintainer
description             Secure Real-time Transport Protocol (SRTP)
long_description        The libSRTP library is an open-source implementation of \
                        the Secure Real-time Transport Protocol (SRTP).
homepage                https://github.com/cisco/libsrtp
license                 BSD

checksums               rmd160  136d87b370e6f63be09d330445d19faea0cb9af8 \
                        sha256  0e8f802370b62cadb66d43acec7d21226bc28cbe14c31ab0e6a350bd142f2730 \
                        size    641109

depends_build-append    port:pkgconfig
depends_lib-append      port:zlib \
                        port:libpcap

configure.args-append   --enable-openssl

if {${subport} ne "libsrtp1"} {
    # datatypes.c: error: ‘for’ loop initial declaration used outside C99 mode
    configure.cflags-append \
                        -std=c99
}

build.target            shared_library

subport libsrtp1 {
    github.setup        cisco libsrtp 1.6.0 v
    # Change github.tarball_from to 'releases' or 'archive' next update
    github.tarball_from tarball
    revision            1

    # The subport is not compatible with 1.1 API, fails with error: field ‘ctx’ has incomplete type
    # Related info: https://github.com/dun/munge/commit/d913c154425217f89b827e86686b777c9b3d0cf4
    openssl.branch      1.0

    checksums           rmd160  50230cfced7e8ec66b525881f167b81a66e59da3 \
                        sha256  3132460eecb32c4fb87b8addba51eccda65acbb391229e4fff319725e562ae83 \
                        size    1648893

    platform powerpc {
        configure.args-append   CPU_RISC=1
    }
}
