# Contributor: Kiyoshi Aman <kiyoshi.aman@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libwebp
pkgver=0.6.1
pkgrel=0
pkgdesc="Libraries for working with WebP images"
url="https://developers.google.com/speed/webp/"
arch="all"
license="BSD"
makedepends="libpng-dev libjpeg-turbo-dev tiff-dev giflib-dev
	automake autoconf libtool"
subpackages="$pkgname-dev $pkgname-doc $pkgname-tools"
source="http://downloads.webmproject.org/releases/webp/libwebp-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	sh autogen.sh
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-static \
		--enable-libwebpmux \
		--enable-libwebpdemux \
		--enable-libwebpdecoder
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	mkdir -p "$pkgdir"/usr/share/doc/$pkgname
	install -Dm644 PATENTS README "$pkgdir"/usr/share/doc/$pkgname
}

tools() {
	pkgdesc="The WebP command line tools"
	mkdir -p "$subpkgdir"/usr/
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}

sha512sums="fece551d8fabdd8d7ba6807baa54a69a345f8690be4415dd0c0dea54002d78fe893a5d5aacfc13800300edd462b969d596709ac3213f6bc90f8e3698b2490d5f  libwebp-0.6.1.tar.gz"
