# $Id: Portfile 65392 2010-03-25 23:51:52Z ryandesign@macports.org $

PortSystem          1.0
name                diffutils
version             2.9
categories          sysutils textproc devel
maintainers         nomaintainer
description         GNU diff utilities
long_description \
    diffutils contains the GNU diff, diff3, sdiff, and cmp utilities.   \
    Their features are a superset of the Unix features and they are     \
    significantly faster.

platforms           darwin sunos
homepage            http://www.gnu.org/software/diffutils/
master_sites        gnu

checksums           md5     d6bc1bdc874ddb14cfed4d1655a0dbbe \
                    sha1    4fae7102ee8938c9ee1b2ad0bd63230af36975ac \
                    rmd160  37c817910ed17672f0a448b8669ae450ec807fcd

depends_lib         port:gettext

patchfiles          patch-src_system.h.diff
configure.args      --program-prefix=g \
                    --infodir=${prefix}/share/info \
                    --mandir=${prefix}/share/man

set docdir          ${prefix}/share/doc/${name}

post-destroot {
    move ${destroot}${prefix}/share/info/diff.info ${destroot}${prefix}/share/info/gdiff.info

    xinstall -m 0755 -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README THANKS \
        ${destroot}${docdir}
}

test.run        yes
test.target     check

variant with_default_names description {Install files without 'g' prefix} {
    post-destroot {
        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
            }
        }
    }
}

livecheck.type  regex
livecheck.url   http://ftp.gnu.org/gnu/${name}/?C=M&O=D
livecheck.regex ${name}-(\\d+(?:\\.\\d+)*)
