# -*- 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/containers/skopeo 1.20.0 v
revision            0

description         Work with remote container image registries

long_description    \
    {*}${description}. ${name} works with API V2 container image registries \
    such as docker.io and quay.io registries, private registries, local \
    directories and local OCI-layout directories.

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

checksums           rmd160  839afdc8b5c1140f88cb5fcb3bdeac4356853dd3 \
                    sha256  0c19fe51b2cd8d1bd5e38c03b97421e318fc08153bdf5ef2f816a29889eacdef \
                    size    10449131

depends_build-append \
                    port:go-md2man

depends_lib-append  port:gpgme      \
                    port:gnupg2     \
                    port:libassuan  \
                    port:pkgconfig

patch {
    # Do not rebuild the skopeo binary during the installation phase

    reinplace -E \
        {s|^install-binary: bin/skopeo|install-binary:|} \
        ${worksrcpath}/Makefile

    reinplace -E \
        {s|^completions: bin/skopeo|completions:|} \
        ${worksrcpath}/Makefile
}

build.cmd           make
build.target        all

destroot {
    system -W ${worksrcpath} \
        "make   DESTDIR=${destroot} \\
                CONTAINERSCONFDIR=${prefix}/etc/containers \\
                LOOKASIDEDIR=${prefix}/var/lib/containers/sigstore \\
                PREFIX=${prefix} \\
                install"
}

use_parallel_build  no
