# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-wm/sawfish/sawfish-1.3.3.ebuild,v 1.7 2008/10/06 17:13:50 truedfx Exp $

inherit eutils

DESCRIPTION="Extensible window manager using a Lisp-based scripting language"
HOMEPAGE="http://sawfish.wikia.com/"
SRC_URI="mirror://sourceforge/sawmill/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="alpha amd64 ia64 ppc ppc64 sparc x86"
IUSE="gnome esd nls audiofile"

RDEPEND=">=x11-libs/rep-gtk-@REP_GTK_MIN_VER@
	>=dev-libs/librep-@REP_MIN_VER@
	>=x11-libs/gtk+-@GTK_MIN_VER@
	>=x11-libs/pango-@PANGO_MIN_VER@
	audiofile? ( >=media-libs/audiofile-@AUDIOFILE_MIN_VER@ )
	esd? ( >=media-sound/esound-@ESD_MIN_VER@ )
	nls? ( sys-devel/gettext )"
DEPEND="${RDEPEND}
	>=dev-util/pkgconfig-0.12.0"

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

src_compile() {
	# Make sure we include freetype2 headers before freetype1 headers,
	# else Xft2 borks, <azarah@gentoo.org> (13 Dec 2002)
	export C_INCLUDE_PATH="${C_INCLUDE_PATH}:/usr/include/freetype2"
	export CPLUS_INCLUDE_PATH="${CPLUS_INCLUDE_PATH}:/usr/include/freetype2"

	set -- \
		--with-gdk-pixbuf \
		$(use_with audiofile) \
		$(use_with esd) 

	if use gnome; then
		set -- "$@" \
			--with-gnome-prefix=/usr \
			--enable-gnome-widgets 
	else
		set -- "$@" \
			--disable-gnome-widgets 
	fi

	if ! use nls; then
		set -- "$@" \
			--disable-nls

	fi

	econf "$@" || die "configure failed"

	# The following two lines allow sawfish to compile with gcc 2.95
	# (see bug 18294)
	sed -i -e 's:REP_CFLAGS=:REP_CFLAGS=-I/usr/include/freetype2 :' Makedefs

	emake || die "make failed"
}

src_install() {
	emake DESTDIR="${D}" install || die "make install failed"
	dodoc AUTHORS ChangeLog FAQ NEWS README TODO OPTIONS README.IMPORTANT KEYBINDINGS USERDOC COPYING COPYING.SOUNDS
}
