Receipt for: cgames

source
# SliTaz package receipt.

PACKAGE="cgames"
VERSION="2.2b"
CATEGORY="games"
SHORT_DESC="Games for the Linux Console."
MAINTAINER="pascal.bellard@slitaz.org"
LICENSE="GPL2"
WEB_SITE="https://www.muppetlabs.com/~breadbox/software/cgames.html"

TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="https://www.muppetlabs.com/~breadbox/pub/software/$TARBALL"

DEPENDS="ncurses"
BUILD_DEPENDS="ncurses-dev"

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

# Rules to configure and make the package.
compile_rules()
{
	export LDFLAGS="$LDFLAGS -ltinfo"
	# SliTaz narrow libncurses lacks keypad; link the wide libncursesw instead
	# (-lncurses is injected by configure via LOADLIBES)
	find . -name configure -exec sed -i 's/-lncurses\b/-lncursesw/g' {} +

	sed -i	-e 's|install -.*\$|&(destdir)/$|'	\
		-e "s|^prefix|destdir = $DESTDIR\\n&|"	\
		-e 's/g games/g root/'			\
		*/Makefile.in
	sed -i 's/.* getline(.*/#define getline mygetline\n&/' \
		*/fileread.h

	./configure			\
		--prefix=/usr		\
		--mandir=/usr/share/man	\
		--datadir=/usr/share	\
		--disable-mouse		\
		--with-ncurses		\
		$CONFIGURE_ARGS &&
	make &&
	make install
}

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

	cp -a $install/usr/games		$fs/usr
	cp -a $install/usr/share/cblocks	$fs/usr/share
	cp -a $install/usr/share/csokoban	$fs/usr/share

	find $fs -type f -name '*.txt' -exec chmod a-x \{\} \;
}