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

PortSystem      1.0

name            dzip
version         2.9
categories      archivers
platforms       darwin
maintainers     nomaintainer
description     file compression tool

long_description \
    Dzip is a program for file compression. Its advantage \
    over more popular compression software is in the size of the \
    program, easily fitting on a floppy disk. Dzip's original purpose \
    was to compress demo recordings of the id software game Quake.

homepage        http://speeddemosarchive.com/dzip/
master_sites    ${homepage}
distname        dz[strsed ${version} {/\.//}]src
use_zip         yes

checksums       md5 b02d69c7c6ee491380d77f26c6f5a6e0 \
                sha1 64e7b0d07c55aaa22bbcf04066135b5a9968e5ee \
                rmd160 4719785c312a577eb7b1aacad43a24b6fd8a4ed2

extract.mkdir   yes
post-extract {
    # Convert DOS to UNIX line endings so we can patch
    reinplace "s|\r||g" ${worksrcpath}/Makefile.linux
}

patchfiles      patch-Makefile.linux.diff

use_configure   no

build.target    ${name}
build.args      -f Makefile.linux
build.env       CC=${configure.cc}

destroot {
    xinstall ${worksrcpath}/dzip ${destroot}${prefix}/bin

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

variant universal {
    build.args-append "LDFLAGS=\"${configure.universal_ldflags}\""

    post-patch {
        reinplace -E "s|^(CFLAGS.*)\r\$|\\1 ${configure.universal_cflags}|" ${worksrcpath}/Makefile.linux
    }
}

livecheck.type  regex
livecheck.url   ${homepage}download.html
livecheck.regex v(\\d+(?:\\.\\d+)*)

