# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 81406 2011-07-30 03:54:50Z jmr@macports.org $

PortSystem      1.0

name            findutils
version         4.4.2
revision        1
categories      sysutils
license         GPL-3+
installs_libs   no
platforms       darwin
maintainers     nomaintainer
description     findutils contains GNU find, xargs, and locate

long_description \
    ${description}

homepage        http://www.gnu.org/software/findutils/
master_sites    gnu

checksums       md5     351cc4adb07d54877fa15f75fb77d39f \
                sha1    e8dd88fa2cc58abffd0bfc1eddab9020231bb024 \
                rmd160  d2954a31d59ca238e18b50be82f1eccf7ad69054

depends_lib     port:gettext \
                port:libiconv

configure.env   SORT=/usr/bin/sort

configure.args  --program-prefix=g

use_parallel_build  yes

test.run        yes
test.target     check

post-destroot {
    move ${destroot}${prefix}/share/info/find.info ${destroot}${prefix}/share/info/gfind.info
    delete ${destroot}${prefix}/lib/charset.alias

    set docdir ${prefix}/share/doc/${name}-${version}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} AUTHORS COPYING ChangeLog NEWS README \
        THANKS TODO ${destroot}${docdir}

    xinstall -m 755 -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 755 -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
    }
}
