| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/app-admin/setools/setools-3.3.7-r1.ebuild,v 1.4 2012/05/21 23:21:41 vapier Exp $
|
| 4 |
|
| 5 |
EAPI="2"
|
| 6 |
PYTHON_DEPEND="python? 2"
|
| 7 |
SUPPORT_PYTHON_ABIS="1"
|
| 8 |
RESTRICT_PYTHON_ABIS="3.* *-jython *-pypy-*"
|
| 9 |
|
| 10 |
inherit autotools java-pkg-opt-2 python eutils
|
| 11 |
|
| 12 |
DESCRIPTION="SELinux policy tools"
|
| 13 |
HOMEPAGE="http://www.tresys.com/selinux/selinux_policy_tools.shtml"
|
| 14 |
SRC_URI="http://oss.tresys.com/projects/setools/chrome/site/dists/${P}/${P}.tar.bz2"
|
| 15 |
|
| 16 |
LICENSE="GPL-2"
|
| 17 |
SLOT="0"
|
| 18 |
KEYWORDS="amd64 x86"
|
| 19 |
IUSE="X debug java python"
|
| 20 |
|
| 21 |
DEPEND=">=sys-libs/libsepol-2.1.0
|
| 22 |
sys-libs/libselinux
|
| 23 |
sys-devel/bison
|
| 24 |
sys-devel/flex
|
| 25 |
>=dev-db/sqlite-3.2:3
|
| 26 |
dev-libs/libxml2:2
|
| 27 |
virtual/pkgconfig
|
| 28 |
java? (
|
| 29 |
>=dev-lang/swig-1.3.28
|
| 30 |
>=virtual/jdk-1.4
|
| 31 |
)
|
| 32 |
python? ( >=dev-lang/swig-1.3.28 )
|
| 33 |
X? (
|
| 34 |
>=dev-lang/tk-8.4.9
|
| 35 |
>=gnome-base/libglade-2.0
|
| 36 |
>=x11-libs/gtk+-2.8:2
|
| 37 |
)"
|
| 38 |
|
| 39 |
RDEPEND=">=sys-libs/libsepol-2.1.0
|
| 40 |
sys-libs/libselinux
|
| 41 |
>=dev-db/sqlite-3.2:3
|
| 42 |
dev-libs/libxml2:2
|
| 43 |
java? ( >=virtual/jre-1.4 )
|
| 44 |
X? (
|
| 45 |
>=dev-lang/tk-8.4.9
|
| 46 |
>=dev-tcltk/bwidget-1.8
|
| 47 |
>=gnome-base/libglade-2.0
|
| 48 |
>=x11-libs/gtk+-2.8:2
|
| 49 |
)"
|
| 50 |
|
| 51 |
RESTRICT="test"
|
| 52 |
|
| 53 |
pkg_setup() {
|
| 54 |
if use java; then
|
| 55 |
java-pkg-opt-2_pkg_setup
|
| 56 |
fi
|
| 57 |
|
| 58 |
if use python; then
|
| 59 |
python_pkg_setup
|
| 60 |
PYTHON_DIRS="libapol/swig/python libpoldiff/swig/python libqpol/swig/python libseaudit/swig/python libsefs/swig/python"
|
| 61 |
fi
|
| 62 |
}
|
| 63 |
|
| 64 |
src_prepare() {
|
| 65 |
epatch "${FILESDIR}/fix-check-role_set_expand-libsepol-2.1.0.patch" || die
|
| 66 |
epatch "${FILESDIR}/fix-implicit-def-fstat.patch" || die
|
| 67 |
|
| 68 |
# Disable broken check for SWIG version.
|
| 69 |
sed -e "s/AC_PROG_SWIG(1.3.28)/AC_PROG_SWIG/" -i configure.ac || die "sed failed"
|
| 70 |
# Fix build failure due to double __init__.py installation
|
| 71 |
sed -e "s/^wrappedpy_DATA = qpol.py \$(pkgpython_PYTHON)/wrappedpy_DATA = qpol.py/" -i libqpol/swig/python/Makefile.am || die
|
| 72 |
|
| 73 |
local dir
|
| 74 |
for dir in ${PYTHON_DIRS}; do
|
| 75 |
# Python bindings are built/installed manually.
|
| 76 |
sed -e "s/MAYBE_PYSWIG = python/MAYBE_PYSWIG =/" -i ${dir%python}Makefile.am || die "sed failed"
|
| 77 |
# Make PYTHON_LDFLAGS replaceable during running `make`.
|
| 78 |
sed -e "/^AM_LDFLAGS =/s/@PYTHON_LDFLAGS@/\$(PYTHON_LDFLAGS)/" -i ${dir}/Makefile.am || die "sed failed"
|
| 79 |
done
|
| 80 |
|
| 81 |
eautoreconf
|
| 82 |
|
| 83 |
# Disable byte-compilation of Python modules.
|
| 84 |
echo '#!/bin/sh' > py-compile
|
| 85 |
}
|
| 86 |
|
| 87 |
src_configure() {
|
| 88 |
econf \
|
| 89 |
--with-java-prefix=${JAVA_HOME} \
|
| 90 |
--disable-selinux-check \
|
| 91 |
--disable-bwidget-check \
|
| 92 |
$(use_enable python swig-python) \
|
| 93 |
$(use_enable java swig-java) \
|
| 94 |
$(use_enable X swig-tcl) \
|
| 95 |
$(use_enable X gui) \
|
| 96 |
$(use_enable debug)
|
| 97 |
|
| 98 |
# work around swig c99 issues. it does not require
|
| 99 |
# c99 anyway.
|
| 100 |
sed -i -e 's/-std=gnu99//' "${S}/libseaudit/swig/python/Makefile"
|
| 101 |
}
|
| 102 |
|
| 103 |
src_compile() {
|
| 104 |
default
|
| 105 |
|
| 106 |
if use python; then
|
| 107 |
local dir
|
| 108 |
for dir in ${PYTHON_DIRS}; do
|
| 109 |
python_copy_sources ${dir}
|
| 110 |
building() {
|
| 111 |
emake \
|
| 112 |
SWIG_PYTHON_CPPFLAGS="-I$(python_get_includedir)" \
|
| 113 |
PYTHON_LDFLAGS="$(python_get_library -l)" \
|
| 114 |
pyexecdir="$(python_get_sitedir)" \
|
| 115 |
pythondir="$(python_get_sitedir)"
|
| 116 |
}
|
| 117 |
python_execute_function \
|
| 118 |
--action-message "Building of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version)" \
|
| 119 |
--failure-message "Building of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version) failed" \
|
| 120 |
-s --source-dir ${dir} \
|
| 121 |
building
|
| 122 |
done
|
| 123 |
fi
|
| 124 |
}
|
| 125 |
|
| 126 |
src_install() {
|
| 127 |
emake DESTDIR="${D}" install || die "emake install failed"
|
| 128 |
|
| 129 |
if use python; then
|
| 130 |
local dir
|
| 131 |
for dir in ${PYTHON_DIRS}; do
|
| 132 |
installation() {
|
| 133 |
emake \
|
| 134 |
DESTDIR="${D}" \
|
| 135 |
pyexecdir="$(python_get_sitedir)" \
|
| 136 |
pythondir="$(python_get_sitedir)" \
|
| 137 |
install
|
| 138 |
}
|
| 139 |
python_execute_function \
|
| 140 |
--action-message "Installation of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version)" \
|
| 141 |
--failure-message "Installation of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version) failed" \
|
| 142 |
-s --source-dir ${dir} \
|
| 143 |
installation
|
| 144 |
done
|
| 145 |
fi
|
| 146 |
}
|
| 147 |
|
| 148 |
pkg_postinst() {
|
| 149 |
if use python; then
|
| 150 |
python_mod_optimize setools
|
| 151 |
fi
|
| 152 |
}
|
| 153 |
|
| 154 |
pkg_postrm() {
|
| 155 |
if use python; then
|
| 156 |
python_mod_cleanup setools
|
| 157 |
fi
|
| 158 |
}
|