# -*- 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/awslabs/amazon-ecr-credential-helper 0.10.1 v
github.tarball_from archive
revision            0

description         Automatically gets credentials for Amazon ECR on docker \
                    push/docker pull

long_description    {*}${description}. The Amazon ECR Docker Credential \
                    Helper is a credential helper for the Docker daemon that \
                    makes it easier to use Amazon Elastic Container Registry.

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

checksums           rmd160  2780f4277a61a419a6ebac754dd0f4b3f98bd14f \
                    sha256  872f612d8ff2ec294024c58b5ca452bebcd9eeceb29e105e159e5579ec6056b2 \
                    size    1991791

build.cmd           make
build.pre_args-append \
                    VERSION=${version}
build.args          build

patch {
    # Don't attempt to surmise the current commit SHA using git
    # (this is not a git checkout)
    reinplace -E {s|git rev-parse --short=7 HEAD|echo none|g} \
        ${worksrcpath}/Makefile
}

destroot {
    xinstall -m 0755 \
        ${worksrcpath}/bin/local/docker-credential-ecr-login \
        ${destroot}${prefix}/bin/

    xinstall -m 0644 ${worksrcpath}/docs/docker-credential-ecr-login.1 \
        ${destroot}${prefix}/share/man/man1/
}
