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

name            gwhich
version         2.23
revision        0

homepage        https://carlowood.github.io/which/

description     GNU Which - Everything you never wanted in a which

long_description \
    Which is a utility that prints out the full path of the executables \
    that bash would execute when the passed program names would have    \
    been entered on the shell prompt. It does this by using the exact   \
    same algorithm as bash. Tildes and a dot in the PATH are now        \
    expanded to the full path by default.  Options allow to rather print\
    '~/*' or './*' and/or to print all executables that match any       \
    directory in PATH.

categories      sysutils
installs_libs   no
maintainers     nomaintainer
license         GPL-3+

master_sites    gnu:which
distname        which-${version}
checksums       rmd160  23a48f685dffeddff55ec1c824830b7ac52470b6 \
                sha256  a2c558226fc4d9e4ce331bd2fd3c3f17f955115d2c00e447618a4ef9978a2a73 \
                size    201930

configure.args  --disable-dependency-tracking \
                --program-prefix=g

post-destroot {
    file rename ${destroot}${prefix}/share/info/which.info ${destroot}${prefix}/share/info/gwhich.info
    xinstall -m 0755 -d ${destroot}${prefix}/libexec/gnubin
    foreach binary [glob -tails -directory ${destroot}${prefix}/bin g*] {
        ln -s ${prefix}/bin/${binary} ${destroot}${prefix}/libexec/gnubin/[string range $binary 1 end]
    }
    xinstall -m 0755 -d ${destroot}${prefix}/libexec/gnubin/man/man1
    foreach manpage [glob -tails -directory ${destroot}${prefix}/share/man/man1 g*] {
        ln -s ${prefix}/share/man/man1/${manpage}.gz ${destroot}${prefix}/libexec/gnubin/man/man1/[string range $manpage 1 end].gz
    }
}

test.run        yes
test.target     check
