| 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-r3.ebuild,v 1.2 2012/06/26 04:59:51 floppym Exp $
|
| 4 |
|
| 5 |
EAPI="2"
|
| 6 |
PYTHON_DEPEND="python? *"
|
| 7 |
SUPPORT_PYTHON_ABIS="1"
|
| 8 |
RESTRICT_PYTHON_ABIS="*-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 |
http://dev.gentoo.org/~swift/patches/setools/${P}-01-fedora-patches.tar.gz
|
| 16 |
http://dev.gentoo.org/~swift/patches/setools/${P}-03-gentoo-patches.tar.gz"
|
| 17 |
|
| 18 |
LICENSE="GPL-2"
|
| 19 |
SLOT="0"
|
| 20 |
KEYWORDS="~amd64 ~x86"
|
| 21 |
IUSE="X debug java python"
|
| 22 |
|
| 23 |
DEPEND=">=sys-libs/libsepol-2.1.4
|
| 24 |
sys-libs/libselinux
|
| 25 |
sys-devel/bison
|
| 26 |
sys-devel/flex
|
| 27 |
>=dev-db/sqlite-3.2:3
|
| 28 |
dev-libs/libxml2:2
|
| 29 |
virtual/pkgconfig
|
| 30 |
java? (
|
| 31 |
>=dev-lang/swig-2.0.4
|
| 32 |
>=virtual/jdk-1.4
|
| 33 |
)
|
| 34 |
python? ( >=dev-lang/swig-2.0.4 )
|
| 35 |
X? (
|
| 36 |
>=dev-lang/tk-8.4.9
|
| 37 |
>=gnome-base/libglade-2.0
|
| 38 |
>=x11-libs/gtk+-2.8:2
|
| 39 |
)"
|
| 40 |
|
| 41 |
RDEPEND=">=sys-libs/libsepol-2.1.4
|
| 42 |
sys-libs/libselinux
|
| 43 |
>=dev-db/sqlite-3.2:3
|
| 44 |
dev-libs/libxml2:2
|
| 45 |
java? ( >=virtual/jre-1.4 )
|
| 46 |
X? (
|
| 47 |
>=dev-lang/tk-8.4.9
|
| 48 |
>=dev-tcltk/bwidget-1.8
|
| 49 |
>=gnome-base/libglade-2.0
|
| 50 |
>=x11-libs/gtk+-2.8:2
|
| 51 |
)"
|
| 52 |
|
| 53 |
RESTRICT="test"
|
| 54 |
|
| 55 |
pkg_setup() {
|
| 56 |
if use java; then
|
| 57 |
java-pkg-opt-2_pkg_setup
|
| 58 |
fi
|
| 59 |
|
| 60 |
if use python; then
|
| 61 |
python_pkg_setup
|
| 62 |
PYTHON_DIRS="libapol/swig/python libpoldiff/swig/python libqpol/swig/python libseaudit/swig/python libsefs/swig/python python"
|
| 63 |
fi
|
| 64 |
}
|
| 65 |
|
| 66 |
src_prepare() {
|
| 67 |
EPATCH_MULTI_MSG="Applying various (Fedora-provided) setools fixes... " \
|
| 68 |
EPATCH_SUFFIX="patch" \
|
| 69 |
EPATCH_SOURCE="${WORKDIR}" \
|
| 70 |
EPATCH_FORCE="yes" \
|
| 71 |
epatch
|
| 72 |
|
| 73 |
EPATCH_MULTI_MSG="Applying various (Gentoo) setool fixes... " \
|
| 74 |
EPATCH_SUFFIX="patch" \
|
| 75 |
EPATCH_SOURCE="${WORKDIR}/gentoo-patches" \
|
| 76 |
EPATCH_FORCE="yes" \
|
| 77 |
epatch
|
| 78 |
|
| 79 |
# Disable broken check for SWIG version.
|
| 80 |
sed -e "s/AC_PROG_SWIG(2.0.0)/AC_PROG_SWIG/" -i configure.ac || die "sed failed"
|
| 81 |
# Fix build failure due to double __init__.py installation
|
| 82 |
sed -e "s/^wrappedpy_DATA = qpol.py \$(pkgpython_PYTHON)/wrappedpy_DATA = qpol.py/" -i libqpol/swig/python/Makefile.am || die
|
| 83 |
|
| 84 |
local dir
|
| 85 |
for dir in ${PYTHON_DIRS}; do
|
| 86 |
# Python bindings are built/installed manually.
|
| 87 |
sed -e "s/MAYBE_PYSWIG = python/MAYBE_PYSWIG =/" -i ${dir%python}Makefile.am || die "sed failed"
|
| 88 |
# Make PYTHON_LDFLAGS replaceable during running `make`.
|
| 89 |
sed -e "/^AM_LDFLAGS =/s/@PYTHON_LDFLAGS@/\$(PYTHON_LDFLAGS)/" -i ${dir}/Makefile.am || die "sed failed"
|
| 90 |
done
|
| 91 |
|
| 92 |
# temporary work around bug #424581 until automake-1.12 is stable (then
|
| 93 |
# depend on it). Need to use MKDIR_P in the mean time for 1.12+.
|
| 94 |
has_version ">=sys-devel/automake-1.12.1" && { find . -name 'Makefile.*' -exec sed -i -e 's:mkdir_p:MKDIR_P:g' {} + || die; }
|
| 95 |
|
| 96 |
eautoreconf
|
| 97 |
|
| 98 |
# Disable byte-compilation of Python modules.
|
| 99 |
echo '#!/bin/sh' > py-compile
|
| 100 |
}
|
| 101 |
|
| 102 |
src_configure() {
|
| 103 |
econf \
|
| 104 |
--with-java-prefix=${JAVA_HOME} \
|
| 105 |
--disable-selinux-check \
|
| 106 |
--disable-bwidget-check \
|
| 107 |
$(use_enable python swig-python) \
|
| 108 |
$(use_enable java swig-java) \
|
| 109 |
$(use_enable X swig-tcl) \
|
| 110 |
$(use_enable X gui) \
|
| 111 |
$(use_enable debug)
|
| 112 |
|
| 113 |
# work around swig c99 issues. it does not require
|
| 114 |
# c99 anyway.
|
| 115 |
sed -i -e 's/-std=gnu99//' "${S}/libseaudit/swig/python/Makefile"
|
| 116 |
}
|
| 117 |
|
| 118 |
src_compile() {
|
| 119 |
default
|
| 120 |
|
| 121 |
if use python; then
|
| 122 |
local dir
|
| 123 |
for dir in ${PYTHON_DIRS}; do
|
| 124 |
python_copy_sources ${dir}
|
| 125 |
building() {
|
| 126 |
emake \
|
| 127 |
SWIG_PYTHON_CPPFLAGS="-I$(python_get_includedir)" \
|
| 128 |
PYTHON_LDFLAGS="$(python_get_library -l)" \
|
| 129 |
pyexecdir="$(python_get_sitedir)" \
|
| 130 |
pythondir="$(python_get_sitedir)"
|
| 131 |
}
|
| 132 |
python_execute_function \
|
| 133 |
--action-message "Building of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version)" \
|
| 134 |
--failure-message "Building of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version) failed" \
|
| 135 |
-s --source-dir ${dir} \
|
| 136 |
building
|
| 137 |
done
|
| 138 |
fi
|
| 139 |
}
|
| 140 |
|
| 141 |
src_install() {
|
| 142 |
emake DESTDIR="${D}" install || die "emake install failed"
|
| 143 |
|
| 144 |
if use python; then
|
| 145 |
local dir
|
| 146 |
for dir in ${PYTHON_DIRS}; do
|
| 147 |
installation() {
|
| 148 |
emake \
|
| 149 |
DESTDIR="${D}" \
|
| 150 |
pyexecdir="$(python_get_sitedir)" \
|
| 151 |
pythondir="$(python_get_sitedir)" \
|
| 152 |
install
|
| 153 |
}
|
| 154 |
python_execute_function \
|
| 155 |
--action-message "Installation of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version)" \
|
| 156 |
--failure-message "Installation of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version) failed" \
|
| 157 |
-s --source-dir ${dir} \
|
| 158 |
installation
|
| 159 |
done
|
| 160 |
fi
|
| 161 |
}
|
| 162 |
|
| 163 |
pkg_postinst() {
|
| 164 |
if use python; then
|
| 165 |
python_mod_optimize setools
|
| 166 |
fi
|
| 167 |
}
|
| 168 |
|
| 169 |
pkg_postrm() {
|
| 170 |
if use python; then
|
| 171 |
python_mod_cleanup setools
|
| 172 |
fi
|
| 173 |
}
|