# -*- 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 118997 2014-04-14 20:46:12Z devans@macports.org $

PortSystem      1.0

name            evince
version         3.12.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        https://wiki.gnome.org/Apps/Evince
master_sites    gnome:sources/${name}/${branch}/

use_xz          yes

checksums       rmd160  c4cb0e9da1088096d8ece40bea1fe426b2727447 \
                sha256  ef22cc29a7cbe70d2e7ce8c0b5b7ee774187ea69f3ae49a64c6d4a91559ef137

depends_build   port:pkgconfig \
                port:intltool \
                port:itstool \
                port:yelp-tools \
                port:gnome-common

depends_lib     port:desktop-file-utils \
                port:gnome-icon-theme \
                port:gnome-icon-theme-symbolic \
                port:gdk-pixbuf2 \
                port:gtk3 \
                port:libxml2 \
                port:xorg-libsm \
                port:xorg-libice \
                port:libsecret \
                port:gsettings-desktop-schemas \
                port:gobject-introspection \
                port:poppler \
                port:libspectre \
                port:tiff \
                port:texlive-bin \
                port:t1lib

depends_run     port:gnome-settings-daemon

# update m4/intltool.m4 and autoreconf
# teach glibtool about -stdlib=libc++

pre-configure {
    copy -force ${prefix}/share/aclocal/intltool.m4 ${worksrcpath}/m4
}

use_autoreconf  yes
autoreconf.args -fvi

configure.args  --disable-schemas-compile \
                --disable-silent-rules \
                --disable-djvu \
                --disable-xps \
                --disable-nautilus \
                --enable-compile-warnings=minimum \
                --enable-introspection=yes \
                --enable-debug \
                --enable-ps \
                --enable-pdf \
                --enable-tiff \
                --enable-dvi \
                --enable-comics \
                --enable-t1lib

variant djvu description {Support for djvu documents using djvulibre} {
    configure.args-replace --disable-djvu --enable-djvu
    depends_lib-append port:djvulibre
}

variant nautilus description {Build optional nautilus extensions} {
    configure.args-replace  --disable-nautilus --enable-nautilus
    depends_lib-append      port:nautilus
}

post-activate    {
    system "${prefix}/bin/gtk-update-icon-cache-3.0 -f -t ${prefix}/share/icons/hicolor"
    system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
    system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
}

livecheck.type  gnome
