Receipt for: blackbox

source stuff/blackbox-0.70.1-asneeded.patch stuff/blackbox-0.70.1-gcc-4.3.patch stuff/menu stuff/textpropertytostring-unconditional.patch
# SliTaz package receipt.

PACKAGE="blackbox"
VERSION="0.77"
CATEGORY="x-window"
TAGS="window-manager"
SHORT_DESC="A small, fast, full-featured window manager for X."
MAINTAINER="devl547@gmail.com"
LICENSE="MIT"
WEB_SITE="https://github.com/bbidulock/blackboxwm"
REPOLOGY="blackbox-wm"

TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="$WEB_SITE/archive/$VERSION.tar.gz"

SUGGESTED="blackbox-lang"
DEPENDS="xorg-libXft xorg-libXt"
BUILD_DEPENDS="autoconf automake gcc83 libtool libxml2-dev xorg-libXft-dev 
	xorg-libXt-dev xorg-xextproto"

# What is the latest version available today?
current_version()
{
	wget -O - ${WGET_URL%/arch*}/releases 2>/dev/null | \
	sed '/tag\//!d;s|.*tag/v*||;s|".*||;q'
}

# Rules to configure and make the package.
compile_rules()
{
#	patch -p1 < $stuff/blackbox-0.70.1-gcc-4.3.patch
#	patch -p0 < $stuff/blackbox-0.70.1-asneeded.patch
#	patch -p1 < $stuff/textpropertytostring-unconditional.patch

	# autogen runs autoreconf but libtoolize drops ltmain.sh in ./ while
	# AC_CONFIG_AUX_DIR([scripts]) expects it in scripts/ -- stage it there.
	./autogen.sh || true
	[ -f ltmain.sh ] && { mkdir -p scripts; cp -f ltmain.sh scripts/; }
	autoreconf -fi &&
	./configure			\
		CC=gcc-83		\
		CXX=g++-83		\
		--sysconfdir=/etc	\
		--libexecdir=/usr/bin	\
		--mandir=/usr/share/man	\
		$CONFIGURE_ARGS &&
	make &&
	make DESTDIR=$DESTDIR install
}

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

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

	# menu suitable for SliTaz
	cp -a $stuff/menu			$fs/usr/share/blackbox
}

post_install()
{
	res=$(cat "$1/etc/slim.conf" | grep ^session | sed s/"sessions. *"//)
	# Add window manager to SLIM available sessions.
	if ! echo "$res" | grep -q $PACKAGE
	  then
		sed -i	"s|^sessions.*|sessions            ${res},$PACKAGE|" \
			"$1/etc/slim.conf"
	fi
}

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