# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header$

inherit games

DESCRIPTION="Text-based pacman clone with many variants, sizes and other features"
HOMEPAGE="http://www.geocities.com/bsittler/#myman"
SRC_URI="http://zoehep.xent.com/~bsittler/${P}.tar.gz"

LICENSE="BSD-style"
SLOT="0"
KEYWORDS="~x86"
IUSE="ncurses widechars slang unicode"
## we can use xcurses, aka X flag, but it only launches some terminal, so it is
## simpler if we won't bother at all
## pdcurses not in portage so do not use them
RDEPEND="ncurses? ( sys-libs/ncurses )
	widechars? ( sys-libs/ncurses )
	slang? ( sys-libs/slang )
	unicode? ( slang? ( sys-libs/slang ) )
	"

DEPEND="${RDEPEND}"

src_compile() {
	if use unicode; then
		if use slang; then
			MYOPTS="--with-slang-utf8"
		fi
	else
		if use slang; then
			MYOPTS="--with-slang"
		fi
	fi
	egamesconf \
		$MYOPTS \
		$(use_with ncurses) \
		$(use_with widechars ncursesw) \
		--without-xcurses \
		|| die "Configure failed!"
	
	emake || die "Make failed!"
}

src_install() {
	emake DESTDIR="${D}" install || die "Install failed"
	PD="${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/image//usr/games/bin"
	cd ${PD}
	### ged rid of stuff we wont need ever
	### this uses ctheme, no ebuild: 
	### http://freshmeat.net/redir/ctheme/1584/url_homepage/ctheme
	### so when is ebuild remove this line
	rm myman.ct || die "failed to remove \"myman.ct\""
	### we don't want X (these are only bash files executing term and starting the game)
	rm xmyman* || die "failed to remove \"xmyman*\""
	rm xbigman || die "failed to remove \"xbigman\""
	rm xhugeman || die "failed to remove \"xhugeman\""
	rm xquackman || die "failed to remove \"xquackman\""
	prepgamesdirs
}