# -*- 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 108590 2013-07-27 02:27:04Z jmr@macports.org $

PortSystem          1.0

name                pigz
version             2.3
revision            0
categories          archivers
license             zlib Apache-2
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           rmd160  24a2edefd8661e6cf0e6f940f3674afaed8da21d \
                    sha256  74bbd5962f9420549fc987ddd1ccda692ec2b29d2d612fbbe26edf3fa348ff21

depends_lib         port:zlib

patchfiles          patch-Makefile.diff

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}
