# $Id: Portfile 51393 2009-05-24 00:49:29Z vinc17@macports.org $

PortSystem 1.0

name            optipng
version         0.6.3
categories      graphics
maintainers     vinc17
description     PNG file optimizer
long_description \
        OptiPNG is a PNG optimizer that recompresses the image files to a \
        smaller size, without losing any information.  The idea has been \
        inspired from pngcrush (http://pmt.sourceforge.net/pngcrush), and \
        is explained in detail in the PNG-Tech article 'A guide to PNG \
        optimization'.  The implementation is carried forward in OptiPNG, \
        which offers a faster execution per trial, and a wider search space.

platforms       darwin

homepage        http://optipng.sourceforge.net/
master_sites    sourceforge

checksums       md5     6cef405197a878acff4c6216cf38e871 \
                sha1    eba6e3c940588b1d02abfabc407e5c759a3fdd8a \
                rmd160  3ef55878defee86a57b8b0b268da1a7e9eca0d14

# Doesn't depend on libpng or zlib since it uses its own, modified versions

# Make sure gmake 3.81+ is used, as scripts/gcc.mak needs POSIX
# backslash-newline sequence compatibility.
depends_build   port:gmake

# Avoid --prefix option (not supported by OptiPNG's configure script).
configure.pre_args

build.cmd       ${prefix}/bin/gmake

destroot {
        xinstall -m 755 -d ${destroot}${prefix}/bin \
          ${destroot}${prefix}/share/doc/${name} \
          ${destroot}${prefix}/share/man/man1
        xinstall -m 755 -W ${worksrcpath}/src optipng ${destroot}${prefix}/bin
        eval xinstall -m 644 [glob ${worksrcpath}/doc/*] \
          ${worksrcpath}/README.txt ${destroot}${prefix}/share/doc/${name}
        xinstall -m 644 ${worksrcpath}/man/optipng.1 \
          ${destroot}${prefix}/share/man/man1
}

# The default SourceForge livecheck rule doesn't with OptiPNG.
livecheck.check regex
livecheck.url   ${homepage}
livecheck.regex "Latest version:.*<b>OptiPNG&nbsp;(\\d+\\.\\d+\\.\\d+)</b>"
