summaryrefslogtreecommitdiff
blob: b70262a47bf9803edf02a57095945ac8a6607ce7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-admin/setools/setools-2.4.ebuild,v 1.3 2006/09/12 23:50:11 pebenito Exp $

inherit eutils

DESCRIPTION="SELinux policy tools"
HOMEPAGE="http://www.tresys.com/selinux/selinux_policy_tools.shtml"
SRC_URI="http://www.tresys.com/files/setools/${P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 ppc x86"
IUSE="X debug selinux"

#S="${WORKDIR}/${PN}"

DEPEND="sys-devel/bison
	sys-devel/flex
	dev-libs/libxml2
	dev-util/pkgconfig
	selinux? ( sys-libs/libselinux )
	X? (
		dev-lang/tk
		>=gnome-base/libglade-2.0
	)"

RDEPEND="dev-libs/libxml2
	selinux? ( sys-libs/libselinux )
	X? (
		dev-lang/tk
		>=dev-tcltk/bwidget-1.4.1
		>=gnome-base/libglade-2.0
	)"

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

	epatch ${FILESDIR}/apol_tcl_fc.c.diff

	# enable debug if requested
	useq debug && sed -i -e '/^DEBUG/s/0/1/' ${S}/Makefile

	# dont do findcon, replcon, searchcon, or indexcon if USE=-selinux
	if ! useq selinux; then
		sed -i -e '/^USE_LIBSELINUX/s/1/0/' ${S}/Makefile
		sed -i -e '/^SE_CMDS/s/replcon//' \
			-e '/^SE_CMDS/s/findcon//' \
			-e '/^SE_CMDS/s/searchcon//' \
			-e '/^SE_CMDS/s/indexcon//' ${S}/secmds/Makefile

		# sechecker won't compile w/o libselinux
		sed -i -e '/^all-nogui/s/sechecker//' ${S}/Makefile
		sed -i -r -e '/^install-sechecker/!s/install-sechecker//' ${S}/Makefile
	fi
}

src_compile() {
	cd ${S}

	if useq X; then
		make all || die
	else
		make all-nogui || die
	fi
}

src_install() {
	cd ${S}

	# some of the Makefiles are broken, and will fail
	# if ${D}/usr/bin is nonexistant
	dodir /usr/bin

	if use X; then
		make DESTDIR=${D} install || die "install failed."
	else
		make DESTDIR=${D} install-nogui || die "install failed."
	fi
}