# $Id: Portfile 57375 2009-09-10 08:16:41Z ryandesign@macports.org $

PortSystem      1.0

name            gzrecover
set my_name     gzrt
version         0.5
categories      archivers
platforms       darwin
maintainers     nomaintainer
description     attempts to extract bad gzip archives

long_description \
    Gzrecover attempts to skip over bad data in a gzip \
    archive. It will try to to skip over bad data and extract whatever \
    files might be there.

homepage        http://www.urbanophile.com/arenn/hacking/gzrt/
master_sites    ${homepage}
distname        ${my_name}-${version}

checksums       md5 91e9cbc1d92276742691dca89d6b8293 \
                sha1 99f1320dc795da666cd17d331c359e5c2433c129 \
                rmd160 e14e80de9b5e9abee8c68e6f2a9164c038b1d3a9

depends_lib     port:zlib

post-patch {
    foreach {var} {CFLAGS LDFLAGS} {
        eval reinplace -E "\"/^${var}/s|\\\\+=|= \${${var}}|\"" ${worksrcpath}/Makefile
    }
}

use_configure   no

set	CFLAGS      ${configure.cflags}
set LDFLAGS     ${configure.ldflags}

build.env       CC=${configure.cc}

destroot {
    xinstall ${worksrcpath}/gzrecover ${destroot}${prefix}/bin
    xinstall -m 0444 ${worksrcpath}/gzrecover.1 ${destroot}${prefix}/share/man/man1

    set docdir ${prefix}/share/doc/${name}-${version}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} ChangeLog README ${destroot}${docdir}
}

variant universal {
    set CFLAGS  "${CFLAGS} ${configure.universal_cflags}"
    set LDFLAGS "${LDFLAGS} ${configure.universal_ldflags}"
}

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

