# Template file for 'libgpiod'
pkgname=libgpiod
version=2.2
revision=3
build_style="gnu-configure"
build_helper="python3"
configure_args="--prefix=/usr --enable-tools=yes --enable-bindings-cxx
 --enable-bindings-python --enable-gpioset-interactive"
hostmakedepends="doxygen pkg-config python3-build python3-pip"
makedepends="libedit-devel python3-devel"
short_desc="Library for interacting with the linux GPIO character device"
maintainer="Tim Sandquist <tim.sandquist@gmail.com>"
license="Apache-2.0, BSD-3-Clause, CC-BY-SA-4.0, CC0-1.0, GPL-2.0-only, GPL-2.0-or-later,
 LGPL-2.1-or-later, custom:Linux-syscall-note"
homepage="https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git"
distfiles="https://mirrors.edge.kernel.org/pub/software/libs/libgpiod/libgpiod-${version}.tar.gz"
checksum=f89c2176250f1a9563265479eb8ad5f22a63f42db6a1f438effc570f0254d2f5

post_build() {
	make doc
}

post_install() {
	vlicense LICENSES/BSD-3-Clause.txt
	vlicense LICENSES/Linux-syscall-note.txt
}

libgpiod-devel_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
		for f in doc/man/man3/*.3 ; do
			vman "$f"
		done
		vmkdir "usr/share/doc/${sourcepkg}"
		vcopy "${wrksrc}/doc/html" "usr/share/doc/${sourcepkg}"
	}
}

libgpiod-python3_package() {
	short_desc+=" - python bindings"
	pkg_install() {
		vmove "usr/lib/python3*"
	}
}

libgpiod-tools_package() {
	short_desc+=" - utilities"
	pkg_install() {
		vmove usr/bin
	}
}
