# SliTaz package receipt.

PACKED_SIZE="148.0K"
UNPACKED_SIZE="664.0K"
PACKAGE="lxpanel"
VERSION="0.6.2"
CATEGORY="x-window"
SHORT_DESC="LXDE panel"
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL2"
WEB_SITE="http://www.lxde.org/"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="$SF_MIRROR/lxde/$TARBALL"
CONFIG_FILES="/etc/lxpanel/default"
TAGS="LXDE gtk2 panel"
HOST_ARCH="i486 arm"

SUGGESTED="lxde lxsession slitaz-icon"
DEPENDS="alsa-lib gtk+ menu-cache wireless_tools libxml2 slitaz-menus"
BUILD_DEPENDS="gtk+-dev menu-cache-dev alsa-lib-dev wireless_tools-dev \
libxml2-dev lxmenu-data"

# Handle cross compilation
case "$ARCH" in
	i?86) 
		BUILD_DEPENDS="$BUILD_DEPENDS libwnck-dev" 
		pluglist="all" ;;
	arm*)
		pluglist="netstatus,volumealsa,cpu,batt,xkb,thermal,cpufreq,monitors" ;;
esac

# Rules to configure and make the package.
compile_rules()
{
	# Match default desktop colors
	sed -i s'/gdk_color_parse("green"/gdk_color_parse("#cfcfcf"/' \
		src/plugins/cpu/cpu.c || return 1
	./configure \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--with-plugins="$pluglist" \
		$CONFIGURE_ARGS &&
	make && make install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p \
		$fs/usr/lib \
		$fs/usr/share/lxpanel/images \
		$fs/etc/lxpanel \
		$fs/etc/xdg

	cp -a $install/usr/bin $fs/usr

	# Plugins (kbled -> lxpanel-extra)
	cp -a $install/usr/lib/lxpanel $fs/usr/lib
	find $fs -name kbled.so -delete
	find $fs -name wnckpager.so -delete

	# Images
	imgs=usr/share/lxpanel/images
	for i in clock cpufreq-icon my-computer; do
		cp -a $install/$imgs/$i.png $fs/$imgs
	done

	# Move profile to /etc/lxpanel (/usr maybe read-only) and default config
	cp -a $install/usr/share/lxpanel/profile/* $fs/etc/lxpanel
	ln -sf /etc/lxpanel $fs/usr/share/lxpanel/profile
	mv -f $fs/etc/lxpanel/default $fs/etc/lxpanel/original
	cp -a $stuff/default $fs/etc/lxpanel
	rm -rf $fs/etc/lxpanel/two_panels

	# XDG autostart desktop file (lxsession will use it automaticaly)
	cp -a $stuff/autostart $fs/etc/xdg

	cp -a $install/usr/share/lxpanel/ui $fs/usr/share/lxpanel
	cp -a $install/usr/share/lxpanel/x* $fs/usr/share/lxpanel
}

post_install()
{
	# clean LXPanel menu caches
	chroot "$1/" rm home/*/.cache/menus/* 2>/dev/null
	:
}
