# -*- 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.22.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  29e12412c4d9e5e0f53c0ce6fe2503fb2d78b1a7 \
                    sha256  dc9aa749973b10d3c2672d2839e61bac75cf32d5e5106463420b83653c9df3ff \
                    size    10191616

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
