# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=giflib
pkgver=5.1.4
pkgrel=1
pkgdesc="A library for reading and writing gif images"
url="https://sourceforge.net/projects/giflib/"
arch="all"
license="MIT"
subpackages="$pkgname-dev $pkgname-doc $pkgname-utils"
depends=
makedepends="libx11-dev libsm-dev util-linux-dev xmlto"
source="http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.bz2
	xmlto-skip-validation.patch"

_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build () {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-static \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
	install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING \
		|| return 1
}

utils() {
	pkgdesc="Programs for manipulating GIF format image files"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}

md5sums="2c171ced93c0e83bb09e6ccad8e3ba2b  giflib-5.1.4.tar.bz2
e1ae3d46e40a8609231dea3075388d4a  xmlto-skip-validation.patch"
sha256sums="df27ec3ff24671f80b29e6ab1c4971059c14ac3db95406884fc26574631ba8d5  giflib-5.1.4.tar.bz2
2244e339343d027044732e47bce2b0bdb3e6d9c472963748af4adb2304374022  xmlto-skip-validation.patch"
sha512sums="32b5e342056c210e6478e9cb3b6ceec9594dcfaf34feea1eb4dad633a081ed4465bceee578c19165907cb47cb83912ac359ceea666a8e07dbbb5420f9928f96d  giflib-5.1.4.tar.bz2
36f92cb092ee9dc463aa1b6b9857d1a1591fa5ed6bf973b02385a979a7178cf2c1f7fc75d6474c2fa90c090e9659178ab8cfe6bb3e147425828a1b5a59ca6f06  xmlto-skip-validation.patch"
