# $Id: Portfile 79954 2011-06-30 13:38:50Z rmstonecipher@macports.org $

PortSystem              1.0

name                    gawk
version                 4.0.0
categories              lang
maintainers             gmail.com:mschamschula openmaintainer
platforms               darwin
master_sites            gnu
homepage                http://www.gnu.org/software/gawk/
description             The GNU awk utility.
use_bzip2               yes
use_parallel_build      yes

long_description \
    The awk utility interprets a special-purpose programming language   \
    that makes it possible to handle simple data-reformatting jobs with \
    just a few lines of code. It is a free, extended version of awk.

checksums           md5     7cdc48e99b885a4bbe0e98dcf1706b22 \
                    sha1    9e1b7d86b5e80c85e699c269d59d6711753c51d1 \
                    rmd160  4e2f91f4dd80c03311fd249422c29b503b907bb4

depends_lib             port:libiconv \
                        port:gettext

configure.args          --with-libiconv-prefix=${prefix} \
                        ac_cv_libsigsegv=no

test.run                yes
test.target             check

post-destroot {
    delete ${destroot}${prefix}/bin/awk

    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
    }
}
