# SliTaz package receipt.

PACKAGE="lxpanel"
VERSION="0.5.8"
CATEGORY="x-window"
SHORT_DESC="Standard compliant desktop panel."
MAINTAINER="pankso@slitaz.org"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="http://www.lxde.org/"
WGET_URL="$SF_MIRROR/lxde/$TARBALL"
CONFIG_FILES="/etc/lxpanel/default"

DEPENDS="glibc-base glib libgio expat zlib menu-cache slitaz-icon \
gtk+ alsa-lib wireless_tools"
BUILD_DEPENDS="gtk+-dev gettext expat-dev intltool menu-cache-dev \
lxmenu-data alsa-lib-dev wireless_tools-dev"

# Rules to configure and make the package.
compile_rules()
{
	cd $src
        patch -p1 -i $stuff/batt.chg.level.patch
	patch -p1 -i $stuff/configure_desktop_number.patch
	patch -p1 -i $stuff/fix_position.patch
	patch -p0 -i $stuff/cpu-size-color.patch || exit 1
	./configure --with-plugins=all $CONFIGURE_ARGS &&
	make && make install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/share $fs/usr/lib
	
	cp -a $install/usr/bin $fs/usr
	cp -a $install/usr/lib/lxpanel $fs/usr/lib
	cp -a $install/usr/share/lxpanel $fs/usr/share

	# Remove a few "heavy" and unuseful images (ns* goes in extra)
	for i in file-manager* stock_volume* gnome-[a-m]*.png \
		gnome-netstatus-[d-t]*.png my-* ns-*.png *lock-*.png
	do
		rm $fs/usr/share/lxpanel/images/$i
	done

	# Custom images to match SliTaz theme.
	cp -a stuff/images/* $fs/usr/share/lxpanel/images

	# Remove plugins --> lxpanel-extra
	rm $fs/usr/lib/lxpanel/plugins/kbled.so
	rm -rf $fs/usr/share/lxpanel/images/xkb-flags

	# Move profile to /etc/lxpanel (/usr maybe read-only) and default config
	mkdir $fs/etc
	mv -f $fs/usr/share/lxpanel/profile $fs/etc/lxpanel
	ln -s /etc/lxpanel $fs/usr/share/lxpanel/profile
	mv $fs/etc/lxpanel/default $fs/etc/lxpanel/original
	cp -a stuff/default $fs/etc/lxpanel

	# lxsession-logout fake
	cat > $fs/usr/bin/lxsession-logout << "EOT"
#!/bin/sh
# lxsession-logout fake.
#
tazbox logout &
exit 0
EOT
	chmod +x $fs/usr/bin/lxsession-logout
}