# $Id: Portfile 80528 2011-07-14 09:47:45Z jmr@macports.org $

PortSystem      1.0

name            xz
version         5.0.3
categories      archivers
# some executables are GPL, libs and everything else are public domain
license         {public-domain GPL-2+}
platforms       darwin
maintainers     afb openmaintainer
description     XZ Utils

long_description \
XZ utils consist of a few relatively separate submodules: \
* LZMA/XZ encoder/decoder command line tool similar to gzip/bzip2 \
* Scripts to ease grepping, diffing and viewing (lz*grep, lzdiff/lzcmp, lzmore/lzless)

homepage        http://tukaani.org/xz/
master_sites    ${homepage}
use_bzip2       yes

checksums       sha1    79661fd1c24603437e325d76732046b1da683b32 \
                rmd160  10127da6e2e35e5e92b3125f6088c756b80931e5

depends_lib     port:libiconv port:gettext

configure.args  --with-libiconv-prefix=${prefix} --with-libintl-prefix=${prefix}

# previous version defaulted to static liblzma (through --enable-dynamic=mixed)
configure.args-append --disable-shared

# document that we always need legacy symlinks now that "lzmautils" refers here
configure.args-append --enable-lzma-links

# the internal "check.h" header conflicts with port check's <check.h>
configure.cppflags -I${worksrcpath}/src/liblzma/check -I${prefix}/include

# the library is being provided by the liblzma port instead
post-destroot {
    file delete -force ${destroot}${prefix}/include/lzma.h
    file delete -force ${destroot}${prefix}/include/lzma
    foreach lib [glob ${destroot}${prefix}/lib/liblzma*] { file delete $lib }
    file delete ${destroot}${prefix}/lib/pkgconfig/liblzma.pc
}

livecheck.url   ${homepage}
livecheck.regex xz-(\[0-9.a-z\]*)\.tar\.gz
livecheck.type  regexm
