# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           active_variants 1.1
PortGroup           meson 1.0

name                gcr
version             3.41.2
revision            0
license             LGPL-2
set branch          [join [lrange [split ${version} .] 0 1] .]
description         GCR is a library for displaying certificates, \
                    and crypto UI, accessing key stores.
long_description    ${description} \
                    It also provides the viewer for crypto files on the GNOME \
                    desktop and a library for accessing PKCS#11 modules \
                    like smart cards, in a (G)object-oriented way.

maintainers         {devans @dbevans} openmaintainer
categories          gnome security
homepage            https://wiki.gnome.org/Projects/GnomeKeyring
master_sites        gnome:sources/${name}/${branch}/

use_xz              yes

checksums           rmd160  19cc19bdfd2f1dd6aaa838ffbd11d087dc0cebc2 \
                    sha256  bad10f3c553a0e1854649ab59c5b2434da22ca1a54ae6138f1f53961567e1ab7 \
                    size    1034532

depends_build-append \
                    port:cctools \
                    port:gettext \
                    port:pkgconfig \
                    path:bin/vala:vala

depends_lib-append  port:desktop-file-utils \
                    port:gettext-runtime \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:gnupg2 \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    port:libgcrypt \
                    port:libsecret \
                    port:p11-kit

# gck-private.h: error: redefinition of typedef ‘GckCall’
compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2

configure.args-append \
                    -Dgtk=true \
                    -Dgtk_doc=false \
                    -Dintrospection=true \
                    -Dssh_agent=true

post-activate {
    system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
    system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
    system "${prefix}/bin/gtk-update-icon-cache -f -t ${prefix}/share/icons/hicolor"
    system "${prefix}/bin/update-mime-database ${prefix}/share/mime"
}

if {${os.major} < 19} {

    # requires python3, so use macports default python3 on systems without it
    # https://trac.macports.org/ticket/70172

    # keep in sync with the default in the python PortGroup
    set py_ver           3.12
    set py_ver_nodot     [string map {. {}} ${py_ver}]


    depends_build-append port:python${py_ver_nodot}
    patchfiles-append    gcr-python3.diff

    post-patch {
        reinplace "s|@@PYTHON3BIN@@|${prefix}/bin/python${py_ver}|g" ${worksrcpath}/meson_post_install.py
    }

}

livecheck.type      gnome
