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

name                gstreamer010-gst-plugins-base
set my_name         gst-plugins-base
version             0.10.36
revision            3
description         This is gst-plugins, a set of plug-ins for GStreamer.
long_description    ${description}
maintainers         nomaintainer
categories          gnome
platforms           darwin
license             LGPL-2+
homepage            https://gstreamer.freedesktop.org/modules/${my_name}.html

use_bzip2           yes
master_sites        gnome:sources/${my_name}/0.10/ https://gstreamer.freedesktop.org/src/${my_name}/
distname            ${my_name}-${version}

checksums           rmd160  b601372b3a1c04de63f69ba350c5010c99dbc6ae \
                    sha256  2cd3b0fa8e9b595db8f514ef7c2bdbcd639a0d63d154c00f8c9b609321f49976

depends_build \
    port:pkgconfig

depends_lib \
    port:gstreamer010 \
    port:orc \
    path:lib/pkgconfig/pango.pc:pango \
    port:libxml2 \
    port:iso-codes \
    port:zlib

gobject_introspection no

configure.args-append \
    --enable-experimental \
    --disable-silent-rules \
    --disable-examples \
    --disable-libvisual \
    --disable-gst_v4l \
    --disable-alsa \
    --disable-cdparanoia \
    --disable-gnome_vfs \
    --disable-ogg \
    --disable-vorbis \
    --disable-theora \
    --disable-ivorbis \
    --without-x \
    --disable-x \
    --disable-xvideo \
    --disable-xshm

post-destroot {
    # Workaround a bug in the empathy build which tries to create this file if it has
    # a timestamp older than .../audio.h
    system "touch ${destroot}${prefix}/include/gstreamer-0.10/gst/audio/audio-enumtypes.h"
}

variant x11 {
    depends_lib-append port:xorg-libice \
                       port:xorg-libsm \
                       port:xorg-libXv

    configure.args-delete --without-x --disable-x --disable-xvideo --disable-xshm
}

variant ogg description {Build with support for libogg, libvorbis, libtheora} {
    depends_lib-append    port:libogg port:libvorbis port:libtheora
    configure.args-delete --disable-ogg --disable-vorbis --disable-theora
}

# users of qt4-x11, which depends on gst-plugins-base but has no use for its
# deeper gnome-related dependencies may wish to disable this variant
variant gnome_vfs description {Enable gnome-vfs support} {
    depends_lib-append    port:gnome-vfs
    configure.args-delete --disable-gnome_vfs
}

variant examples description {Build example programs} {
    PortGroup qt4 1.0
    depends_lib-append path:lib/pkgconfig/gtk+-2.0.pc:gtk2
    configure.args-delete --disable-examples
}

#
# current cdparanoia port (cdparanoia III 10.2) appears to not be API compatible
# with gst-plugins-base.  See #19843.
# disable by default until this is rectified.
#

variant cdparanoia description {Enable (currently broken) cdparanoia plugin} {
    depends_lib-append port:cdparanoia
    configure.args-delete --disable-cdparanoia
}

default_variants +gnome_vfs +ogg +x11

#-fgcse (from -O2) causes build failures, but -O2 -fno-gcse doesn't seem to work
if {[string match "*gcc-4.2" ${configure.compiler}]} {
    lappend merger_configure_cflags(i386) -O1 -fexpensive-optimizations
    if {(!${universal_possible} || ![variant_isset universal]) && ${build_arch} eq "i386"} {
        configure.cflags-delete -O2
        configure.cflags-append -O1 -fexpensive-optimizations
    }
}

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
