# Template file for 'hwinfo'
pkgname=hwinfo
version=23.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=1ffc00d07aa1ad766e861d0d8492e2d2fa52cf537807f34e1c80e8c2d56c7115
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
	}
}
