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

github.setup        BelledonneCommunications bctoolbox 5.2.16
github.tarball_from archive
revision            0

categories          devel multimedia
license             GPL-3
maintainers         {judaew @judaew} openmaintainer

description         \
    A library written in C that allows you to create and run audio and video \
    streams. Utilities library used by Belledonne Communications softwares \
    like belle-sip, mediastreamer2 and liblinphone.
long_description    {*}${description}

checksums           rmd160 bbd9a9dd4318820299d5fec1b7819c2483745940 \
                    sha256 1869d04fadaa20c8f07d6781dfbd65aef01812fd681eb2961f7f0300f699031f \
                    size 194676

if {${os.major} <= 10} {
    known_fail      yes
    pre-fetch {
        ui_error "${name} requires the AVFoundation framework"
        ui_error "AVFoundation available from macOS 10.7 and later"
        return -code error "incompatible OS X version"
    }
}

depends_build-append \
                    port:bcunit
depends_lib         port:libiconv \
                    port:mbedtls

patchfiles          patch-fix-Frameworks-path.diff

compiler.cxx_standard \
                    2011

configure.args-append \
                    -DENABLE_SHARED=YES \
                    -DENABLE_STATIC=NO \
                    -DENABLE_TESTS=NO \
                    -DENABLE_TESTS_COMPONENT=NO

# This workaround is needed for "ortp" to work correctly. Ideally,
# BelledonneCommunications projects need a less hardcoded way to locate
# frameworks libs.
post-destroot {
    ln -s ${frameworks_dir}/bctoolbox.framework \
        ${destroot}${prefix}/lib/bctoolbox.framework
}

github.livecheck.regex  {([0-9.]+)}
