# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: 
pkgname=libgd
pkgver=2.2.5
pkgrel=0
pkgdesc="Library for dynamic image creation"
url="http://libgd.github.io/"
arch="all"
options="!check"  # Upstream bug 201 regression.
license="MIT"
depends=""
makedepends="bash fontconfig-dev freetype-dev libjpeg-turbo-dev libpng-dev
	libwebp-dev zlib-dev"
subpackages="$pkgname-dev"
replaces="gd"
source="https://github.com/$pkgname/$pkgname/releases/download/gd-$pkgver/$pkgname-$pkgver.tar.xz
	CVE-2016-7568.patch
	"

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--disable-werror
	make
}

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

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
}

dev() {
	default_dev
	depends="$pkgname perl"
	replaces="gd-dev"
	mv "$pkgdir"/usr/bin/bdftogd "$subpkgdir"/usr/bin
}

sha512sums="e4598e17a277a75e02255402182cab139cb3f2cffcd68ec05cc10bbeaf6bc7aa39162c3445cd4a7efc1a26b72b9152bbedb187351e3ed099ea51767319997a6b  libgd-2.2.5.tar.xz
8310d11a2398e8617c9defc4500b9ce3897ac1026002ffa36000f1d1f8df19336005e8c1f6587533f1d787a4a54d7a3a28ad25bddbc966a018aedf4d8704a716  CVE-2016-7568.patch"