PortSystem      1.0

name            hffzip
version         1.01
categories      archivers
platforms       darwin
maintainers     nomaintainer
license         GPL-2+
description     HFFzip is a file compressor based upon Huffman coding.

long_description \
    The Huffman algorithm uses a binary tree, and has complexity \
    O(N*N) for compression and O(NlogN) for decompression. Although \
    this file compressor is not so good as other compression programs \
    (like gzip), HFFzip is right for embedded systems, because of its \
    little size and the simple algorithm used.

homepage        http://retis.sssup.it/~scordino/projects/hffzip.html
master_sites    http://retis.sssup.it/~scordino/projects/
distname        ${name}${version}

checksums       md5 d81cdfb92e03cfdb109c2728f8ba8594 \
                sha1 f22e7a39b5dbe9888d6f00994a5ee42cbca66d1d \
                rmd160 cc73025f112b9c8f4a4d2a1eae9e5da524d63939

worksrcdir      ${name}

patchfiles      patch-Makefile.diff
post-patch {
    reinplace "s|@CFLAGS@|${CFLAGS}|g" ${worksrcpath}/Makefile
    reinplace "s|@LDFLAGS@|${LDFLAGS}|g" ${worksrcpath}/Makefile
}

use_configure   no

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

build.target    ${name}
build.env       CC=${configure.cc}

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

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

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

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