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

EAPI=1

inherit eutils multilib qt4 subversion

ESVN_REPO_URI="svn://svn.berlios.de/canorus/trunk"
ESVN_PROJECT="canorus"

DESCRIPTION="Graphical Score-editor using Qt4"
HOMEPAGE="http://canorus.berlios.de"
SRC_URI=""

LICENSE="GPL-2"
SLOT="0"
KEYWORDS=""

IUSE="python ruby"


DEPEND="|| ( ( x11-libs/qt-core x11-libs/qt-gui
		x11-libs/qt-xmlpatterns x11-libs/qt-svg
		x11-libs/qt-webkit x11-libs/qt-assistant )
			=x11-libs/qt-4.2*:4 )
        >=dev-util/cmake-2.4.2
		dev-lang/swig
        python? ( dev-lang/python )
        ruby?   ( dev-lang/ruby )"

pkg_setup() {
	ewarn "if this ebuild fails have a look at"
	ewarn "http://bugs.gentoo.org/show_bug.cgi?id=157501"
	ewarn "hav no time to fix the ebuild"
}

src_unpack() {
	subversion_src_unpack
	cd "${S}"
        epatch "${FILESDIR}/fix-MAKE_DIRECTORY-commands.diff"
}


src_compile() {
	cmake \
		-DCMAKE_INSTALL_PREFIX:PATH=/usr \
		-DCANORUS_INSTALL_LIB_DIR=$(get_libdir) \
		-DNO_PYTHON=$( use python && echo false || echo true ) \
		-DNO_RUBY=$( use ruby && echo false || echo true ) \
	. || die

	emake || die
}

src_install() {
		emake install DESTDIR=${D} || die
}