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

inherit toolchain-funcs games

DESCRIPTION="An SDL NetWalk clone"
HOMEPAGE="http://rooster.stanford.edu/~ben/netwalk/"
SRC_URI="http://rooster.stanford.edu/~ben/${PN}/${P}.tgz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE=""

DEPEND="media-libs/libsdl
	media-libs/sdl-ttf"

src_unpack() {
	unpack ${A}
	cd "${S}"

	sed -i \
		-e "s:^#define NETWALK_SHARE_DIR.*:#define NETWALK_SHARE_DIR \"${GAMES_DATADIR}/${PN}\":" \
		linux/config_file.c \
		|| die "sed failed"
}

src_compile() {
	emake \
		CC="$(tc-getCC)" \
		CFLAGS="${CFLAGS} `sdl-config --cflags`" \
		|| die "emake failed"
}

src_install() {
	dogamesbin netwalk || die "dogamesbin failed"
	insinto "${GAMES_DATADIR}/${PN}"
	doins helmetr.ttf || die "doins failed"
	dodoc NEWS README
	prepgamesdirs
}