# $Id: Portfile 65341 2010-03-25 16:42:17Z ryandesign@macports.org $

PortSystem 1.0
name            gwhich
version         2.20
categories      sysutils
maintainers     nomaintainer
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.

homepage        http://www.xs4all.nl/~carlo17/which/
platforms       darwin
master_sites    gnu:which
distname        which-${version}
checksums       md5     95be0501a466e515422cde4af46b2744 \
                sha1    3bcd6d87aa5231917ba7123319eedcae90cfa0fd \
                rmd160  f0e8f464b9fe70c0126749d559e98170cdac0b98

configure.args  --infodir=${prefix}/share/info \
                --mandir=${prefix}/share/man \
                --program-prefix=g

post-destroot {
    file rename ${destroot}${prefix}/share/info/which.info ${destroot}${prefix}/share/info/gwhich.info
    if {[variant_isset with_default_names]} {
        foreach d {bin share/info share/man/man1} {
            foreach a [glob -directory ${destroot}${prefix}/$d g*] {
                regexp /g(.+)\$ $a dummy b
                file link -hard ${destroot}${prefix}/$d/$b $a
            }
        }
    }
}

test.run        yes
test.target     check

variant with_default_names {}
