# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 90199 2012-02-25 21:41:38Z rmstonecipher@macports.org $

PortSystem      1.0

name            totem
version         2.30.2
revision        5
set branch      [join [lrange [split ${version} .] 0 1] .]
categories      gnome
# also has an exception allowing use of non-GPL-compatible plugins
license         GPL-2+
maintainers     devans openmaintainer
description     Official movie player of the GNOME desktop environment
long_description \
        Totem is based on GStreamer. It features a \
        playlist, a full-screen mode, seek and volume controls, \
        as well as keyboard navigation. It comes with added \
        functionality such as: \
            * Video thumbnailer for the file manager \
            * Nautilus properties tab \
            * Mozilla (Firefox) plugin to view movies inside your \
              browser (in development) \
            * Webcam utility (in development)

homepage        http://live.gnome.org/Totem
platforms       darwin
master_sites    gnome:sources/${name}/${branch}/

checksums       md5     4ff658d6178fdb57f310c54daf596de7 \
                sha1    78b59e0e61a620718b2e87c82046ea1f1fe4607d \
                rmd160  78ab8d58eb8e0349190042c34434c3ce8ac8f3e0

use_bzip2       yes

patchfiles      patch-configure.diff \
                patch-src-plugins-totem-python-module.c.diff \
                patch-bindings-python-totem.override.diff \
                patch-browser-plugin-totemPlugin.cpp.diff

depends_build   port:pkgconfig \
                port:intltool \
                port:gnome-doc-utils \
                port:gtk-doc

depends_lib     port:gconf \
                port:libgdata \
                port:totem-pl-parser \
                port:xorg-libXtst \
                port:xorg-libXxf86vm \
                port:gst-plugins-base \
                port:nautilus

depends_run     port:gnome-settings-daemon \
                port:gst-plugins-good \
                port:gst-plugins-bad \
                port:gst-plugins-ugly

# gst-ffmpeg provides optional decoders, but it is not +universal
if {! [variant_isset universal]} {
	depends_run-append port:gst-ffmpeg
}

configure.args  --with-plugins="thumbnail ontop gromit media-player-keys properties sidebar-test skipto youtube pythonconsole dbus-service" \
                --disable-static \
                --enable-browser-plugins \
                --enable-easy-codec-installation \
                --enable-nautilus \
                --disable-vala \
                --disable-schemas-install \
                --disable-scrollkeeper \
                --x-includes=${prefix}/include \
                --x-libraries=${prefix}/lib \
                BROWSER_PLUGIN_DIR=${prefix}/lib/nsplugins

variant python25 conflicts python26 python27 description {Use python 2.5} {
    configure.python          ${prefix}/bin/python2.5
    depends_lib-append        port:py25-gtk
    set python_framework      ${frameworks_dir}/Python.framework/Versions/2.5
    configure.pkg_config_path ${python_framework}/lib/pkgconfig
    configure.env              PATH=${python_framework}/bin:$env(PATH)
}

variant python26 conflicts python25 python27 description {Use python 2.6} {
    configure.python          ${prefix}/bin/python2.6
    depends_lib-append        port:py26-gtk
    set python_framework      ${frameworks_dir}/Python.framework/Versions/2.6
    configure.pkg_config_path ${python_framework}/lib/pkgconfig
    configure.env              PATH=${python_framework}/bin:$env(PATH)
}

variant python27 conflicts python25 python26 description {Use python 2.7} {
    configure.python          ${prefix}/bin/python2.7
    depends_lib-append        port:py27-gtk
    set python_framework      ${frameworks_dir}/Python.framework/Versions/2.7
    configure.pkg_config_path ${python_framework}/lib/pkgconfig
    configure.env              PATH=${python_framework}/bin:$env(PATH)
}

if {![variant_isset python25] && ![variant_isset python26]} {
    default_variants +python27
}

post-patch {
    reinplace "s:libdbus-glib-1.so.2:${prefix}/lib/libdbus-glib-1.2.dylib:" ${worksrcpath}/browser-plugin/totemPluginGlue.cpp
}

post-destroot {
    eval delete [glob "${destroot}${prefix}/lib/nsplugins/*.la"]
}

post-activate {
    system "scrollkeeper-update"
    system "${prefix}/bin/gtk-update-icon-cache -f -t ${prefix}/share/icons/hicolor"
    system "export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` && \
        gconftool-2 --makefile-install-rule ${prefix}/etc/gconf/schemas/*.schemas"
}

livecheck.type  regex
livecheck.url   http://ftp.gnome.org/pub/gnome/sources/${name}/${branch}/
livecheck.regex {LATEST-IS-(\d+(?:\.\d+)*)}
