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

inherit eutils autotools python

DESCRIPTION="Plugins for analyzing AVC Messages used by setroubleshoot"
HOMEPAGE="https://fedorahosted.org/setroubleshoot"
SRC_URI="http://cvs.fedoraproject.org/repo/pkgs/setroubleshoot-plugins/${P}.tar.gz/5cb6c993f0d58232fd6e948553cef1f4/${P}.tar.gz"

LICENSE="GPL-2"

SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="selinux"

DEPEND="dev-util/intltool"

RDEPEND="sys-apps/policycoreutils
	sys-libs/libselinux"


src_unpack() {
	unpack "${A}"
	cd "${S}"

	# disable pyc compiling
	mv -f py-compile py-compile.ori \
		|| die "mv -f py-compile py-compile.ori failed."
	ln -s $(type -P true) py-compile \
		|| die "ln -s $(type -P true) py-compile failed."
}

src_compile() {
	econf --prefix=/usr \
		--libdir=/usr/$(get_libdir) \
		--libexecdir=/usr/$(get_libdir) \
		--localstatedir=/var \
		|| die "Configure failure"

	emake || die "Make failure"
}

src_install() {
	make DESTDIR="${D}" install \
		|| die "Install failure"

	rm -rf "${D}/usr/share/doc"
	dodoc AUTHORS
	dodoc COPYING
	dodoc ChangeLog
	dodoc README
}


pkg_postinst() {
    python_version
    python_need_rebuild
    python_mod_optimize /usr/share/setroubleshoot/plugins
}

pkg_postrm() {
    python_mod_cleanup
}