# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 89455 2012-01-29 23:49:06Z dports@macports.org $

PortSystem          1.0

name                diffutils
version             3.2
categories          sysutils textproc devel
license             GPL-3+
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           rmd160  b4a544add6aed9678b25ed84146a40f60b6d9352 \
                    sha256  2aaaebef615be7dc365306a14caa5d273a4fc174f9f10abca8b60e082c054ed3

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 {
    xinstall -m 0755 -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README THANKS \
        ${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
    }
}

test.run        yes
test.target     check

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