# $Id: Portfile 86130 2011-10-19 15:27:14Z milosh@macports.org $

PortSystem  1.0

name        moreutils
version     0.39
revision    1
categories  sysutils
maintainers nomaintainer
license     GPL-2+
platforms   darwin
description a collection of the unix tools that nobody thought to write thirty years ago.
long_description    \
    moreutils includes the following utilities: \
 - combine: combine the lines in two files using boolean operations, \
 - ifne: run a program if the standard input is not empty, \
 - isutf8: check if a file or standard input is utf-8, \
 - lckdo: run a program with a lock held. \
 - mispipe: pipe two commands, returning the exit status of the first, \
 - parallel: run multiple jobs at once, \
 - pee: tee standard input to pipes, \
 - sponge: soak up standard input and write to a file, \
 - ts: timestamp standard input, \
 - vidir: edit a directory in your text editor, \
 - vipe: insert a text editor into a pipe, \
 - zrun: automatically uncompress arguments to command.

homepage    http://packages.debian.org/unstable/utils/moreutils
master_sites    http://ftp.debian.org/debian/pool/main/m/moreutils/
conflicts       parallel
distname        ${name}_${version}
worksrcdir      ${name}
checksums       md5     73477f418ea2de81a045019cc71267f3 \
                sha1    ebf83f430a8c30b4f787e0b469ef2a37b6e2ae42 \
                rmd160  5b7be7b4b07497c04f5792021bf1dc54ec5d07a8
depends_run     path:bin/perl:perl5

patchfiles      patch-Makefile.diff

post-patch {
        reinplace "s|/usr/bin/perl|${prefix}/bin/perl|" \
        ${worksrcpath}/vidir ${worksrcpath}/vipe \
        ${worksrcpath}/ts ${worksrcpath}/combine \
        ${worksrcpath}/zrun
}

use_configure   no

build.args-append       CC=${configure.cc} \
                        DOCBOOK2XMAN=docbook2man \
                        PREFIX=${prefix}

destroot.args-append    PREFIX=${prefix}

variant doc description {Install man pages} {
        depends_build-append    port:docbook-xml-4.4 port:docbook2X
        build.target-append     doc
        destroot.target-append  install-doc
        post-patch {
            reinplace "s|/usr/share/xml/docbook/schema/dtd/4.4|${prefix}/share/xml/docbook/4.4|" \
            ${worksrcpath}/ifne.docbook ${worksrcpath}/isutf8.docbook \
            ${worksrcpath}/mispipe.docbook ${worksrcpath}/pee.docbook \
            ${worksrcpath}/parallel.docbook \
            ${worksrcpath}/sponge.docbook ${worksrcpath}/lckdo.docbook
        }
}

platform darwin 8 {
    # ticket #24279
    pre-fetch {
        error "$name does not build on Mac OS X 10.4"
    }
}

livecheck.type  regex
livecheck.url   http://packages.debian.org/unstable/utils/${name}
livecheck.regex ${name} .(\[0-9.\]+)

