# SliTaz package receipt.

PACKAGE="hardinfo"
VERSION="0.5.1"
CATEGORY="system-tools"
SHORT_DESC="A tool to get hardware informations and perform benchmarks."
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL2"
TARBALL="$PACKAGE-$VERSION.tar.bz2"
WEB_SITE="https://github.com/lpereira/hardinfo"
WGET_URL="http://download.berlios.de/hardinfo/$TARBALL"

DEPENDS="gtk+ pciutils xorg-libXdamage"
BUILD_DEPENDS="gtk+ gtk+-dev"

# What is the latest version available today?
current_version()
{
	wget -O - $WEB_SITE/tags 2>/dev/null | \
	sed '/archive.*tar/!d;s|.*/[A-Za-z_-]*\(.*\).tar.*|\1|;q'
}

# Rules to configure and make the package.
compile_rules()
{
	while read file; do
		[ -f done.$file ] && continue
		patch -p0 < $stuff/$file || return 1
		touch done.$file
	done <<EOT
languages.patch
os.patch
EOT
	sed -i 's|uname -m|echo i686|' configure
	./configure \
		--prefix=/usr \
		$CONFIGURE_ARGS &&
	sed -i 's/^GTK_LIBS.*/& -lgmodule-2.0 -lm/' Makefile && make &&
	make DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/lib/$PACKAGE/modules $fs/usr/share/pixmaps
	cp -a $install/usr/bin $fs/usr
	cp -a $src/*.so $fs/usr/lib/$PACKAGE/modules
	cp -a $install/usr/share/$PACKAGE $fs/usr/share
	cd $fs/usr/share/pixmaps
	rm ../$PACKAGE/pixmaps/logo.xcf
	ln -s ../$PACKAGE/pixmaps/logo.png hardinfo.png
}