# -*- 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 62757 2010-01-16 18:07:02Z nox@macports.org $

PortSystem      1.0

name            coreutils
version         8.4
categories      sysutils
platforms       darwin
maintainers     nox openmaintainer
description     GNU File, Shell, and Text utilities

long_description \
    The GNU Core Utilities are the basic file, shell, and text \
    manipulation utilities of the GNU operating system. These are the \
    core utilities which are expected to exist on every operating \
    system. Previously these utilities were offered as three individual \
    sets of GNU utilities, fileutils, shellutils, and textutils. Those \
    three have been combined into a single set of utilities called the \
    coreutils.

homepage        http://www.gnu.org/software/${name}/
master_sites    gnu

checksums       md5     56f549854d723d9dcebb77919019df55 \
                sha1    89eefb041215c30408261f46f59dc08e4b500edf \
                rmd160  26ba81ce235997bd6f82c903e8234f2c86e15b5a

depends_lib \
    port:gettext \
    port:gmp \
    port:libiconv

configure.args  --program-prefix=g

post-destroot {
    if {[file exists ${destroot}${prefix}/share/info/dir]} {
        delete ${destroot}${prefix}/share/info/dir
    }

    if {[file exists ${destroot}${prefix}/lib/charset.alias]} {
        delete ${destroot}${prefix}/lib/charset.alias
    }

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

# Set the RUN_EXPENSIVE_TESTS environmental variable to 'yes' to run more
# expensive tests.  Set the RUN_VERY_EXPENSIVE_TESTS environmental variable
# to 'yes' to run even more expensive tests.
test.run        yes
test.target     check

variant with_default_names description \
        {Install files without 'g' prefix, use with extreme caution} {
    post-destroot {
        foreach {d} {bin share/man/man1} {
            foreach {f} [glob -tails -directory ${destroot}${prefix}/${d} g*] {
                ln -sf ${f} ${destroot}${prefix}/${d}/[string range ${f} 1 end]
            }
        }
    }
}
