# Description: VDPAU back-end for NVIDIA and VIA chipsets.
# URL: http://freedesktop.org/wiki/Software/vaapi
# Maintainer: unmaintained
# Depends on: libva libvdpau

name=libva-vdpau-driver
version=0.7.4
release=7
source=(https://www.freedesktop.org/software/vaapi/releases/$name/$name-$version.tar.bz2
  libva-vdpau-driver-0.7.4-glext-missing-definition.patch
  libva-vdpau-driver-0.7.4-libvdpau-0.8.patch
  libva-vdpau-driver-0.7.4-VAEncH264VUIBufferType.patch
  libva-vdpau-driver-0.7.4-sigfpe-crash.patch
  libva-vdpau-driver-0.7.4-include-linux-videodev2.h.patch)

build() {
  cd $name-$version

  patch -p1 -i $SRC/libva-vdpau-driver-0.7.4-glext-missing-definition.patch
  patch -p1 -i $SRC/libva-vdpau-driver-0.7.4-libvdpau-0.8.patch
  patch -p1 -i $SRC/libva-vdpau-driver-0.7.4-VAEncH264VUIBufferType.patch
  patch -p1 -i $SRC/libva-vdpau-driver-0.7.4-sigfpe-crash.patch
  patch -p1 -i $SRC/libva-vdpau-driver-0.7.4-include-linux-videodev2.h.patch

  sed -i 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:' configure.ac
  autoreconf -i

  ./configure \
    --prefix=/usr \
    --enable-glx

  make
  make DESTDIR=$PKG install
}
