# -*- 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

PortSystem              1.0
PortGroup               legacysupport 1.0
PortGroup               perl5 1.0

name                    moreutils
conflicts               ts
version                 0.70
revision                0
categories              sysutils
platforms               darwin
maintainers             {khindenburg @kurthindenburg} openmaintainer
license                 GPL-2+

description             a collection of the unix tools that nobody thought \
                        to write thirty years ago.

long_description        moreutils includes the following utilities: \
                        \n- chronic: runs a command quietly unless it fails \
                        \n- combine: combine the lines in two files using boolean operations \
                        \n- errno: look up errno names and descriptions \
                        \n- ifne: run a program if the standard input is not empty \
                        \n- isutf8: check if a file or standard input is utf-8 \
                        \n- lckdo: run a program with a lock held. \
                        \n- mispipe: pipe two commands, returning the exit status of the first \
                        \n- pee: tee standard input to pipes \
                        \n- sponge: soak up standard input and write to a file \
                        \n- ts: timestamp standard input \
                        \n- vidir: edit a directory in your text editor \
                        \n- vipe: insert a text editor into a pipe \
                        \n- zrun: automatically uncompress arguments to command

homepage                https://joeyh.name/code/moreutils
master_sites            https://git.joeyh.name/index.cgi/moreutils.git/snapshot

checksums               rmd160  9478b21c7359a2ba1211a788883e0fb187906e43 \
                       sha256  f2bf46d410ba567cc8d01507e94916994e48742722e690dc498fab59f5250132 \
                       size    94043

perl5.major             5.34

depends_run             port:perl${perl5.major} \
                        port:p${perl5.major}-ipc-run \
                        port:p${perl5.major}-timedate \
                        port:p${perl5.major}-time-duration

patchfiles              patch-Makefile.diff

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

use_configure           no

variant universal {}

build.args-append       CC=${configure.cc} \
                        CFLAGS="${configure.cflags} [get_canonical_archflags cc]" \
                        LDFLAGS="${configure.ldflags} [get_canonical_archflags ld]" \
                        DOCBOOK2XMAN=docbook2man \
                        PREFIX=${prefix}

destroot.args-append    PREFIX=${prefix}

default_variants        +doc

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
}

notes "The binary parallel is no longer in this port; please install the port parallel instead."

livecheck.type          regex
livecheck.regex         {version ([0-9.]+)}