# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gst-plugins-ugly
pkgver=1.24.7
pkgrel=0
pkgdesc="GStreamer streaming media framework ugly plug-ins"
url="https://gstreamer.freedesktop.org"
arch="all"
license="GPL-2.0-or-later LGPL-2.0-or-later"
replaces="gst-plugins-ugly1"
makedepends="
	a52dec-dev
	glib-dev
	gst-plugins-base-dev
	gstreamer-dev
	libcdio-dev
	libdvdread-dev
	libmpeg2-dev
	meson
	orc-dev
	x264-dev
	"
source="
https://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-$pkgver.tar.xz
x264_tests.patch
"

subpackages="$pkgname-lang"
ldpath="/usr/lib/gstreamer-1.0"

# secfixes:
#   1.22.5-r0:
#     - CVE-2023-38104
#     - CVE-2023-38103
#   1.10.4-r0:
#     - CVE-2017-5846
#     - CVE-2017-5847

build() {
	CFLAGS="$CFLAGS -O2" \
	CXXFLAGS="$CXXFLAGS -O2" \
	CPPFLAGS="$CPPFLAGS -O2" \
	abuild-meson \
		-Db_lto=true \
		-Dpackage-origin="https://alpinelinux.org" \
		-Dpackage-name="GStreamer ugly plug-ins (Alpine Linux)" \
		-Dgpl=enabled \
		-Dcdio=disabled \
		-Ddvdread=disabled \
		-Dmpeg2dec=disabled \
		. output
	meson compile -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

check() {
	meson test -C output --print-errorlogs
}

doc() {
	default_doc
	replaces="${pkgname}1-doc"
}

sha512sums="
fcf2b6462e6a281e01452ca71234dd5c274f7b3f1524b94ae661491f9270e286faf2b2c72ce0c85cbefa1256d8e135349271e3ab01e8d8ce05abdda8ffb8b2b8  gst-plugins-ugly-1.24.7.tar.xz
730a88a20534f77d10ed1543f6e7fcc8825e75c4bba007de02017fc89569f9e5dfd3d383d3479448f687825bb27b19335c0957c360846e5e3e33735b7a7d3bf6  x264_tests.patch
"
