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

set gname           gcr
set suffix          4
name                ${gname}${suffix}
version             ${suffix}.4.0.1
revision            0
categories          gnome security
maintainers         {devans @dbevans} openmaintainer
license             LGPL-2
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.
set branch          [join [lrange [split ${version} .] 0 1] .]
homepage            https://wiki.gnome.org/Projects/GnomeKeyring
master_sites        gnome:sources/${gname}/${branch}/
distname            ${gname}-${version}
use_xz              yes

checksums           rmd160  31e373ce610aa5f35243c394c9fa6c0c362fb74e \
                    sha256  0c3c341e49f9f4f2532a4884509804190a0c2663e6120360bb298c5d174a8098 \
                    size    745244

patchfiles          patch-avoid-conflict-gcr.diff

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

depends_lib-append  port:gettext-runtime \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:gnupg2 \
                    port:libgcrypt \
                    port:libsecret \
                    port:p11-kit

depends_run-append  port:desktop-file-utils \
                    port:openssh

license_noconflict  vala

# gck-private.h: error: redefinition of typedef ‘GckCall’
compiler.c_standard 2011

# gtk is only used for gcr-viewer-gtk4 tool, skip it.
configure.args-append \
                    -Dcrypto="libgcrypt" \
                    -Dgtk4=false \
                    -Dgtk_doc=false \
                    -Dintrospection=true \
                    -Dssh_agent=true \
                    -Dsystemd=disabled \
                    -Dvapi=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/update-mime-database ${prefix}/share/mime"
}

livecheck.type      gnome
