# -*- 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
# kate: backspace-indents true; indent-pasted-text true; indent-width 4; keep-extra-spaces true; remove-trailing-spaces modified; replace-tabs true; replace-tabs-save true; syntax Tcl/Tk; tab-indents true; tab-width 4;

PortSystem          1.0

name                gwenhywfar4
version             4.20.2
revision            2
# this is specific to this port and *version* for downloading it
set release         108

checksums           rmd160  e8530ab018e28ca48d3947466e75f471ca793c50 \
                    sha256  0f4fd92351c8a11f053aa482fc5c459499db3dc78dd8bb469e878890ef3d3270 \
                    size    2350327

categories        devel net finance
maintainers       {dports @drkp} openmaintainer
license           {LGPL-2.1 OpenSSLException}

description       a utility library required by aqbanking and related software
long_description  {*}${description}

homepage          https://www.aquamaniac.de/rdm/projects/gwenhywfar

conflicts         gwenhywfar4 gwenhywfar4-gtk gwenhywfar4-gtk3

depends_lib       path:lib/libssl.dylib:openssl \
                  port:libgcrypt \
                  port:gettext \
                  port:libxml2 \
                  path:lib/pkgconfig/gnutls.pc:gnutls

depends_build     port:libtool \
                  path:bin/pkg-config:pkgconfig

configure.args    --enable-static

conflicts-delete  $subport

subport gwenhywfar4-gtk {}
subport gwenhywfar4-gtk3 {}

patchfiles      patch-gwenhywfar-config.cmake.in.diff \
                patch-gwengui-qt4-config.cmake.in.diff \
                patch-gwengui-cpp-config.cmake.in.diff \
                implicit.patch

if {${subport} eq ${name}} {
    # the correct way to depend on Qt4:
    PortGroup               qt4 1.0
    configure.args-append   --with-qt4-libs=${qt_libs_dir} \
                            --with-qt4-includes=${qt_includes_dir} \
                            --with-qt4-moc=${qt_moc_cmd} \
                            --with-qt4-uic=${qt_uic_cmd} \
                            --with-guis="qt4 cpp cocoa"
}

master_sites      https://www.aquamaniac.de/rdm/attachments/download/${release}/
distname          gwenhywfar-${version}

if {${subport} eq "gwenhywfar4-gtk"} {
    depends_lib-append      path:lib/pkgconfig/gtk+-2.0.pc:gtk2
    configure.args-append   --with-guis="gtk2 cpp" --disable-qt4
}

if {${subport} eq "gwenhywfar4-gtk3"} {
    depends_lib-append      path:lib/pkgconfig/gtk+-3.0.pc:gtk3
    configure.args-append   --with-guis="gtk3 cpp" --disable-qt4
}

# Allow gtk3 version to replace any gtk2 version if it is installed
# This will conflicts during gnucash upgrade.
if {${subport} eq "gwenhywfar4-gtk3"} {
    conflicts-delete gwenhywfar4-gtk
    pre-activate {
        if { ![catch {set vers [lindex [registry_active gwenhywfar4-gtk] 0]}] } {
            registry_deactivate_composite gwenhywfar4-gtk "" [list ports_nodepcheck 1]
        }
    }
}

variant enable_local_install description "Enable local installation mode (plugins, data, locale and config are located relatively to the binary)" {
    configure.args-append   --enable-local-install
}

variant debug description "Enable debug" {
    configure.args-append --enable-debug
}

configure.args-append   --disable-dependency-tracking --disable-silent-rules

livecheck.type    regex
livecheck.url     https://www.aquamaniac.de/rdm/projects/gwenhywfar/files
livecheck.regex   gwenhywfar-(4\\.\[0-9.\]*)\\.tar
