# Maintainer: Simon Zeni <simon@bl4ckb0ne.ca>
pkgname=libplacebo5
pkgver=5.264.1
pkgrel=5
pkgdesc="Reusable library for GPU-accelerated video/image rendering (v5)"
url="https://code.videolan.org/videolan/libplacebo"
arch="all"
license="LGPL-2.1-or-later"
makedepends="
	glslang-dev
	glslang-static
	lcms2-dev
	meson
	py3-glad
	py3-mako
	shaderc-dev
	spirv-tools-dev
	vulkan-loader-dev
	"
subpackages="$pkgname-dev"
source="https://code.videolan.org/videolan/libplacebo/-/archive/v$pkgver/libplacebo-v$pkgver.tar.gz"
builddir="$srcdir/libplacebo-v$pkgver"

# same filename for upgrade transaction
replaces="libplacebo"

build() {
	CFLAGS="$CFLAGS -O2" \
	CXXFLAGS="$CXXFLAGS -O2" \
	abuild-meson \
		-Db_lto=true \
		-Dbackend_max_links=4 \
		-Ddemos=false \
		-Dglslang=enabled \
		-Dlcms=enabled \
		-Dshaderc=enabled \
		-Dtests="$(want_check && echo true || echo false)" \
		-Dvulkan=enabled \
		. output
	meson compile -C output
}

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

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

dev() {
	default_dev
	depends="!libplacebo-dev"
}

sha512sums="
305f43b71f078f4113def43c444df667dfbdd2a6a34d3b457b15da0b3499ca97ec9a8acbd151d58c8e1a593ace3d8aa61067b32556c6bae451efbb217d60a731  libplacebo-v5.264.1.tar.gz
"
