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

go.setup            github.com/square/certigo 1.17.1 v
go.offline_build    no
github.tarball_from archive
revision            0

description         A utility to examine and validate certificates in a \
                    variety of formats.

long_description    Certigo is a utility to examine and validate certificates \
                    to help with debugging SSL/TLS issues. It supports all \
                    common file formats such as X.509 (DER/PEM), JCEKS, PKCS7 \
                    and PKCS12 files, supports STARTTLS protocols, can \
                    validate, lint and has scripting support.

categories          sysutils
installs_libs       no
license             Apache-2
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  2b362cf45b6cc719774fa62d245a6932fa9ab20a \
                    sha256  4ac183d25d89246519cce0c7d3ed3e3be261ac72f4ed3b15b9e0690c91778ed4 \
                    size    396166

github.livecheck.regex {([0-9.]+)}

post-build {
    system -W ${worksrcpath} "./${name} --help-man > ${name}.1"

    system -W ${worksrcpath} \
        "./${name} --completion-script-bash > ${name}.completion.bash"
    system -W ${worksrcpath} \
        "./${name} --completion-script-zsh > ${name}.completion.zsh"
}

destroot {
    xinstall -m 0755 ${worksrcpath}/${name} ${destroot}${prefix}/bin/

    # Install man page
    xinstall -m 0444 \
        ${worksrcpath}/${name}.1 ${destroot}${prefix}/share/man/man1

    # Install shell completions
    xinstall -d ${destroot}${prefix}/share/bash-completion/completions
    copy ${worksrcpath}/${name}.completion.bash \
        ${destroot}${prefix}/share/bash-completion/completions/${name}

    xinstall -d ${destroot}${prefix}/share/zsh/site-functions
    copy ${worksrcpath}/${name}.completion.zsh \
        ${destroot}${prefix}/share/zsh/site-functions/_${name}
}
