# -*- 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           github 1.0

github.setup        aqbanking aqbanking 6.6.1
github.tarball_from archive
name                aqbanking6

checksums           rmd160  cde6336b80a2c9e22ed964ca6b5295992afe570a \
                    sha256  72ff6d41743b122bb5d4edf7d9f54c66126b7392f1185f7cf50330c9e308e85e \
                    size    3295738

categories          devel net finance
maintainers         {dports @drkp} openmaintainer
license             {GPL-2 GPL-3 OpenSSLException}

description         a generic online banking interface
long_description    aqbanking is a generic online banking interface mainly \
                    supporting Home Banking Computer Interface, a standard \
                    used for German checking accounts, but also suitable \
                    for OFX as used in several other countries. \
                    Note that the YellowNet backend (for Suisse Postfinance) \
                    is not available for OS X (upstream only has a Linux binary).

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

conflicts           aqbanking6 aqbanking6-gtk2 aqbanking6-gtk3 \
                    aqbanking5 aqbanking5-gtk aqbanking5-gtk3

depends_lib         port:ktoblzcheck \
                    port:libofx \
                    port:gmp \
                    path:lib/pkgconfig/gnutls.pc:gnutls

depends_build       port:pkgconfig

universal_variant no

patchfiles patch-src-plugins-backends-Makefile.am.diff

conflicts-delete  $subport

use_autoreconf     yes

# generate prerequisites for compilation, ignore errors
pre-build {
        system -W ${worksrcpath} "make typedefs || true"
        system -W ${worksrcpath} "make typefiles || true"
        system -W ${worksrcpath} "make types || true "
}

if {$subport == $name} {
    PortGroup qt4 1.0
    depends_lib-append  port:gwenhywfar5 \
                        port:qt4-mac
}

subport aqbanking6-gtk2 {
    depends_lib-append  port:gwenhywfar5-gtk2
}

subport aqbanking6-gtk3 {
    depends_lib-append  port:gwenhywfar5-gtk3
}

configure.cppflags-append "-L${prefix}/lib"
configure.cflags-append   "-L${prefix}/lib"
configure.ldflags-append  "-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"
configure.env             PKG_CONFIG=${prefix}/bin/pkg-config QTDIR=${prefix}
configure.args-append \
                          --enable-static \
                          --disable-dependency-tracking \
                          --with-backends="aqhbci aqofxconnect aqnone aqpaypal"

# Makefiles not suitable for parallel build
use_parallel_build no

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

# allow installation to replace the equivalent subport of aqbanking5,
# to support migrating dependent ports to a new version
if {$subport == $name} {
    conflicts-delete aqbanking5
    pre-activate {
        if { ![catch {set vers [lindex [registry_active aqbanking5] 0]}] } {
            registry_deactivate_composite aqbanking5 "" [list ports_nodepcheck 1]
        }
    }
}
if {$subport == "aqbanking6-gtk"} {
    conflicts-delete aqbanking5-gtk
    pre-activate {
        if { ![catch {set vers [lindex [registry_active aqbanking5-gtk] 0]}] } {
            registry_deactivate_composite aqbanking5-gtk "" [list ports_nodepcheck 1]
        }
    }
}
if {$subport == "aqbanking6-gtk3"} {
    conflicts-delete aqbanking5-gtk3
    pre-activate {
        if { ![catch {set vers [lindex [registry_active aqbanking5-gtk3] 0]}] } {
            registry_deactivate_composite aqbanking5-gtk3 "" [list ports_nodepcheck 1]
        }
    }
}
