# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /home/cvsroot/gentoo-x86/x11-themes/lila-artwork/lila-artwork-0.2-r1.ebuild,v 1.0 Exp $

RESTRICT="nomirror nostrip"

GNOME_VER="0.3.2"
SPLASH_VER="0.1"
GTK_VER="0.2.1"
GDM_VER="0.1"
GRUB_VER="0.1"
XFWM4_VER="0.1"
KDE_VER="0.6"
GAIM_UPDATE_VER="0.1"
INDUSTRIAL_GENTOO_VER="0.2"
INDUSTRIAL_LILA_VER="0.1"

DESCRIPTION="SVG themes based on Gentoo Linux"
SRC_URI="gtk? (	http://programmer-art.org/files/gentoo/Lila-gtk-$GTK_VER.tar.bz2
				http://www.geocities.com/konidatoriyama/Gaim-Update-$GAIM_UPDATE_VER.tar.gz
				http://www.geocities.com/konidatoriyama/Industrial-Gentoo-$INDUSTRIAL_GENTOO_VER.tar.gz )
		 gnome? (	http://programmer-art.org/files/gentoo/Lila-icons-$GNOME_VER.tar.bz2
		 			http://programmer-art.org/files/gentoo/Lila-splash-$SPLASH_VER.tar.bz2
		 			http://programmer-art.org/files/gentoo/Lila-gdm-$GDM_VER.tar.bz2 )
		 kde? ( http://www.newtolinux.org.uk/files/lilasvg-$KDE_VER.tar.bz2 )
		 xfce? ( http://programmer-art.org/files/gentoo/Lila-xfwm4-$XFWM4_VER.tar.gz )
		 xmms? ( http://www.geocities.com/konidatoriyama/Industrial-Lila-$INDUSTRIAL_LILA_VER.tar.gz )
		 http://programmer-art.org/files/gentoo/Lila-grub-$GRUB_VER.tar.bz2"

HOMEPAGE="http://programmer-art.org/index.php?page=gentoo#lila"

KEYWORDS="~x86 ~ppc ~sparc ~amd64"
LICENSE="GPL-2"
SLOT="0"
IUSE="gnome gtk kde xfce xmms"

DEPEND="gtk? ( gnome-base/librsvg
				x11-themes/ximian-artwork
				x11-themes/redhat-artwork
				x11-themes/gtk-engines
				x11-themes/gtk-engines-xfce )
		gnome? ( gnome-base/librsvg
				x11-themes/gnome-themes
				gnome-base/gdm )
		kde? ( kde-base/kdebase )
		xfce? ( xfce-base/xfwm4 ) 
		xmms? ( media-sound/xmms )"

src_unpack() {
	if [ `use gtk` ] ; then
		unpack Lila-gtk-$GTK_VER.tar.bz2
		unpack Industrial-Gentoo-$INDUSTRIAL_GENTOO_VER.tar.gz
		unpack Gaim-Update-$GAIM_UPDATE_VER.tar.gz
		mv ${WORKDIR}/Lila ${WORKDIR}/Lila-gtk
		mv ${WORKDIR}/Lilacurve ${WORKDIR}/Lilacurve-gtk
		mv ${WORKDIR}/Lila-Simple ${WORKDIR}/Lila-Simple-gtk
		mv ${WORKDIR}/Lila-Xfce ${WORKDIR}/Lila-Xfce-gtk
		mv ${WORKDIR}/Industrial-Gentoo ${WORKDIR}/Industrial-Gentoo-gtk
		mv ${WORKDIR}/gaim_* ${WORKDIR}/Lila-gtk/gtk-2.0
	fi
	if [ `use gnome` ] ; then
		unpack Lila-icons-$GNOME_VER.tar.bz2
		mv ${WORKDIR}/Lila ${WORKDIR}/Lila-icons
		unpack Lila-splash-$SPLASH_VER.tar.bz2
		unpack Lila-gdm-$GDM_VER.tar.bz2
		mv ${WORKDIR}/Lila ${WORKDIR}/Lila-gdm
	fi
	if [ `use kde` ] ; then
		unpack lilasvg-$KDE_VER.tar.bz2
		mv ${WORKDIR}/lilasvg ${WORKDIR}/Lila-kde
	fi
	if [ `use xfce` ] ; then
		unpack Lila-xfwm4-$XFWM4_VER.tar.gz
		mv ${WORKDIR}/Lila ${WORKDIR}/Lila-xfce
	fi
	if [ `use xmms` ] ; then
		unpack Industrial-Lila-$INDUSTRIAL_LILA_VER.tar.gz
		mv ${WORKDIR}/Industrial-Lila ${WORKDIR}/Lila-xmms
	fi
	# extract backgrounds & grub splashes here
	#unpack Lila-backgrounds-$BACKGROUND_VER.tar.bz2
	unpack Lila-grub-$GRUB_VER.tar.bz2
}

src_install() {
	if [ `use gtk` ] ; then
		dodir /usr/share/themes/Lila
		cp -R ${WORKDIR}/Lila-gtk/* ${D}/usr/share/themes/Lila
		dodir /usr/share/themes/Lilacurve
		cp -R ${WORKDIR}/Lilacurve-gtk/* ${D}/usr/share/themes/Lilacurve
		dodir /usr/share/themes/Lila-Simple
		cp -R ${WORKDIR}/Lila-Simple-gtk ${D}/usr/share/themes/Lila-Simple
		dodir /usr/share/themes/Lila-Xfce
		cp -R ${WORKDIR}/Lila-Xfce-gtk ${D}/usr/share/themes/Lila-Xfce
		chmod -R 755 ${D}/usr/share/themes/Lila*
		dodir /usr/share/themes/Industrial-Gentoo-Lila
		cp -R ${WORKDIR}/Industrial-Gentoo-gtk/* ${D}/usr/share/themes/Industrial-Gentoo-Lila
		chmod -R 755 ${D}/usr/share/themes/Industrial-Gentoo-Lila
	fi
	if [ `use gnome` ] ; then
		dodir /usr/share/icons/Lila	
		cp -R ${WORKDIR}/Lila-icons/* ${D}/usr/share/icons/Lila
		chmod -R 755 ${D}/usr/share/icons/Lila
		dodir /usr/share/pixmaps/splash
		cp ${WORKDIR}/lila-splash.png ${D}/usr/share/pixmaps/splash
		chmod 644 ${D}/usr/share/pixmaps/splash/lila-splash.png
		dodir /usr/share/gdm/themes/Lila
		cp -R ${WORKDIR}/Lila-gdm/* ${D}/usr/share/gdm/themes/Lila
		chmod -R 755 ${D}/usr/share/gdm/themes/Lila
	fi
	if [ `use kde` ] ; then
		dodir ${KDEDIR}/share/icons/Lila
		cp -R ${WORKDIR}/Lila-kde/* ${D}${KDEDIR}/share/icons/Lila
		chmod -R 755 ${D}${KDEDIR}/share/icons/Lila
	fi
	if [ `use xfce` ] ; then
		dodir /usr/share/xfwm4/themes/Lila
		cp -R ${WORKDIR}/Lila-xfce/* ${D}/usr/share/xfwm4/themes/Lila
		chmod -R 755 ${D}/usr/share/xfwm4/themes/Lila
	fi
	if [ `use xmms` ] ; then
		dodir /usr/share/xmms/Skins/Industrial-Lila
		cp -R ${WORKDIR}/Lila-xmms/* ${D}/usr/share/xmms/Skins/Industrial-Lila
		chmod 755 ${D}/usr/share/xmms/Skins/Industrial-Lila
	fi
	# install backgrounds & grub splashes here
	#dodir /usr/share/pixmaps/lila <- Backgrounds will be copied here!
	dodir /usr/share/grub/splashimages
	cp ${WORKDIR}/lila.xpm.gz ${D}/usr/share/grub/splashimages
	chmod 644 ${D}/usr/share/grub/splashimages/lila.xpm.gz
}

pkg_postinst() {
	einfo "If you are using Mozilla Firefox be sure to also download and install the firefox theme at http://chwombat.net/firefox/lila.jar"
}