# Maintainer: PktSurf <smlinux@pktsurf.in>
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-$version.tar.xz"
desc="Multimedia graph framework containing base plugins"
requires="alsa-lib libpng libjpeg-turbo libtheora opus gstreamer glu pango gtk3"

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

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

build() {
  mkdir -p smbuild && cd smbuild
  meson .. \
    --prefix="/" \
    --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="
144d42f2f8415645f19da23e0a2f6dc359569242d929463cb4fb982ad1f27c721391445815a99ed61a9ab0324b2e024c7c31492a955a210e4a0303711d496b7e  gst-plugins-base-1.16.2.tar.lz
"
