# $Id$
# Maintainer: Pierre Schmitz <pierre@archlinux.de>

pkgname=gd
pkgver=2.2.5
pkgrel=1
pkgdesc="Library for the dynamic creation of images by programmers"
arch=('x86_64')
url="http://www.libgd.org/"
license=('custom')
depends=('fontconfig' 'libxpm' 'libwebp')
optdepends=('perl: bdftogd script')
checkdepends=('ttf-liberation')
source=("https://github.com/libgd/libgd/releases/download/gd-${pkgver}/libgd-${pkgver}.tar.xz")
md5sums=('8d8d6a6189513ecee6e893b1fb109bf8')

build() {
  cd libgd-${pkgver}
  ./configure \
    --prefix=/usr \
    --disable-rpath
  make
}

check() {
  cd libgd-${pkgver}
  # see https://github.com/libgd/libgd/issues/302
  [[ ${CARCH} == 'i686' ]] || FREETYPE_PROPERTIES='truetype:interpreter-version=35' make check
}

package() {
  cd libgd-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -D -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}