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

inherit games

DESCRIPTION="Curses based interpreter for TADS 2 and TADS 3 text adventures."
HOMEPAGE="http://www.tads.org/frobtads.htm"
SRC_URI="http://www.tads.org/frobtads/${P}.tar.gz
	tads2compiler? ( http://www.tads.org/frobtads/t2comp-${PV}.tar.gz )
	tads3compiler? ( http://www.tads.org/frobtads/t3comp-${PV}.tar.gz )"

LICENSE="TADS"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="tads2compiler tads3compiler"
DEPEND="sys-libs/ncurses"

src_unpack() {
	unpack ${A}
	use tads2compiler && mv -f t2compiler/* "${P}"/t2compiler
	use tads3compiler && mv -f t3compiler/* "${P}"/t3compiler
}


src_compile() {
	CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing"
	egamesconf || die "configure failed"
	emake || die "emake failed"
}

src_install() {
	emake DESTDIR="${D}" install || die "Install failed"
	dodoc doc/{AUTHORS,BUGS,COMPILERS,ChangeLog,NEWS,README,THANKS}
	prepgamesdirs
}