# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: laloch <laloch@atlas.cz>

pkgname=qt-gstreamer
pkgver=1.2.0
pkgrel=4
arch=(x86_64)
pkgdesc="Qt bindings for GStreamer"
url='https://gstreamer.freedesktop.org/modules/qt-gstreamer.html'
license=(LGPL2.1)
depends=(qt5-declarative gst-plugins-good)
makedepends=(cmake boost doxygen python)
source=("https://gstreamer.freedesktop.org/src/$pkgname/$pkgname-$pkgver.tar.xz"
	gstreamer-1.6.patch
	gstreamer-1.16.patch
        qt-gstreamer-1.18.patch)
sha256sums=('9f3b492b74cad9be918e4c4db96df48dab9c012f2ae5667f438b64a4d92e8fd4'
            'adffd16ceb13a324858ff38b7bc01ea5129a439bda170e322598df4c7fa24637'
            'dfc2681ab1d157e08b838fb48f51d64fddf3b8ac25a4ec00051632db4f938668'
            'c62ddf19ef0079eed669585459d7031f69ddd18f7db2122c6e84f221ccb8afb5')

prepare() {
  cd $pkgbase-$pkgver
  patch -p1 -i ../gstreamer-1.6.patch # Fix build with gstreamer 1.6
  patch -p1 -i ../gstreamer-1.16.patch # Fix build with gstreamer 1.16
  patch -p1 -i ../qt-gstreamer-1.18.patch # Fix build with gstreamer 1.18
}

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DQTGSTREAMER_EXAMPLES=OFF \
    -DQT_VERSION=5
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
