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

# https://bugzilla.gnome.org/show_bug.cgi?id=636134
PortGroup           muniversal 1.0

name                gstreamer010-gst-plugins-bad
set my_name         gst-plugins-bad
version             0.10.23
revision            29
description         A set of plug-ins for GStreamer that need more quality.
long_description    \
    GStreamer Bad Plug-ins is a set of plug-ins that aren't up to par compared \
    to the rest. They might be close to being good quality, but they're missing \
    something - be it a good code review, some documentation, a set of tests, a \
    real live maintainer, or some actual wide use.
license             GPL LGPL
maintainers         nomaintainer
categories          gnome
homepage            https://gstreamer.freedesktop.org/modules/${my_name}.html
master_sites        https://gstreamer.freedesktop.org/src/${my_name}/
distname            ${my_name}-${version}
use_bzip2           yes

checksums           md5     fcb09798114461955260e4d940db5987 \
                    sha1    46208d7bcebaac31310e2a884cc840c51034781a \
                    rmd160  3a837843b8aa941ff7c81b90d37930ccb1ddb0be

depends_build       port:pkgconfig

# libvpx 1.7.0 now provides a shared library
# move dependency from depends_build to depends_lib

depends_lib         port:gstreamer010-gst-plugins-base \
                    port:XviD \
                    port:curl \
                    port:dirac \
                    port:faad2 \
                    port:jasper \
                    path:lib/pkgconfig/libass.pc:libass \
                    port:libdc1394 \
                    port:libdca \
                    port:libdvdread port:libdvdnav \
                    port:libexif \
                    port:libglade2 \
                    port:libmms \
                    port:libmodplug \
                    port:libmpcdec \
                    port:libmusicbrainz2 \
                    port:libopus \
                    port:libpng \
                    path:lib/pkgconfig/librsvg-2.0.pc:librsvg \
                    port:libsndfile \
                    path:lib/pkgconfig/vpx.pc:libvpx \
                    port:openal-soft \
                    port:soundtouch \
                    port:spandsp-devel \
                    port:neon \
                    port:rtmpdump \
                    port:schroedinger

patchfiles          openal.patch \
                    modplug.patch \
                    po.patch \
                    objcflags.patch \
                    patch-libvpx-1.40.diff

#
# could depend on tons for multimedia stuff +variants
# the following ports are available but don't configure
# and/or build correctly
#
# port:mjpegtools (mpeg2enc mplex build fails) need to disable mpeg2enc mplex explicitly in case mjpegtools is installed
# port:faac has a restrictive license, disable faac plugin by default
# port:libsdl (builds but sdlvideosink is broken)
# port:slv2 (builds but lv2 plugin fails to load and slv2 is not universal) disable lv2 explicitly in case slv2 is installed
# port:swfdec (configure wants pkg-config swfdec-0.3, we have swfdec-0.8)
#

configure.args      --disable-silent-rules \
                    --disable-faac \
                    --disable-quicktime \
                    --disable-mpeg2enc \
                    --disable-mplex \
                    --disable-opencv \
                    --disable-lv2 \
                    --disable-sdl \
                    --disable-sdltest \
                    --disable-schemas-compile \
                    --enable-experimental \
                    --enable-static

platform darwin {
    # port:soundtouch (fails on autoreconf on darwin 8 & 9, see #27533) disable soundtouch on these platforms
    if { ${os.major} < 10 } {
        depends_lib-delete port:soundtouch
        configure.args-append --disable-soundtouch
        # as of 1.6.0 libvpx only supports darwin 10 or later
        depends_build-delete path:lib/pkgconfig/vpx.pc:libvpx
        configure.args-append --disable-vp8
    }
    # plugin applemedia fails on Sierra (darwin 16) due to removal of QTKit
    if {${os.major} > 15} {
        configure.args-append   --disable-apple_media
    }
}

#
# X11 is only used for examples that are not installed
# so just disable examples and drop the deprecated +no_x11 variant
#

configure.args-append       --disable-examples

configure.cppflags-append   "-L${prefix}/lib"
configure.cflags-append     -funroll-loops -fstrict-aliasing
configure.env-append        "HAVE_CXX=yes"

use_autoreconf      yes
autoreconf.args     -fvi
# needs gtkdocize to autoreconf
depends_build-append    port:gtk-doc

variant faac description {Enable faac AAC plugin} {
    depends_lib-append      port:faac
    configure.args-delete   --disable-faac
    notes-append "Use of the +faac variant may affect licensing due to the restrictive license of port faac itself."
}

# osxvideosrc is disabled by configure on 64 bit archs so disable if universal variant is set

if {${universal_possible} && [variant_isset universal]} {
    set merger_host(x86_64) x86_64-apple-${os.platform}${os.major}
    set merger_host(i386) i686-apple-${os.platform}${os.major}
    set merger_configure_args(x86_64) --build=x86_64-apple-${os.platform}${os.major}
    set merger_configure_args(i386) --build=i686-apple-${os.platform}${os.major}
    configure.args-append \
        --disable-osx_video
} elseif {${build_arch} eq "i386"} {
    configure.args-append \
        --host=i686-apple-${os.platform}${os.major} \
        --build=i686-apple-${os.platform}${os.major}
} elseif {${build_arch} eq "x86_64"} {
    configure.args-append \
        --host=${build_arch}-apple-${os.platform}${os.major} \
        --build=${build_arch}-apple-${os.platform}${os.major}
}

post-activate {
    system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
}

livecheck.type      none
