app=gst-plugins-base
version=1.16.2
build=1sml
homepage='https://gstreamer.freedesktop.org/'
download='https://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-1.16.2.tar.xz'
desc='Multimedia graph framework containing base plugins'
requires="alsa-lib libpng libjpeg-turbo libtheora opus gstreamer glu pango gtk3"

build() {
  mkandenterbuilddir
  rm -rf $app-$version

  tar xf $srcdir/$app-$version.tar.?z*
  cd $app-$version
  fixbuilddirpermissions

  mkdir -p smbuild && cd smbuild
  meson .. \
    --prefix="/" \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --buildtype=plain \
    -Dalsa=enabled \
    -Dintrospection=disabled 

  if [ "$ARCH" = "aarch64" ]; then
    # https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/577
    sed -i 's@GST_GL_HAVE_DMABUF 1@GST_GL_HAVE_DMABUF 0@g' gst-libs/gst/gl/gstglconfig.h
    sed -i 's@GST_GL_HAVE_EGLUINT64KHR 1@GST_GL_HAVE_EGLUINT64KHR 0@g' gst-libs/gst/gl/gstglconfig.h
  fi

  ninja
  DESTDIR="$pkg" ninja install

  cp ../COPYING $pkgdocs/

  mkfinalpkg
}

sha512sums="
f28e71bba8ba25d4f18ba3a196f057721151f1ebf1309d808bd6771a3f9a68facfa1970dc4353b6f2fd1e8945edf5272854d328ea11ef399544f8b330f754a42  gst-plugins-base-1.16.2.tar.xz
"
