| 1 |
swift |
1.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.3 2012/05/03 18:02:22 jdhore Exp $ |
| 4 |
|
|
|
| 5 |
|
|
EAPI="2" |
| 6 |
|
|
PYTHON_DEPEND="python? *" |
| 7 |
|
|
SUPPORT_PYTHON_ABIS="1" |
| 8 |
|
|
RESTRICT_PYTHON_ABIS="*-jython" |
| 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 |
|
|
eautoreconf |
| 93 |
|
|
|
| 94 |
|
|
# Disable byte-compilation of Python modules. |
| 95 |
|
|
echo '#!/bin/sh' > py-compile |
| 96 |
|
|
} |
| 97 |
|
|
|
| 98 |
|
|
src_configure() { |
| 99 |
|
|
econf \ |
| 100 |
|
|
--with-java-prefix=${JAVA_HOME} \ |
| 101 |
|
|
--disable-selinux-check \ |
| 102 |
|
|
--disable-bwidget-check \ |
| 103 |
|
|
$(use_enable python swig-python) \ |
| 104 |
|
|
$(use_enable java swig-java) \ |
| 105 |
|
|
$(use_enable X swig-tcl) \ |
| 106 |
|
|
$(use_enable X gui) \ |
| 107 |
|
|
$(use_enable debug) |
| 108 |
|
|
|
| 109 |
|
|
# work around swig c99 issues. it does not require |
| 110 |
|
|
# c99 anyway. |
| 111 |
|
|
sed -i -e 's/-std=gnu99//' "${S}/libseaudit/swig/python/Makefile" |
| 112 |
|
|
} |
| 113 |
|
|
|
| 114 |
|
|
src_compile() { |
| 115 |
|
|
default |
| 116 |
|
|
|
| 117 |
|
|
if use python; then |
| 118 |
|
|
local dir |
| 119 |
|
|
for dir in ${PYTHON_DIRS}; do |
| 120 |
|
|
python_copy_sources ${dir} |
| 121 |
|
|
building() { |
| 122 |
|
|
emake \ |
| 123 |
|
|
SWIG_PYTHON_CPPFLAGS="-I$(python_get_includedir)" \ |
| 124 |
|
|
PYTHON_LDFLAGS="$(python_get_library -l)" \ |
| 125 |
|
|
pyexecdir="$(python_get_sitedir)" \ |
| 126 |
|
|
pythondir="$(python_get_sitedir)" |
| 127 |
|
|
} |
| 128 |
|
|
python_execute_function \ |
| 129 |
|
|
--action-message "Building of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version)" \ |
| 130 |
|
|
--failure-message "Building of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version) failed" \ |
| 131 |
|
|
-s --source-dir ${dir} \ |
| 132 |
|
|
building |
| 133 |
|
|
done |
| 134 |
|
|
fi |
| 135 |
|
|
} |
| 136 |
|
|
|
| 137 |
|
|
src_install() { |
| 138 |
|
|
emake DESTDIR="${D}" install || die "emake install failed" |
| 139 |
|
|
|
| 140 |
|
|
if use python; then |
| 141 |
|
|
local dir |
| 142 |
|
|
for dir in ${PYTHON_DIRS}; do |
| 143 |
|
|
installation() { |
| 144 |
|
|
emake \ |
| 145 |
|
|
DESTDIR="${D}" \ |
| 146 |
|
|
pyexecdir="$(python_get_sitedir)" \ |
| 147 |
|
|
pythondir="$(python_get_sitedir)" \ |
| 148 |
|
|
install |
| 149 |
|
|
} |
| 150 |
|
|
python_execute_function \ |
| 151 |
|
|
--action-message "Installation of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version)" \ |
| 152 |
|
|
--failure-message "Installation of Python bindings from ${dir} directory with \$(python_get_implementation) \$(python_get_version) failed" \ |
| 153 |
|
|
-s --source-dir ${dir} \ |
| 154 |
|
|
installation |
| 155 |
|
|
done |
| 156 |
|
|
fi |
| 157 |
|
|
} |
| 158 |
|
|
|
| 159 |
|
|
pkg_postinst() { |
| 160 |
|
|
if use python; then |
| 161 |
|
|
python_mod_optimize setools |
| 162 |
|
|
fi |
| 163 |
|
|
} |
| 164 |
|
|
|
| 165 |
|
|
pkg_postrm() { |
| 166 |
|
|
if use python; then |
| 167 |
|
|
python_mod_cleanup setools |
| 168 |
|
|
fi |
| 169 |
|
|
} |