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

inherit eutils

VER="081"
S="${WORKDIR}/mapivi${VER}"
DESCRIPTION="Photo manager written in Perl/TK"
HOMEPAGE="http://mapivi.sourceforge.net/mapivi.shtml"
SRC_URI="mirror://sourceforge/mapivi/${PN}${VER}.tar.bz2"

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

DEPEND=">=dev-lang/perl-5.5
	>=dev-perl/perl-tk-804.025
	dev-perl/Image-MetaData-JPEG
	dev-perl/ImageInfo"
RDEPEND=""

src_unpack() {
	unpack ${A}
	cd ${S}
	sed -i 's:$configdir\/PlugIns:\/usr\/share\/mapivi\/plugins:g' ${PN}
}

src_install() {
	exeinto /usr/bin
	doexe mapivi

	dodir /usr/share/mapivi/plugins
	exeinto /usr/share/mapivi/plugins
	doexe PlugIns/Channel-Separator PlugIns/Join-RGB PlugIns/checkDir-plugin\
		PlugIns/filelist-plugin PlugIns/test-plugin
	dodoc Changes.txt FAQ README Tips.txt ToDo
}

pkg_postinst() {
	ewarn "If your Gimp version is 2.3 from CVS you should run:"
	ewarn "sed -i 's:gimp-remote -n  :gimp-remote:g' /usr/bin/mapivi"
	ewarn "sed -i '22732,22734s:^.:\#:g' /usr/bin/mapivi"
	ewarn "sed -i '22735s:\#execute:execute:g' /usr/bin/mapivi"
	ewarn "after instalation to have edit in Gimp option work."
}