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

inherit eutils

MY_P="${PN}097"
DESCRIPTION="picture manager / organizer written in Perl/Tk"
HOMEPAGE="http://mapivi.sourceforge.net/mapivi.shtml"
SRC_URI="mirror://sourceforge/mapivi/${MY_P}.tar.gz"

IUSE=""
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~ppc"

DEPEND="dev-lang/perl
	>=dev-perl/perl-tk-804.025
	dev-perl/ImageInfo
	media-gfx/jhead
	media-gfx/imagemagick
	|| ( media-libs/jpeg media-libs/libjpeg-turbo )
	dev-perl/Image-MetaData-JPEG"

S="${WORKDIR}/${MY_P}"

src_unpack() {
	unpack ${A}
	cd "${S}"
	sed -i -e 's:$configdir/PlugIns:/usr/share/mapivi/plugins:' mapivi
	# patch for GIMP >=2.3
	sed -i 's:gimp-remote -n  :gimp-remote:g' mapivi
}

src_install() {
	dobin mapivi

	exeinto /usr/share/mapivi/plugins
	doexe PlugIns/{Channel-Separator,Join-RGB,checkDir-plugin,filelist-plugin,test-plugin}
	dodoc Changes.txt FAQ README Tips.txt
	insinto /usr/share/pixmaps
	doins ${FILESDIR}/mapivi.png
	make_desktop_entry mapivi "MaPiVi" "mapivi.png" "Graphics;2DGraphics;Viewer"
}