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

inherit eutils versionator

MY_PN="Songbird"

DESCRIPTION="Songbird is a desktop Web player, a digital jukebox and Web browser mash-up"
HOMEPAGE="http://www.songbirdnest.com/"
SRC_URI="x86? ( http://download.songbirdnest.com/installer/linux/i686/${MY_PN}_${PV}_linux-i686.tar.gz )
	amd64? ( http://download.songbirdnest.com/installer/linux/x86_64/${MY_PN}_${PV}_linux-x86_64.tar.gz ) "

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="aac alsa esd ffmpeg flac mad mp3 mpeg ogg oss speex theora vorbis"

#gstreamer deps are a mix of
# - a copy of totem and
# - http://publicsvn.songbirdnest.com/trac/wiki/SettingUpGStreamer

#local useflags?
#lame? (>=media-plugins/gst-plugins-lame-0.10)
#faad? (>=media-plugins/gst-plugins-faad-0.10)
#faac? (>=media-plugins/gst-plugins-faac-0.10)
#IUSE="lame faad faac"
#how about ugly?

# pitdfdll has not come out with a 0.10 release, should be soon though -AJL
# IUSE="win32codecs"
# win32codecs? ( >=media-plugins/gst-plugins-pitfdll-0.10 )

DEPEND=""
RDEPEND="
	>=sys-libs/glibc-2.3.2
	>=x11-libs/gtk+-2.0.0
	>=media-libs/fontconfig-2.4.2
	>=x11-base/xorg-x11-7.2
	>=virtual/libstdc++-3.3

	>=media-libs/gstreamer-0.10
	>=media-libs/gst-plugins-base-0.10
	>=media-plugins/gst-plugins-xvideo-0.10
	>=media-plugins/gst-plugins-x-0.10
	>=media-plugins/gst-plugins-gconf-0.10
	>=media-plugins/gst-plugins-gnomevfs-0.10
	>=media-libs/gst-plugins-ugly-0.10

	alsa? ( >=media-plugins/gst-plugins-alsa-0.10 )
	oss? ( >=media-plugins/gst-plugins-oss-0.10 )
	esd? ( >=media-plugins/gst-plugins-esd-0.10 )

	aac? ( >=media-plugins/gst-plugins-faad-0.10 )
	ffmpeg? ( >=media-plugins/gst-plugins-ffmpeg-0.10 )
	flac? ( >=media-plugins/gst-plugins-flac-0.10 )
	mp3? ( >=media-plugins/gst-plugins-lame-0.10 )
	mad? ( !mp3? ( >=media-plugins/gst-plugins-mad-0.10 ) )
	ogg? ( >=media-plugins/gst-plugins-ogg-0.10 )
	vorbis? (
		>=media-plugins/gst-plugins-ogg-0.10
		>=media-plugins/gst-plugins-vorbis-0.10
	)
	mpeg? ( >=media-plugins/gst-plugins-mpeg2dec-0.10 )
	theora? (
		>=media-plugins/gst-plugins-ogg-0.10
		>=media-plugins/gst-plugins-theora-0.10
	)
	speex? ( media-plugins/gst-plugins-speex-0.10 )
"

S=${WORKDIR}/${MY_PN}

RESTRICT="strip"

src_install() {
	insinto /opt/songbird
	doins -r *
	fperms 755 /opt/songbird/songbird
	fperms 755 /opt/songbird/xulrunner/xulrunner
	fperms 755 /opt/songbird/xulrunner/xulrunner-bin
	dosym /opt/songbird/songbird /opt/bin/songbird-bin

	newicon "${S}/chrome/icons/default/default.xpm" ${PN}.xpm
	make_desktop_entry ${PN} ${PN} ${PN}.xpm "AudioVideo;Player"
}