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

inherit subversion wxwidgets

DESCRIPTION="wxMusik is an open-source, cross-platform multimedia player and library"
HOMEPAGE="http://musik.berlios.de"
SRC_URI=""
ESVN_REPO_URI="svn://svn.berlios.de/musik/trunk/wxMusik"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE="ape flac musepack unicode"

RDEPEND="musepack? ( >=media-libs/libmusepack-1.1 )
	flac? ( >=media-libs/flac-1.1 )
	ape? ( media-sound/mac )
	media-libs/libvorbis
	media-libs/fmod
	=dev-db/sqlite-2*"
DEPEND="${RDEPEND}
	dev-util/cmake"

pkg_setup() {
	if has_version '>=x11-libs/wxGTK-2.5.0'; then
		WX_GTK_VER="2.5"
	fi
	if use unicode; then
		need-wxwidgets unicode
	else
		need-wxwidgets gtk2
	fi
}

src_compile() {
	local myconf

	use ape || myconf="${myconf} -DOPTION_SUPPORT_APE:BOOL=OFF"
	use flac || myconf="${myconf} -DOPTION_SUPPORT_FLAC:BOOL=OFF"
	use musepack || myconf="${myconf} -DOPTION_SUPPORT_MPC:BOOL=OFF"
	use unicode || myconf="${myconf} -DWXWINDOWS_USE_UNICODE:BOOL=OFF"

	cmake \
		-DCMAKE_BUILD_TYPE:STRING=Release \
		-DCMAKE_INSTALL_PREFIX:STRING="${D}/usr" \
		-DCMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE:STRING=${WX_CONFIG} \
		-DWXWINDOWS_USE_SHARED_LIBS:BOOL=ON \
		${myconf} || die

	emake || die
}

src_install() {
	einstall
	dodoc changelog.txt license.txt todo.txt
}