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

name                 scute

version              1.7.0
revision             0
categories           security
maintainers          {@gouttegd incenp.org:dgouttegattat} \
                     openmaintainer
description          PKCS#11 interface to the GnuPG Agent
long_description     Scute is a PKCS#11 implementation relying on the GnuPG Agent. \
                     It enables the use of an OpenPGP smartcard for TLS client     \
                     authentication and for CMS digital signatures with Mozilla    \
                     and other PKCS#11-compatible applications.
homepage             https://gnupg.org/
license              LGPL-2.1+

master_sites         https://gnupg.org/ftp/gcrypt/scute

checksums            rmd160  e14690f5ab4eaee4b934c7b5af6fc47c39c4146b \
                     sha256  437fe758b27c243a5ee2535c6b065ea1d09f2c9a02d83567d2f934bb6395c249 \
                     size    851177
use_bzip2            yes
post-extract {
  # We hardcode the path to gpgconf, so that if Scute is called from an
  # application started from the graphical environment (rather than from
  # a terminal), it can still find gpgconf even if the application's
  # PATH does not include the MacPorts' bin directory.
  reinplace "s|pgmname = \"gpgconf\";|pgmname = \"${prefix}/bin/gpgconf\";|" "${worksrcpath}/src/get-path.c"
}

patchfiles-append    scute-${version}-fix-global-definition.diff \
                     scute-${version}-add-no-chain-option.diff

test.run             yes
test.target          check

depends_build-append port:pkgconfig port:ImageMagick
depends_lib-append   port:gnupg2

livecheck.type       regex
livecheck.url        https://gnupg.org/ftp/gcrypt/${name}/
livecheck.regex      ${name}-(\\d+(?:\\.\\d+)*)