# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 89247 2012-01-22 00:11:55Z ryandesign@macports.org $

PortSystem              1.0

name                    webp
version                 0.1.3
categories              graphics science devel
platforms               darwin
maintainers             ryandesign openmaintainer
license                 BSD

description             image format library providing lossy compression \
                        for photographic images

long_description        WebP is a new image format that provides lossy \
                        compression for photographic images. In a large \
                        scale study of 900,000 web images, WebP images \
                        were 39.8% smaller than jpeg images of similar \
                        quality. \
                        \
                        A WebP file consists of VP8 image data, and a \
                        container based on RIFF. Webmasters, web developers \
                        and browser developers can use the WebP format \
                        to create smaller, better-looking images that can \
                        help make the web faster.

homepage                http://code.google.com/p/webp/
master_sites            googlecode

checksums               rmd160  aa84fea974461f1fea074b9983c40759f635b998 \
                        sha256  40b18456e39b2822311b0ea161d6f09507cf5e8e937b02b9be3ee994ded67aba

depends_lib             port:zlib \
                        port:libpng \
                        port:jpeg

distname                libwebp-${version}

post-extract {
    # I'm going mad trying to develop this port when I can't access its files.
    fs-traverse item ${worksrcpath} {
        if {[file isdirectory ${item}]} {
            file attributes ${item} -permissions a+rx
        } elseif {[file isfile ${item}]} {
            file attributes ${item} -permissions a+r
        }
    }
}

patchfiles              patch-src-dsp-cpu.c.diff

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        AUTHORS \
        ChangeLog \
        COPYING \
        NEWS \
        PATENTS \
        README \
        ${docdir}
}

variant debug description {Compile with debugging information and reduce optimization level} {
    configure.optflags -O1
    configure.cflags-append -ggdb
    configure.cxxflags-append -ggdb
}

livecheck.name          ${name}
livecheck.regex         /libwebp-(\[0-9.\]+)${extract.suffix}
