# $Id: Portfile 32789 2008-01-13 12:25:50Z ryandesign@macports.org $

PortSystem          1.0
name                diffutils
version             2.8.1
revision            3
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 71f9c5ae19b60608f6c7f162da86a428 \
                    sha1 a4c467c3a6a08cde9f3d94d02067ec26436e7dc5 \
                    rmd160 a61b15401f140097d39dfe00cd2a8062bcdfaa0e

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}-${version}

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} AUTHORS COPYING ChangeLog 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
            }
        }
    }
}

variant nls description {Add NLS support} {
    configure.args-append   gt_cv_func_gnugettext1_libintl=yes
    depends_lib-append      port:gettext

    post-destroot {
        xinstall -m 0644 -W ${worksrcpath} ABOUT-NLS ${destroot}${docdir}
    }
}

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