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

codeberg.setup      vaporup ssh-tools 1.9 v
revision            0

description         Additional tools that make SSH more convenient
long_description    {*}${description}

categories          sysutils net
installs_libs       no
license             GPL-3
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  db9bfeca5fb84343bba23448f055c2dcd7a5ac83 \
                    sha256  6cbfcdb50af3661feb3528132b5321ad5a1fd3f5ac57939c9f9ea8e3337b9892 \
                    size    814560

depends_build-append \
                    path:bin/go:go

depends_run-append  path:bin/perl:perl5

use_configure       no

build               {
    foreach godir [glob ${worksrcpath}/cmd/go/*] {
        set gocmd [file tail ${godir}]
        system -W ${worksrcpath} \
            "go build -o ./cmd/go/${gocmd}/${gocmd} ./cmd/go/${gocmd}"
    }
}

destroot {
    foreach bashdir [glob ${worksrcpath}/cmd/bash/*] {
        set bashbin [file tail ${bashdir}]
        xinstall -m 0755 ${bashdir}/${bashbin} ${destroot}${prefix}/bin/
    }

    foreach godir [glob ${worksrcpath}/cmd/go/*] {
        set gobin [file tail ${godir}]
        xinstall -m 0755 ${godir}/${gobin} ${destroot}${prefix}/bin/
    }

    foreach perldir [glob ${worksrcpath}/cmd/perl/*] {
        set perlbin [file tail ${perldir}]
        xinstall -m 0755 ${perldir}/${perlbin} ${destroot}${prefix}/bin/
    }
}
