# -*- 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-ffmpeg
set my_name         gst-ffmpeg
version             0.10.13
revision            1
description         This is gst-ffmpeg, a set of plug-ins for GStreamer.
long_description    {*}${description}
maintainers         nomaintainer
categories          gnome
license             GPL-2+
homepage            https://www.gnome.org/
master_sites        https://gstreamer.freedesktop.org/src/${my_name}/
distname            ${my_name}-${version}
use_bzip2           yes

checksums           rmd160  3e5e3d44302665214cfde8a908b633f8d0f70d31 \
                    sha256  76fca05b08e00134e3cb92fa347507f42cbd48ddb08ed3343a912def187fbb62

patchfiles          patch-gst-libs_ext_libav_configure.diff \
                    patch-orc-0.4.30-fixes.diff \
                    patch-configure.ac.diff

post-patch {
    reinplace "s|%%CONFIGURE.CC%%|${configure.cc}|g" ${worksrcpath}/gst-libs/ext/libav/configure
}

depends_build       port:pkgconfig

depends_lib         port:gstreamer010-gst-plugins-base

use_autoreconf      yes
autoreconf.args     -fvi

# This will cause the installed ffmpeg headers to be used, remove it.
configure.cppflags-delete -I${prefix}/include

# Disable silent rules
build.args-append   V=1

if {[lsearch [get_canonical_archs] i386] != -1} {
    # clang-3.1 hits https://trac.macports.org/ticket/30137 (<rdar://problem/11542429>)
    # clang-139 hits https://trac.macports.org/ticket/38141
    compiler.blacklist-append {clang < 422.1.7}

    # https://trac.macports.org/ticket/37802
    compiler.blacklist-append gcc-4.2 apple-gcc-4.2 llvm-gcc-4.2 macports-llvm-gcc-4.2
}

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_host(ppc64) powerpc64-apple-${os.platform}${os.major}
    set merger_host(ppc) powerpc-apple-${os.platform}${os.major}
    set merger_configure_args(x86_64) "--build=x86_64-apple-${os.platform}${os.major} --with-ffmpeg-extra-configure=\"--cc=${configure.cc} --arch=x86_64\""
    set merger_configure_args(i386) "--build=i686-apple-${os.platform}${os.major} --with-ffmpeg-extra-configure=\"--cc=${configure.cc} --arch=i686\""
    set merger_configure_args(ppc) "--build=powerpc-apple-${os.platform}${os.major} --with-ffmpeg-extra-configure=\"--cc=${configure.cc} --arch=ppc\""
    set merger_configure_args(ppc64) "--build=powerpc64-apple-${os.platform}${os.major} --with-ffmpeg-extra-configure=\"--cc=${configure.cc} --arch=ppc64\""
} elseif {${build_arch} eq "i386"} {
    configure.args-append \
        --host=i686-apple-${os.platform}${os.major} \
        --build=i686-apple-${os.platform}${os.major} \
        --with-ffmpeg-extra-configure="--cc=${configure.cc} --arch=i686"
} else {
    configure.args-append \
        --host=${os.arch}-apple-${os.platform}${os.major} \
        --build=${os.arch}-apple-${os.platform}${os.major} \
        --with-ffmpeg-extra-configure="--cc=${configure.cc} --arch=${os.arch}"
}

#
# embedded ffmpeg code requires gmake 3.81 to build properly
#
platform darwin 8 {
    depends_build-append port:gmake
    build.cmd            gmake
}

livecheck.type      none
