# Maintainer: Maxime Gauduin <alucryd@archlinux.org>

pkgname=ffms2
pkgver=2.40
pkgrel=1
pkgdesc='A libav/ffmpeg based source library and Avisynth plugin for easy frame accurate access'
arch=(x86_64)
url=https://github.com/FFMS/ffms2
license=(GPL)
depends=(ffmpeg)
makedepends=(
  avisynthplus
  git
)
optdepends=(
  'avisynthplus: AviSynth plugin'
  'vapoursynth: VapourSynth plugin'
)
provides=(
  avisynth-plugin-ffms2
  libffms2.so
  vapoursynth-plugin-ffms2
)
_tag=55c2af57f1bdc587ca98d2e28d3d764c00b3e13a
source=(git+https://github.com/FFMS/ffms2.git#tag=${_tag})
sha256sums=(SKIP)

pkgver() {
  cd ffms2

  git describe --tags
}

prepare() {
  cd ffms2

  mkdir -p src/config
  autoreconf -fiv
}

build() {
  cd ffms2

  export CXXFLAGS="$CXXFLAGS $(pkg-config --cflags avisynth)"

  ./configure \
    --prefix=/usr \
    --enable-avisynth \
    --enable-shared \
    --disable-static
  make
}

package() {
  make DESTDIR="${pkgdir}" -C ffms2 install

  for s in {avi,vapour}synth; do
    install -dm 755 "${pkgdir}"/usr/lib/$s
    ln -s ../libffms2.so "${pkgdir}"/usr/lib/$s/
  done
}

# vim: ts=2 sw=2 et:
