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