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

DESCRIPTION="Twin is a text-mode window environment with built-in window \
manager, linux console emulator, and remote display capabilities."
HOMEPAGE="http://sourceforge.net/projects/twin/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"

LICENSE="|| ( GPL-2 LGPL-2 )"
SLOT="0"
KEYWORDS="~arm ~amd64 ~x86"
IUSE="unicode oldgtk X xml ncurses"

# The build fails with a parallen make
MAKEOPTS="-j1"

DEPEND="
	X? (
		oldgtk? ( =x11-libs/gtk+-1.2* )
		x11-libs/libX11
	)
	ncurses? ( sys-libs/ncurses )
	sys-libs/gpm
"
RDEPEND="${DEPEND}"

src_compile() {
	econf \
		$(use_enable unicode -unicode ) \
		$(use_enable ncurses hw-tty-termcap ) \
		$(use_enable oldgtk tt-hw-gtk ) \
		$(use_enable xml tt-hw-xml ) \
		$(use_with X x )

	emake || die "emake failed"
}

src_install() {
	einstall || die "einstall failed"
	dodoc README BUGS || die
}