# Template file for 'i2c-tools'
pkgname=i2c-tools
version=4.3
revision=5
build_style=gnu-makefile
build_helper=python3
make_build_args="EXTRA=py-smbus"
make_install_args="sbindir=/usr/bin EXTRA=py-smbus"
hostmakedepends="python3 python3-setuptools"
makedepends="python3-devel"
depends="perl"
short_desc="Heterogeneous set of I2C tools"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="GPL-2.0-or-later"
homepage="https://i2c.wiki.kernel.org/index.php/I2C_Tools"
distfiles="https://mirrors.edge.kernel.org/pub/software/utils/i2c-tools/i2c-tools-${version}.tar.xz"
checksum=1f899e43603184fac32f34d72498fc737952dbc9c97a8dd9467fadfdf4600cf9
system_groups="i2c"

post_install() {
	vinstall "${FILESDIR}/45-i2c-tools.rules" 644 usr/lib/udev/rules.d
}

i2c-tools-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/share/man/man3
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
	}
}

python3-smbus_package() {
	short_desc+="Python 3 bindings for libi2c from i2c-tools"
	depends="${sourcepkg}>=${version}_${revision}"
	lib32disabled=yes
	pkg_install() {
		vmove "usr/lib/python3.*"
	}
}
