# Template file for 'libsmbios'
pkgname=libsmbios
version=2.4.3
revision=2
build_style=gnu-configure
configure_args="--sbindir=/usr/bin --disable-static"
hostmakedepends="automake doxygen gettext gettext-devel help2man libtool pkg-config"
makedepends="libxml2-devel python3-devel"
checkdepends="python3"
short_desc="Library for SMBIOS access"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later, OLS-2.1"
homepage="https://github.com/dell/libsmbios"
distfiles="https://github.com/dell/libsmbios/archive/v${version}.tar.gz"
checksum=36c36a0f6b59190d6b4fef11696886e4511091929a5eb7ae7cf5fea0c32d3f58
# explicitly list the subpackages to make sure they are installed in the
# right order:
subpackages="libsmbios-devel python3-libsmbios libsmbios-utils"

archs="i686* x86_64*"

pre_configure() {
	./autogen.sh --no-configure
}

post_install() {
	rm -rf ${DESTDIR}/etc/yum ${DESTDIR}/usr/lib/yum-plugins
	vmkdir usr/include
	cp -r ${wrksrc}/out/public-include/* ${DESTDIR}/usr/include
	cp -r ${wrksrc}/src/include/smbios_c ${DESTDIR}/usr/include
}

libsmbios-devel_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
	}
}

python3-libsmbios_package() {
	depends="python3 ${sourcepkg}>=${version}_${revision}"
	short_desc+=" - python bindings"
	pkg_install() {
		vmove ${py3_sitelib}
		vmove usr/share/smbios-utils/cli.py

		vmove usr/bin/smbios-battery-ctl
		vmove usr/bin/smbios-keyboard-ctl
		vmove usr/bin/smbios-lcd-brightness
		vmove usr/bin/smbios-passwd
		vmove usr/bin/smbios-sys-info
		vmove usr/bin/smbios-thermal-ctl
		vmove usr/bin/smbios-token-ctl
		vmove usr/bin/smbios-wakeup-ctl
		vmove usr/bin/smbios-wireless-ctl
	}
}

libsmbios-utils_package() {
	short_desc+=" - utilities"
	pkg_install() {
		vmove usr/bin
		vmove usr/share/man/man1
	}
}
