# -*- 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-gl
set my_name         gst-plugins-gl
version             0.10.3
revision            8
description         This is gst-plugins, a set of plug-ins for GStreamer.
long_description    The GStreamer OpenGL module provides helper libraries, base \
                    classes and elements for integrating with OpenGL and using \
                    it to perform video display and processing. 

maintainers         nomaintainer
categories          gnome
platforms           darwin
license             GPL-2+ LGPL-2+
homepage            https://gstreamer.freedesktop.org/modules/${my_name}.html
master_sites        https://gstreamer.freedesktop.org/src/${my_name}/
distname            ${my_name}-${version}

depends_build \
    port:pkgconfig
depends_lib	\
    port:glew \
    port:gstreamer010-gst-plugins-base \
    port:libpng

use_bzip2           yes

checksums           rmd160  7375ad5f4831267d398ff579ce5a96e4020ff128 \
                    sha256  48340b6a4b8abce16344a7bc33e74a94fdcce4f57ef6342cdf2f941c429bf210

patchfiles          objcflags.patch \
                    patch-configure.ac.diff

use_autoreconf  yes
autoreconf.args -fvi

# gst-plugins-gl sees libsdl if it is present and uses it to build examples which 
# fail to build as of 0.10.3
configure.args-append   --disable-silent-rules \
                        --disable-examples

post-extract {
    reinplace "s|-flat_namespace -undefined suppress|-undefined define_a_way|g" \
        ${worksrcpath}/configure
}

post-patch {
    # Hack to get -arch flags used
    reinplace "/libgstgl_@GST_MAJORMINOR@_la_OBJCFLAGS =/s/=/= \$(CFLAGS)/" \
        ${worksrcpath}/gst-libs/gst/gl/Makefile.am 
}

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

livecheck.type      none