# Contributor: Alex Yam <alex@alexyam.com>
# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Simon Zeni <simon@bl4ckb0ne.ca>
pkgname=libplacebo
pkgver=6.338.2
pkgrel=2
# rc testing
_pkgver=${pkgver/_/-}
pkgdesc="Reusable library for GPU-accelerated video/image rendering"
url="https://code.videolan.org/videolan/libplacebo"
arch="all"
license="LGPL-2.1-or-later"
makedepends="
	glslang-dev
	glslang-static
	lcms2-dev
	libdovi-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"

build() {
	CFLAGS="$CFLAGS -O2" \
	CXXFLAGS="$CXXFLAGS -O2" \
	abuild-meson \
		-Db_lto=true \
		-Dbackend_max_links=4 \
		-Ddemos=false \
		-Ddovi=enabled \
		-Dglslang=enabled \
		-Dlcms=enabled \
		-Dlibdovi=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
}

sha512sums="
0f20ae47bc2a7cd128d667ec2dd750a2d6ad5f16be6ab97122c2dda1ebf239958ee4bf453a7f835bea2dafb60a2e27b795801532aad994e002854c190aa6bbd8  libplacebo-v6.338.2.tar.gz
"
