# -*- 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 107919 2013-07-09 08:50:30Z dports@macports.org $

PortSystem 1.0
PortGroup  muniversal 1.0

name            evince
version         2.32.0
revision        1
license         GPL-2+
set branch      [join [lrange [split ${version} .] 0 1] .]
description     Evince is a document viewer for multiple document formats like pdf, and many others.
long_description \
                ${description}
maintainers     devans openmaintainer
categories      gnome print
platforms       darwin
homepage        http://projects.gnome.org/evince/
master_sites    gnome:sources/${name}/${branch}/

use_bzip2       yes

checksums       rmd160  a2d52685ac119b70cf40f320de457b3dfbac2587 \
                sha256  2a4c91ae38f8b5028cebb91b9da9ddc50ea8ae3f3d429df89ba351da2d787ff7

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

depends_lib     port:desktop-file-utils \
                port:gconf \
                port:jpeg \
                port:tiff \
                port:libgnome-keyring \
                port:gnome-icon-theme \
                port:poppler \
                port:texlive-bin \
                port:t1lib \
                port:libspectre \
                port:xorg-libsm \
                port:xorg-libice \
                port:nautilus

depends_run     port:gnome-settings-daemon \
                port:yelp

patchfiles      patch-configure.ac.diff

use_autoreconf  yes
autoreconf.args -fvi

configure.args  --disable-scrollkeeper \
                --disable-schemas-install \
                --disable-schemas-compile \
                --disable-silent-rules \
                --disable-djvu \
                --with-gtk=2.0 \
                --enable-introspection=no \
                --enable-debug \
                --enable-ps \
                --enable-pdf \
                --enable-tiff \
                --enable-dvi \
                --enable-impress \
                --enable-comics \
                --enable-nautilus \
                --enable-t1lib \
                --enable-pixbuf \
                --mandir=${prefix}/share/man

post-patch {
    # Update for newer autoconf/automake
    reinplace "/AM_PROG_CC_STDC/d" ${worksrcpath}/configure.ac
}

variant djvu description {Builds against port:djvulibre} {
    configure.args-delete --disable-djvu
    configure.args-append --enable-djvu
    depends_lib-append port:djvulibre
}

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

livecheck.type  gnome
