# Template file for 'hwinfo'
pkgname=hwinfo
version=22.2
revision=1
build_style=gnu-makefile
make_use_env=yes
make_build_args="HWINFO_VERSION=${version} LIBDIR=/usr/lib${XBPS_TARGET_WORDSIZE}"
make_install_args="${make_build_args}"
hostmakedepends="perl flex"
makedepends="libx86emu-devel libuuid-devel"
short_desc="Hardware information tool"
maintainer="meator <meator.dev@gmail.com>"
license="GPL-2.0-or-later"
homepage="https://github.com/openSUSE/hwinfo"
distfiles="https://github.com/openSUSE/hwinfo/archive/refs/tags/${version}.tar.gz"
checksum=53f55f9072f0dddf36439645e70fda82431327cd2262a741390af4bd665b6713
disable_parallel_build=yes

if [ "$CROSS_BUILD" ]; then
	hostmakedepends+=" hwinfo"
fi

post_patch() {
	if [ "$CROSS_BUILD" ]; then
		for p in ${FILESDIR}/*; do
			patch -p1 < $p
		done
	fi
}

pre_build() {
	if [ "$CROSS_BUILD" ]; then
		CC=gcc CFLAGS= LDFLAGS= make ${make_build_args} -C src/isdn/cdb isdn_cdb.h
		make -C src/isdn/cdb clean
	fi
}

post_install() {
	mv ${DESTDIR}/usr/sbin ${DESTDIR}/usr/bin

	for m in doc/*.[1-9]; do
		vman ${m}
	done
}

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