# -*- 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
PortGroup           active_variants 1.1
PortGroup           app 1.0
PortGroup           openssl 1.0

name                grisbi
version             3.0.3
revision            1
set branch          [join [lrange [split ${version} .] 0 1] .]
checksums           rmd160  4eca5dff3eecbe048bc679a4bc647962568ce6c7 \
                    sha256  3bc1c630a758a4b5a76116015002a9b477b495203110481ff41f3674c1df4797 \
                    size    12877828
categories          gnome finance
license             GPL-2+
maintainers         nomaintainer
installs_libs       no

description         easy Personnal Finance Manager
long_description    Grisbi is a personnal accounting application. \
    Grisbi can manage multiple accounts, currencies and users. It manages \
    third party, expenditure and receipt categories, as well as budgetary \
    lines, financial years, and other information that makes it quite \
    adapted for associations (except those that require double entry \
    accounting).

homepage            http://www.grisbi.org
master_sites        sourceforge:project/grisbi/grisbi%20stable/${branch}.x/${version}

use_bzip2           yes

# reconfigure using autogen.sh from upstream git for intltool 0.51 compatibility
use_autoreconf      yes
autoreconf.cmd      ${filespath}/autogen.sh

depends_build       path:bin/pkg-config:pkgconfig \
                    port:desktop-file-utils \
                    port:intltool \
                    port:gettext \
                    port:autoconf \
                    port:automake \
                    port:libtool

depends_lib-append  port:goffice \
                    port:json-glib \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    port:libxml2

configure.args      --disable-frenchdoc \
                    --disable-silent-rules \
                    --without-ofx

default_variants +ofx

variant ofx description {Include Open Financial Exchange support} {
    depends_lib-append port:libofx
    configure.args-delete --without-ofx
}

# TODO - grisbi tries to use Chrome to open documentation.  Unable to determine
# where the default to Chrome comes from (gtk3?) 
# should use whatever is the default browser on the user's system

variant doc description {Include documentation in French} {
    configure.args-delete --disable-frenchdoc
}

variant quartz conflicts x11 description {Better support Mac interface conventions} {
    require_active_variants path:lib/pkgconfig/gtk+-3.0.pc:gtk3 quartz
    depends_lib-append \
                    port:gtk-osx-application-gtk3
}

variant x11 conflicts quartz description {Interface more consistent with other X11 systems} {
    require_active_variants path:lib/pkgconfig/gtk+-3.0.pc:gtk3 x11
    platform macosx {
        if {${os.major} < 15} {
            depends_run-append port:xorg-server-legacy
        } else {
            depends_run-append port:xorg-server
        }
    }
}

if {![variant_isset quartz]} {
    default_variants-append +x11
}

app.name            Grisbi
app.icon            ${filespath}/Grisbi.icns
app.identifier      org.grisbi.Grisbi
app.retina          yes

post-activate {
    system "${prefix}/bin/update-desktop-database -v ${prefix}/share/applications"
    system "${prefix}/bin/gtk-update-icon-cache -f -t ${prefix}/share/icons/hicolor"
}

livecheck.regex     /${name}-(\[0-9\]+\\.\[0-9\]*\[02468\](\\.\[0-9\]+)*)${extract.suffix}
