makedepends=(glib graphene gstreamer-plugins-base gtk4 cairo cargo-c dav1d gstreamer-plugins-bad gstreamer-plugins-good libsodium pango rustc)

description="Multimedia graph framework"
url="https://gstreamer.freedesktop.org/"

packager="Great-OS Team"
maintainer="Great-OS Team"

name="gstreamer-plugins-gtk4"
version="0.13"
release=2

source=(https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/archive/$version/gst-plugins-rs-$version.tar.gz)

build() {

  _cargo_c_options=(--prefix /usr
                    --library-type cdylib
                    --features asm,dmabuf,dssim,gtk_v4_16,v1_22,wayland,x11egl,x11glx
                    --workspace
                    --exclude gst-plugin-csound
                    --exclude gst-plugin-ndi
                    --exclude gst-plugin-uriplaylistbin)

  # Link with libsodium from system
  export SODIUM_USE_PKG_CONFIG=1

  # Use debug export
  CARGO_PROFILE_RELEASE_DEBUG=2

  # Use LTO export
  CARGO_PROFILE_RELEASE_LTO=true CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1

  cd gst-plugins-rs-$version
  cargo cbuild -p gst-plugin-gtk4 "${_cargo_c_options[@]}"

  mkdir -pv $PKG/usr/lib/{,pkgconfig}
  mv target/x86_64-unknown-linux-gnu/debug/libgstgtk4.so $PKG/usr/lib/
  mv target/x86_64-unknown-linux-gnu/debug/gstgtk4.pc $PKG/usr/lib/pkgconfig/
}
