# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit eutils wxwidgets

MY_PN="wxMusik"
MY_PV="${PV/_p/-Hotfix}"
MY_P="${MY_PN}-${MY_PV}"
IUSE=""
DESCRIPTION="Musik is a cross platform wxGTK2 based music player"
HOMEPAGE="http://musik.berlios.de/"
SRC_URI="http://download.berlios.de/musik/${MY_P}.tar.bz2
	http://cvs.berlios.de/cgi-bin/viewcvs.cgi/*checkout*/musik/Musik-testing/Attic/musik.png"
KEYWORDS="~x86"
SLOT="0"
LICENSE="BSD"
S="${WORKDIR}/${MY_P}"
RDEPEND=">=media-libs/id3lib-3.8.3-r1
		>=media-libs/libogg-1.0
		>=media-libs/libvorbis-1.0-r2
		=media-libs/fmod-3.74
		>=x11-libs/gtk+-2.0
		>=x11-libs/wxGTK-2.5.3
		=dev-db/sqlite-2*"
DEPEND="${RDEPEND}
		>=dev-util/cmake-1.6.7"

pkg_setup() {
	WX_GTK_VER="2.5"
	need-wxwidgets gtk2
}

src_unpack() {
	unpack ${MY_P}.tar.bz2
	cd ${S}
	cp ${DISTDIR}/musik.png data
	epatch ${FILESDIR}/${P}-crash.patch
	epatch ${FILESDIR}/${P}-windowclass.patch
	sed -i \
		-e '/FindwxWindows/i SET(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE $ENV{wxconfig})' \
		-e '/CXX_FLAGS_RELEASE/s/-[^"]*/${CXXFLAGS}/' \
		CMakeLists.txt
}

src_compile() {
	export wxconfig
	cmake . || die
	make    || die
}

src_install() {
	exeinto /usr/bin
	doexe ${S}/wxMusik

	insinto /usr/share/wxMusik/data
	doins ${S}/data/about.htm
	doins ${S}/data/musik.png
}