blob: 133cf8eb5a8546d29942e41adabaae113824fa03 (
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-admin/setools/setools-3.3.8-r7.ebuild,v 1.2 2015/02/18 03:35:21 perfinion Exp $
EAPI="5"
PYTHON_COMPAT=( python2_7 python3_4 )
inherit autotools java-pkg-opt-2 python-r1 eutils
DESCRIPTION="SELinux policy tools"
HOMEPAGE="http://www.tresys.com/selinux/selinux_policy_tools.shtml"
SRC_URI="http://oss.tresys.com/projects/setools/chrome/site/dists/${P}/${P}.tar.bz2
http://dev.gentoo.org/~perfinion/patches/setools/${P}-04-gentoo-patches.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="X debug java python"
DEPEND=">=sys-devel/automake-1.12.1
>=sys-libs/libsepol-2.4
>=sys-libs/libselinux-2.4
sys-devel/bison
sys-devel/flex
>=dev-db/sqlite-3.2:3
dev-libs/libxml2:2
virtual/pkgconfig
java? (
>=virtual/jdk-1.4
dev-lang/swig
)
python? (
${PYTHON_DEPS}
dev-lang/swig
)
X? (
>=dev-lang/tk-8.4.9
>=gnome-base/libglade-2.0
>=x11-libs/gtk+-2.8:2
)"
RDEPEND=">=sys-libs/libsepol-2.1.4
>=sys-libs/libselinux-2.3
>=dev-db/sqlite-3.2:3
dev-libs/libxml2:2
java? ( >=virtual/jre-1.4 )
X? (
>=dev-lang/tk-8.4.9
>=dev-tcltk/bwidget-1.8
>=gnome-base/libglade-2.0
>=x11-libs/gtk+-2.8:2
)"
RESTRICT="test"
# setools dirs that contain python code to build
PYTHON_DIRS="libapol/swig/python libpoldiff/swig/python libqpol/swig/python libseaudit/swig/python libsefs/swig/python python"
pkg_setup() {
local myld=$(tc-getLD)
if use java; then
java-pkg-opt-2_pkg_setup
fi
${myld} -v | grep -q "GNU gold" && \
ewarn "Bug #467136 shows us that the gold linker doesn't work with setools for now."
}
src_prepare() {
EPATCH_MULTI_MSG="Applying various (Gentoo) setool fixes... " \
EPATCH_SUFFIX="patch" \
EPATCH_SOURCE="${WORKDIR}/gentoo-patches" \
EPATCH_FORCE="yes" \
epatch
# Fix build failure due to double __init__.py installation
sed -e "s/^wrappedpy_DATA = qpol.py \$(pkgpython_PYTHON)/wrappedpy_DATA = qpol.py/" -i libqpol/swig/python/Makefile.am || die
local dir
for dir in ${PYTHON_DIRS}; do
# Python bindings are built/installed manually.
sed -e "s/MAYBE_PYSWIG = python/MAYBE_PYSWIG =/" -i ${dir%python}Makefile.am || die "sed failed"
# Make PYTHON_LDFLAGS replaceable during running `make`.
sed -e "/^AM_LDFLAGS =/s/@PYTHON_LDFLAGS@/\$(PYTHON_LDFLAGS)/" -i ${dir}/Makefile.am || die "sed failed"
done
epatch_user
eautoreconf
# Disable byte-compilation of Python modules.
echo '#!/bin/sh' > py-compile
}
src_configure() {
econf \
--with-java-prefix=${JAVA_HOME} \
--disable-selinux-check \
--disable-bwidget-check \
$(use_enable python swig-python) \
$(use_enable java swig-java) \
$(use_enable X swig-tcl) \
$(use_enable X gui) \
$(use_enable debug)
# work around swig c99 issues. it does not require
# c99 anyway.
sed -i -e 's/-std=gnu99//' "${S}/libseaudit/swig/python/Makefile"
}
src_compile() {
emake LD="$(tc-getLD).bfd" || die "Failed to build setools"
if use python; then
building() {
python_export PYTHON_INCLUDEDIR
python_export PYTHON_SITEDIR
python_export PYTHON_LIBS
emake LD="$(tc-getLD).bfd" \
SWIG_PYTHON_CPPFLAGS="-I${PYTHON_INCLUDEDIR}" \
PYTHON_LDFLAGS="${PYTHON_LIBS}" \
pyexecdir="${PYTHON_SITEDIR}" \
pythondir="${PYTHON_SITEDIR}" \
-C ${1};
}
local dir
for dir in ${PYTHON_DIRS}; do
python_foreach_impl building ${dir};
done
fi
}
src_install() {
emake DESTDIR="${D}" install || die "emake install failed"
if use python; then
installation() {
python_export PYTHON_SITEDIR
emake DESTDIR="${D}" \
pyexecdir="${PYTHON_SITEDIR}" \
pythondir="${PYTHON_SITEDIR}" \
-C ${1} install
}
local dir
for dir in ${PYTHON_DIRS}; do
python_foreach_impl installation ${dir};
done
fi
}
|