# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libcec4
pkgver=4.0.7
pkgrel=3
pkgdesc="libcec for the Pulse-Eight USB-CEC adapter - 4.0.x"
url="https://github.com/Pulse-Eight/libcec"
arch="all"
license="GPL-2.0-or-later"
depends_dev="
	eudev-dev
	libxrandr-dev
	python3-dev
	swig
	"
makedepends="$depends_dev
	cmake
	p8-platform-dev
	samurai
	"
subpackages="$pkgname-dev py3-$pkgname:py3 $pkgname-tools"
source="https://github.com/Pulse-Eight/libcec/archive/libcec-$pkgver.tar.gz
	musl-1.2.3.patch
	"

builddir="$srcdir/libcec-libcec-$pkgver"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

py3() {
	amove usr/lib/python*
}

tools() {
	pkgdesc="$pkgdesc (tools)"
	provides="libcec-tools=$pkgver-r$pkgrel"

	amove usr/bin
}

sha512sums="
424540a45f9cae3d5dcccc615d487c45033f9cdeb665b8176832495597e2cd58ef7681e13b52f6a32f8a40e1146c04a1a383f5785ea1e731c5c517a9a7843a81  libcec-4.0.7.tar.gz
0aa63e622ecf3d9009efc06db801c7a5558aa30a0543701e2e12bf052a54155240fc2d2bf339aab1af7288c3e85c7edf5087e4de6ce800398fba05897cf6d22f  musl-1.2.3.patch
"
