# $Id: Portfile 67156 2010-04-30 11:23:28Z ryandesign@macports.org $

PortSystem          1.0

name                pigz
version             2.1.6
revision            1
categories          archivers
platforms           darwin
maintainers         gmail.com:danchr openmaintainer

description         parallel gzip
long_description    pigz, which stands for parallel implementation of gzip, \
                    is a fully functional replacement for gzip that exploits \
                    multiple processors and multiple cores to the hilt when \
                    compressing data. pigz was written by Mark Adler, and \
                    uses the zlib and pthread libraries.

homepage            http://www.zlib.net/pigz/
master_sites        ${homepage}

checksums           md5     cbe9030c4be3d0ef2438ee5f8b169ca4 \
                    sha1    df05bdcc7b08246a3c1e6a2ab2edc7d0a45c0369 \
                    rmd160  715a90eefbb9d2f6dbd94ec7ee196a0ea7b32e7f

depends_lib         port:zlib

patchfiles          patch-Makefile

use_configure       no

build.target
build.args          CC="${configure.cc}" \
                    CFLAGS="${configure.cflags}" \
                    CPPFLAGS="${configure.cppflags}" \
                    LDFLAGS="${configure.ldflags}"

variant universal {
    build.args-append \
                    CFLAGS+="${configure.universal_cflags}" \
                    LDFLAGS+="${configure.universal_ldflags}"
}
if {![variant_isset universal]} {
    build.args-append \
                    CFLAGS+="${configure.cc_archflags}" \
                    LDFLAGS+="${configure.cc_archflags}"
}

destroot {
    xinstall -m 644 ${worksrcpath}/${name}.1 ${destroot}${prefix}/share/man/man1
    xinstall ${worksrcpath}/${name} ${destroot}${prefix}/bin
    ln -s ${name} ${destroot}${prefix}/bin/un${name}
}

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     {pigz-(\d+(?:\.\d+)*).tar.gz}
