# $Id: Portfile 67323 2010-05-05 15:51:10Z vinc17@macports.org $

PortSystem 1.0

name            optipng
version         0.6.4
categories      graphics
maintainers     vinc17 openmaintainer
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     d6c10dd8d8f1d5b579221bc9cfbfbcb6 \
                sha1    ebb8d623c7f79c5c6942803bb96789103780bce9 \
                rmd160  6b5248c3c6b744315e70e86b49d998fe66759879

# 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

# Workaround for problem with MacPorts 1.8.0, which adds the
# --disable-dependency-tracking configure option with the
# universal variant, even though this option is not standard:
#   http://www.gnu.org/prep/standards/standards.html#Configuration
configure.universal_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.type  regex
livecheck.url   ${homepage}
livecheck.regex "Latest version:.*<b>OptiPNG&nbsp;(\\d+\\.\\d+\\.\\d+)</b>"
