# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake udev

MY_PN="libwebcam"

HOMEPAGE="https://sourceforge.net/projects/libwebcam/"
DESCRIPTION="Manage dynamic controls in uvcvideo"
SRC_URI="mirror://sourceforge/${MY_PN}/${MY_PN}-src-${PV}.tar.gz"

KEYWORDS="~amd64"
SLOT="0"
LICENSE="GPL-3"
IUSE="static-libs"

DEPEND="dev-libs/libxml2:*"
RDEPEND="${DEPEND}"

S="${WORKDIR}/${MY_PN}-${PV}"

PATCHES=( "${FILESDIR}/${P}-nocompress.patch" )

src_install() {
	cmake_src_install
	use static-libs || rm -fr "${D}"/usr/lib*/${MY_PN}.a
}

pkg_postinst() {
	udev_reload
}

pkg_postrm() {
	udev_reload
}