# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Andreas Radke <andyrtr@archlinux.org>

_pkgname=xcb-util-image
pkgname=$_pkgname-static
pkgver=0.4.0
pkgrel=3
pkgdesc="Utility libraries for XC Binding - Port of Xlib's XImage and XShmImage functions"
arch=('x86_64')
url="https://xcb.freedesktop.org"
license=('custom')
depends=('libxcb-static>=1.7' 'xcb-util-static>=0.3.9')
makedepends=('xorg-util-macros' 'xorgproto')
options=(!emptydirs !docs staticlibs)
source=("https://xcb.freedesktop.org/dist/${_pkgname}-${pkgver}.tar.bz2")
sha512sums=('9b7202c054e1160f9ca97a86be1210d9fb47f2119f89ca85f15f20909cca884bfe0cb88e3e71c75b65e1a0a72b980066ccac810e41a91db895c74dde77440d4f')

build() {
  cd ${_pkgname}-${pkgver}
  export PKG_CONFIG_PATH=/usr/static/lib/pkgconfig:/usr/lib/pkgconfig
  export PATH=$PWD:$PATH
  printf '#!/usr/bin/bash\nexec /usr/bin/pkg-config --static "$@"\n' > pkg-config
  chmod +x pkg-config
  ./configure --prefix=/usr/static --disable-shared --enable-static
  make
}

check() {
  cd ${_pkgname}-${pkgver}
  make check
}

package() { 
  cd ${_pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install

  install -D -m644 COPYING \
    "${pkgdir}"/usr/share/licenses/${pkgname}/COPYING
}
