# -*- 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
PortGroup           compiler_blacklist_versions 1.0

name                gstreamer010-gst-plugins-good
set my_name         gst-plugins-good
version             0.10.31
revision            16
description         \
    A set of good-quality plug-ins for GStreamer under GStreamer's preferred \
    license, LGPL.
long_description    \
    GStreamer Good Plug-ins is a set of plug-ins that GStreamer's developers \
    consider to have good quality code, correct functionality, and their \
    preferred license (LGPL for the plug-in code, LGPL or LGPL-compatible for \
    the supporting library).
maintainers         nomaintainer
categories          gnome
license             LGPL-2+
homepage            https://gstreamer.freedesktop.org/modules/${my_name}.html
master_sites        https://gstreamer.freedesktop.org/src/${my_name}/ gnome:sources/${my_name}/0.10/
use_bzip2           yes
distname            ${my_name}-${version}

checksums           rmd160  d9fed957ba26d055f7bccb9079bd43faae15b7e5 \
                    sha256  7e27840e40a7932ef2dc032d7201f9f41afcaf0b437daf5d1d44dc96d9e35ac6 \
                    size    3390378

depends_build   \
    port:gtk-doc \
    port:pkgconfig

depends_lib     \
    port:gstreamer010-gst-plugins-base \
    port:aalib \
    port:esound \
    port:flac \
    port:libgnome-keyring \
    path:lib/libcaca.dylib:libcaca \
    port:libcdio \
    port:libdv \
    path:include/turbojpeg.h:libjpeg-turbo \
    port:libshout2 \
    port:libsoup-2.4 \
    path:lib/libspeex.dylib:speex \
    port:taglib \
    port:wavpack

patchfiles  automake.patch po.patch

post-patch {
    # gst/goom is the only thing using this, and its mmx code is buggy (as of 0.10.31)
    reinplace "s|-DBUILD_MMX|-UBUILD_MMX|" ${worksrcpath}/gst/goom/Makefile.am
    reinplace "/^MMX_FILES/s|=.*|=|"       ${worksrcpath}/gst/goom/Makefile.am
}

use_autoreconf          yes
autoreconf.args         -fvi

configure.args-append   --disable-silent-rules \
                        --disable-gtk-doc \
                        --disable-schemas-install \
                        --with-default-videosink=ximagesink \
                        --disable-jack \
                        --disable-pulse
configure.env-append    "HAVE_CXX=yes"

platform darwin {
    if {${os.major} > 15} {
        # QuickTime framework removed in darwin 16 (Sierra)
        configure.args-append --disable-osx_video
    }
}

variant jack description {Enable Jack plugin} {
    depends_lib-append      port:jack
    configure.args-replace  --disable-jack \
                            --enable-jack
}

variant pulseaudio description {Enable PulseAudio plugin} {
    depends_lib-append      port:pulseaudio
    configure.args-replace  --disable-pulse \
                            --enable-pulse
}

default_variants    +pulseaudio

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}
} 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}
}

# SSE register return with SSE disabled
# <rdar://problem/9694837> - Fixed in Xcode 4.2 (clang 211.10.1)
compiler.blacklist  {clang < 211.10.1}

post-activate {
        system "export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` && \
                gconftool-2 --makefile-install-rule ${prefix}/etc/gconf/schemas/*.schemas"
}

livecheck.type  none