# -*- 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
# $Id: Portfile 118756 2014-04-10 17:34:00Z devans@macports.org $

PortSystem          1.0
PortGroup           active_variants 1.0

name                gnumeric
version             1.12.8
revision            3
set branch          [join [lrange [split ${version} .] 0 1] .]

license             GPL-2+
maintainers         me.com:c.herbig openmaintainer
categories          gnome math science
platforms           darwin

description         A powerful Gtk3 based spreadsheet with Excel, ODF, R and Python support.
long_description    A powerful Gtk3 based spreadsheet that features full Excel function \
                    and file compatibility and additional functions not found in Excel, \
                    and statistics operations based on R. Functionality can be extended \
                    with Python and plugins. Other file compatibility includes OASIS ODF, \
                    Quattro Pro, Psion 5, Paradox DB, and more (see homepage). GDA \
                    database support is available with the +database variant.

homepage            https://wiki.gnome.org/Apps/Gnumeric
master_sites        gnome:sources/${name}/${branch}/
use_xz              yes

checksums           sha256  02688fb6c32c28db2eb4e9a8e012cf1386f4f3a18b4c94f5ecdd13342521ec76 \
                    rmd160  7d803eafc37fb5fd7cc4ba802f53440228c0843c

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

# update-desktop-database is provided by desktop-file-utils

depends_lib         port:desktop-file-utils \
                    port:gobject-introspection \
                    port:goffice \
                    port:psiconv \
                    port:pxlib

patchfiles          patch-configure.ac.diff

# autoreconf to reconfigure using our intltool.m4

use_autoreconf      yes
autoreconf.args     -fvi

configure.args      --disable-silent-rules \
                    --disable-schemas-compile \
                    --enable-introspection \
                    --without-gda

variant database description {builds with support for GDA database} {
    depends_lib-append        port:libgda5
    configure.args-replace    --without-gda --with-gda
}

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

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

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

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

livecheck.type  gnome

# yelp is currently not available in a +quartz environment due to dependency issues,
# see #39898 #40282 #40116
notes \
"Recommended supplementary ports:
    gnome-themes-standard  provides the default Gnome Adwaita theme
    yelp                   provides a help browser for Gnome apps"
