# Template file for 'lm-sensors'
pkgname=lm_sensors
version=3.4.0
revision=3
build_style=gnu-makefile
make_build_args="MACHINE=${XBPS_TARGET_MACHINE#-musl}"
make_install_args="${make_build_args}
 PREFIX=/usr SBINDIR=/usr/bin MANDIR=/usr/share/man"
hostmakedepends="flex perl"
depends="perl"
conf_files="/etc/sensors3.conf"
short_desc="Utilities to read temperature/voltage/fan sensors"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-2, LGPL-2.1"
homepage="http://www.lm-sensors.org/"
# Host is unreachable
# distfiles="http://dl.lm-sensors.org/lm-sensors/releases/${pkgname}-${version}.tar.bz2"
distfiles="http://pkgs.fedoraproject.org/repo/pkgs/${pkgname}/${pkgname}-${version}.tar.bz2/c03675ae9d43d60322110c679416901a/${pkgname}-${version}.tar.bz2"
checksum=e0579016081a262dd23eafe1d22b41ebde78921e73a1dcef71e05e424340061f

pre_build() {
	sed -i prog/*/Module.mk \
		-e "/^MODULE_DIR :=/i LDFLAGS := ${LDFLAGS}" \
		-e 's;$(CC) $(EXLDFLAGS);$(CC) $(LDFLAGS) $(EXLDFLAGS);'
	sed -i 's,asm/io.h,sys/io.h,g' prog/dump/*.c
}
libsensors_package() {
	short_desc="Library to read temperature/voltage/fan sensors"
	pkg_install() {
		vmove "usr/lib/*.so.*"
	}
}
libsensors-devel_package() {
	depends="libsensors>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
		vmove usr/share/man/man3
	}
}
