PKGNAME=gstreamer
PKGSEC=libs
PKGDEP="a52dec aalib bluez bzip2 cairo cdparanoia chromaprint elfutils faac \
        faad2 ffmpeg flac fluidsynth game-music-emu glib glib-networking \
        graphene gsm gtk-4 jack json-glib ladspa-sdk lame libavc1394 libavtp \
        libbs2b libcaca libcap libcdio libdca libde265 libdrm libdv libdvdnav \
        libdvdread libfdk-aac libfreeaptx libglvnd libgudev libiec61883 \
        libldac liblrdf libltc libmicrodns libmpcdec libmpeg2 libnice \
        libraw1394 libshout libsidplay libsoup libtheora libunwind \
        libva libvisual libvpx libxkbcommon libxml2 lilv lv2 mesa mjpegtools \
        mpg123 neon nettle openal-soft opencore-amr openh264 opus orc \
        pulseaudio pygobject-3 qrencode rtmpdump sbc sdl2 soundtouch \
        spandsp srtp taglib twolame v4l-utils wavpack wayland \
        webrtc-audio-processing wildmidi x264 x265 zbar zlib zvbi zxing-cpp \
        dssim-c openjpeg rav1e libsodium"
PKGDEP__AMD64="${PKGDEP} openmpt svt-hevc"
PKGDEP__ARM64="${PKGDEP} openmpt"
BUILDDEP="bash-completion gobject-introspection graphviz llvm-20 \
          nasm opencv qt-5 rustc shaderc tomli vulkan-headers \
          vulkan-loader vulkan-validationlayers wayland-protocols"
PKGDES="Modular and extensible multimedia framework"

PKGDEP__RETRO=" \
	glib alsa-lib libgudev libjpeg-turbo libogg libpng \
	libvorbis libdrm x11-lib pango \
	cairo flac gdk-pixbuf lame libvpx mpg123 v4l-utils \
	libdvdread libdvdnav libva svt-av1 soundtouch bluez json-glib \
	curl libxml2 libwebp opus qrencode x265 fluidsynth game-music-emu \
	openmpt
"
PKGSUG__RETRO=" \
	mesa pulseaudio pipewire curl faac openal-soft
"
BUILDDEP__RETRO="$PKGSUG__RETRO \
	wayland-protocols iso-codes
"

PKGBREAK="gst-editing-services<=1.18.4-1 gst-libav-1-0<=1.18.4 \
          gst-plugins-bad-1-0<=1.18.5-1 gst-plugins-base-1-0<=1.18.0-1 \
          gst-plugins-good-1-0<=1.18.0-1 gst-plugins-ugly-1-0<=1.18.4-2 \
          gst-python-1-0<=1.18.4-1 gst-transcoder<=1:0 gstreamer-1-0<=1.18.0 \
          gstreamer-vaapi<=1.18.4"
PKGREP="${PKGBREAK}"

# Note: -Dlibnice=disabled, to use system dependency (enabled means using
# libnice sources in the subproject, WTF).
#
# Note: -Drs=disabled, Rust bindings are provided in `gst-plugins-rs` as
# they are not simply submodules but subprojects not shipped with `gstreamer`.
#
# FIXME: -Ddoc=disabled
# Downloading https://github.com/hotdoc/hotdoc_lumen_theme/releases/download/0.16/hotdoc_lumen_theme-0.16.tar.xz?sha256=b7d7dde51285d1c90836c44ae298754e4cfa957e9a6d14ee5844b8a2cac04b5a
# ...
# An unknown error happened while building the documentation and hotdoc cannot recover from it. Please report a bug with this error message and the steps to reproduce it
#
# FIXME: -Dsharp-disabled, we have not maintained gtk-sharp since Banshee.
# NOTE:  -Dexamples=disabled, one of the example program depends on the
#        webrtc-nice plugin, which is not available due to libnice support
#        being disabled.
MESON_AFTER=(
    '-Dpython=enabled'
    '-Dlibav=enabled'
    '-Dlibnice=disabled'
    '-Dbase=enabled'
    '-Dgood=enabled'
    '-Dbase=enabled'
    '-Dgood=enabled'
    '-Dugly=enabled'
    '-Dbad=enabled'
    '-Ddevtools=enabled'
    '-Dges=enabled'
    '-Drtsp_server=enabled'
    '-Dsharp=disabled'
    '-Drs=disabled'
    '-Dgst-examples=disabled'
    '-Dtls=enabled'
    '-Dqt5=enabled'
    '-Dgpl=enabled'
    '-Dtests=disabled'
    '-Dexamples=enabled'
    '-Dintrospection=enabled'
    '-Dnls=enabled'
    '-Dorc=enabled'
    '-Dorc-source=system'
    '-Ddoc=disabled'
    '-Dgtk_doc=disabled'
    '-Dpackage-origin=AOSC'
    '-Dgobject-cast-checks=disabled'
    '-Dglib-asserts=disabled'
    '-Dglib-checks=disabled'
    '-Dtests=disabled'
)
# FIXME: devtools requires very old nix.
# error[E0432]: unresolved import `self::consts`
#   --> /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nix-0.23.2/src/sys/ioctl/linux.rs:51:15
#    |
# 51 | pub use self::consts::*;
#    |               ^^^^^^ could not find `consts` in `self`
MESON_AFTER__LOONGARCH64=(
    "${MESON_AFTER[@]}"
    '-Ddevtools=disabled'
)
MESON_AFTER__LOONGARCH64_NOSIMD=("${MESON_AFTER__LOONGARCH64[@]}")
MESON_AFTER__RETRO=(
    "${MESON_AFTER[@]}"
    '-Dqt5=disabled'
    '-Dintrospection=disabled'
    '-Dexamples=disabled'
    '-Dpython=disabled'
    '-Ddevtools=disabled'
    '-Dges=disabled'
    '-Drtsp_server=disabled'
    '-Dorc=disabled'
)

ABTYPE=meson

# FIXME: ld.lld: error: relocation R_MIPS_64 cannot be used against local symbol; recompile with -fPIC
NOLTO__LOONGSON3=1

PKGPROV="gstreamer1.0-plugins-good_spiral gstreamer1.0-libav_spiral gstreamer1.0-plugins-ugly_spiral"

# Needed by Afterglow, whereas FAIL_ARCH defaults to mainline-only.
FAIL_ARCH="!(mainline|retro)"
