# -*- 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.18.0 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  af1bb9a3afafc77137e4c05efa27b818de70b10a \
                    sha256  f532bc215b8f57af6bd823d16b6ef2d57499a24f949722d06a2d1c8ea64df225 \
                    size    394734

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}
}
