| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sys-libs/libsemanage/libsemanage-2.1.9.ebuild,v 1.2 2012/10/13 16:43:03 swift Exp $ |
| 4 |
|
| 5 |
EAPI="3" |
| 6 |
# Support for 4 depends on python.eclass |
| 7 |
PYTHON_DEPEND="python? *" |
| 8 |
SUPPORT_PYTHON_ABIS="1" |
| 9 |
RESTRICT_PYTHON_ABIS="*-jython *-pypy-*" |
| 10 |
|
| 11 |
inherit multilib python toolchain-funcs eutils |
| 12 |
|
| 13 |
SEPOL_VER="2.1.8" |
| 14 |
SELNX_VER="2.1.12" |
| 15 |
|
| 16 |
DESCRIPTION="SELinux kernel and policy management library" |
| 17 |
HOMEPAGE="http://userspace.selinuxproject.org" |
| 18 |
SRC_URI="http://userspace.selinuxproject.org/releases/20120924/${P}.tar.gz" |
| 19 |
|
| 20 |
LICENSE="GPL-2" |
| 21 |
SLOT="0" |
| 22 |
KEYWORDS="amd64 x86" |
| 23 |
IUSE="python ruby" |
| 24 |
|
| 25 |
RDEPEND=">=sys-libs/libsepol-${SEPOL_VER} |
| 26 |
>=sys-libs/libselinux-${SELNX_VER} |
| 27 |
dev-libs/ustr |
| 28 |
ruby? ( dev-lang/ruby )" |
| 29 |
DEPEND="${RDEPEND} |
| 30 |
sys-devel/bison |
| 31 |
sys-devel/flex |
| 32 |
ruby? ( >=dev-lang/swig-2.0.4-r1 ) |
| 33 |
python? ( >=dev-lang/swig-2.0.4-r1 )" |
| 34 |
|
| 35 |
# tests are not meant to be run outside of the |
| 36 |
# full SELinux userland repo |
| 37 |
RESTRICT="test" |
| 38 |
|
| 39 |
pkg_setup() { |
| 40 |
if use python; then |
| 41 |
python_pkg_setup |
| 42 |
fi |
| 43 |
} |
| 44 |
|
| 45 |
src_prepare() { |
| 46 |
echo "# Set this to true to save the linked policy." >> "${S}/src/semanage.conf" |
| 47 |
echo "# This is normally only useful for analysis" >> "${S}/src/semanage.conf" |
| 48 |
echo "# or debugging of policy." >> "${S}/src/semanage.conf" |
| 49 |
echo "save-linked=false" >> "${S}/src/semanage.conf" |
| 50 |
echo >> "${S}/src/semanage.conf" |
| 51 |
echo "# Set this to 0 to disable assertion checking." >> "${S}/src/semanage.conf" |
| 52 |
echo "# This should speed up building the kernel policy" >> "${S}/src/semanage.conf" |
| 53 |
echo "# from policy modules, but may leave you open to" >> "${S}/src/semanage.conf" |
| 54 |
echo "# dangerous rules which assertion checking" >> "${S}/src/semanage.conf" |
| 55 |
echo "# would catch." >> "${S}/src/semanage.conf" |
| 56 |
echo "expand-check=1" >> "${S}/src/semanage.conf" |
| 57 |
echo >> "${S}/src/semanage.conf" |
| 58 |
echo "# Modules in the module store can be compressed" >> "${S}/src/semanage.conf" |
| 59 |
echo "# with bzip2. Set this to the bzip2 blocksize" >> "${S}/src/semanage.conf" |
| 60 |
echo "# 1-9 when compressing. The higher the number," >> "${S}/src/semanage.conf" |
| 61 |
echo "# the more memory is traded off for disk space." >> "${S}/src/semanage.conf" |
| 62 |
echo "# Set to 0 to disable bzip2 compression." >> "${S}/src/semanage.conf" |
| 63 |
echo "bzip-blocksize=0" >> "${S}/src/semanage.conf" |
| 64 |
echo >> "${S}/src/semanage.conf" |
| 65 |
echo "# Reduce memory usage for bzip2 compression and" >> "${S}/src/semanage.conf" |
| 66 |
echo "# decompression of modules in the module store." >> "${S}/src/semanage.conf" |
| 67 |
echo "bzip-small=true" >> "${S}/src/semanage.conf" |
| 68 |
|
| 69 |
epatch_user |
| 70 |
} |
| 71 |
|
| 72 |
src_compile() { |
| 73 |
emake AR="$(tc-getAR)" CC="$(tc-getCC)" all || die |
| 74 |
|
| 75 |
if use python; then |
| 76 |
python_copy_sources src |
| 77 |
building() { |
| 78 |
emake CC="$(tc-getCC)" PYLIBVER="python$(python_get_version)" PYPREFIX="python-$(python_get_version)" "$@" |
| 79 |
} |
| 80 |
python_execute_function -s --source-dir src building -- swigify |
| 81 |
python_execute_function -s --source-dir src building -- pywrap |
| 82 |
fi |
| 83 |
|
| 84 |
if use ruby; then |
| 85 |
emake -C src CC="$(tc-getCC)" rubywrap || die |
| 86 |
fi |
| 87 |
} |
| 88 |
|
| 89 |
src_install() { |
| 90 |
emake \ |
| 91 |
DESTDIR="${D}" \ |
| 92 |
LIBDIR="${D}usr/$(get_libdir)" \ |
| 93 |
SHLIBDIR="${D}$(get_libdir)" \ |
| 94 |
install || die |
| 95 |
dosym "../../$(get_libdir)/libsemanage.so.1" "/usr/$(get_libdir)/libsemanage.so" || die |
| 96 |
|
| 97 |
if use python; then |
| 98 |
installation() { |
| 99 |
emake \ |
| 100 |
DESTDIR="${D}" \ |
| 101 |
PYLIBVER="python$(python_get_version)" \ |
| 102 |
PYPREFIX="python-$(python_get_version)" \ |
| 103 |
LIBDIR="${D}usr/$(get_libdir)" \ |
| 104 |
install-pywrap |
| 105 |
} |
| 106 |
python_execute_function -s --source-dir src installation |
| 107 |
fi |
| 108 |
|
| 109 |
if use ruby; then |
| 110 |
emake -C src \ |
| 111 |
DESTDIR="${D}" \ |
| 112 |
LIBDIR="${D}usr/$(get_libdir)" \ |
| 113 |
install-rubywrap || die |
| 114 |
fi |
| 115 |
} |
| 116 |
|
| 117 |
pkg_postinst() { |
| 118 |
if use python; then |
| 119 |
python_mod_optimize semanage.py |
| 120 |
fi |
| 121 |
} |
| 122 |
|
| 123 |
pkg_postrm() { |
| 124 |
if use python; then |
| 125 |
python_mod_cleanup semanage.py |
| 126 |
fi |
| 127 |
} |