# SliTaz package receipt.

PACKAGE="fluxbox"
VERSION="1.3.2"
CATEGORY="x-window"
SHORT_DESC="Fluxbox is a light and fast window manager for X."
MAINTAINER="pankso@slitaz.org"
TARBALL="$PACKAGE-$VERSION.tar.bz2"
WEB_SITE="http://www.fluxbox.org/"
WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
TAGS="wm window-manager"

DEPENDS="xorg fontconfig imlib2"
BUILD_DEPENDS="xorg fontconfig imlib2"

# Rules to configure and make the package.
compile_rules()
{
	cd $src
	#patch -p1 < $stuff/fluxbox-gcc-4.3.3.diff
	./configure $CONFIGURE_ARGS &&
	make && make install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/share/fluxbox/styles
	cp -a $install/usr/bin $fs/usr
	for f in apps keys overlay windowmenu init menu
	do
		cp -a $install/usr/share/fluxbox/$f $fs/usr/share/fluxbox
	done
	for s in Shade Flux bloe Results
	do
		cp -a $install/usr/share/fluxbox/styles/$s \
			$fs/usr/share/fluxbox/styles
	done
}

post_install()
{
	res=`cat $1/etc/slim.conf | grep ^session | sed s/"sessions. *"//`
	# Adding WM to SLIM available sessions.
	if ! echo "$res" | grep -q $PACKAGE; then
		echo -n "Adding $PACKAGE to /etc/slim.conf..."
		sed -i "s/^sessions.*/sessions            ${res},$PACKAGE/" /etc/slim.conf
		status
	fi
}

post_remove()
{
	# Remove WM from SLIM available sessions.
	if grep -q $PACKAGE $1/etc/slim.conf; then
		sed -i s/,$PACKAGE// $1/etc/slim.conf
	fi
}