# -*- 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
PortGroup           legacysupport 1.1

# strndup
legacysupport.newest_darwin_requires_legacy 10

github.setup        aqbanking gwenhywfar 5.14.1
revision            1
github.tarball_from archive
name                gwenhywfar5

checksums           rmd160  66d27db6f90a894708717c04eaed6d7797ace4bc \
                    sha256  d52937b56e0760d11dc200ad5fb2cfd9d8bf147d0b1b97451f23f31c6ee641a2 \
                    size    1797211

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

description         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 \
                    port:automake \
                    port:autoconf \
                    path:bin/pkg-config:pkgconfig

configure.args      --enable-static

conflicts-delete  $subport

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

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

patchfiles          configure.ac.patch \
                    implicit.patch

pre-configure {
    system -W ${worksrcpath} "\
        aclocal -Im4 -I${prefix}/share/gettext/m4 -I${prefix}/share/aclocal && \
        autoconf && \
        autoheader && \
        glibtoolize && \
        automake --add-missing \
        "
}

if {${subport} eq ${name}} {
    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"
}

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

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


# allow installation to replace the equivalent subport of gwenhywfar4, to
# support migrating dependent ports to a new version
if {${subport} eq ${name}} {
    conflicts-delete gwenhywfar4
    pre-activate {
        if { ![catch {set vers [lindex [registry_active gwenhywfar4] 0]}] } {
            registry_deactivate_composite gwenhywfar4 "" [list ports_nodepcheck 1]
        }
    }
}
if {${subport} eq "gwenhywfar5-gtk"} {
    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]
        }
    }
}
if {${subport} eq "gwenhywfar5-gtk3"} {
    conflicts-delete gwenhywfar4-gtk3
    pre-activate {
        if { ![catch {set vers [lindex [registry_active gwenhywfar4-gtk3] 0]}] } {
            registry_deactivate_composite gwenhywfar4-gtk3 "" [list ports_nodepcheck 1]
        }
    }
}
