# -*- 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
# $Id: Portfile 92008 2012-04-15 23:23:43Z jeremyhu@macports.org $

PortSystem          1.0

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

name                gst-plugins-gl
version             0.10.2
revision            4
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         rmstonecipher openmaintainer
categories          gnome
platforms           darwin
homepage            http://gstreamer.freedesktop.org/modules/${name}.html
master_sites        http://gstreamer.freedesktop.org/src/${name}/

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

use_bzip2           yes

checksums           md5     878fe4199be1c94f8aa2f7f23891cc95 \
                    sha1    bbeb7ebd46a9098bb32fe871ecb1891b58aff26e \
                    rmd160  1a6ca7f2922a2dbccc6a6106d56e0b28c0fb42e0

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.2
configure.args-append   --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 {[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} == "i386"} {
    configure.args-append \
        --host=i686-apple-${os.platform}${os.major} \
        --build=i686-apple-${os.platform}${os.major}
} elseif {${build_arch} == "x86_64"} {
    configure.args-append \
        --host=${build_arch}-apple-${os.platform}${os.major} \
        --build=${build_arch}-apple-${os.platform}${os.major}
}

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
