| 1 |
|
# Copyright 1999-2025 Gentoo Authors
|
|
1 |
# Copyright 1999-2026 Gentoo Authors
|
| 2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| ... | ... | |
| 6 |
6 |
DISTUTILS_EXT=1
|
| 7 |
7 |
DISTUTILS_OPTIONAL=1
|
| 8 |
8 |
DISTUTILS_USE_PEP517=setuptools
|
| 9 |
|
PYTHON_COMPAT=( python3_{11..12} )
|
|
9 |
PYTHON_COMPAT=( python3_{12..15} )
|
| 10 |
10 |
GENTOO_DEPEND_ON_PERL="no"
|
| 11 |
11 |
|
| 12 |
|
inherit autotools distutils-r1 perl-functions
|
| 13 |
|
|
| 14 |
|
MY_PV="$(ver_cut 1-2)"
|
|
12 |
inherit autotools distutils-r1 dot-a perl-module verify-sig
|
| 15 |
13 |
|
| 16 |
14 |
DESCRIPTION="Library to support AppArmor userspace utilities"
|
| 17 |
|
HOMEPAGE="https://gitlab.com/apparmor/apparmor/wikis/home"
|
| 18 |
|
SRC_URI="https://launchpad.net/apparmor/${MY_PV}/${PV}/+download/apparmor-${PV}.tar.gz"
|
| 19 |
|
S=${WORKDIR}/apparmor-${PV}/libraries/${PN}
|
|
15 |
HOMEPAGE="https://gitlab.com/apparmor/apparmor/-/wikis/home"
|
|
16 |
SRC_URI="
|
|
17 |
https://gitlab.com/apparmor/apparmor/-/archive/v${PV}/apparmor-v${PV}.tar.bz2
|
|
18 |
verify-sig? (
|
|
19 |
https://gitlab.com/api/v4/projects/4484878/packages/generic/signatures/${PV}/apparmor-v${PV}.tar.bz2.asc
|
|
20 |
)
|
|
21 |
"
|
|
22 |
|
|
23 |
S=${WORKDIR}/apparmor-v${PV}/libraries/${PN}
|
| 20 |
24 |
|
| 21 |
25 |
LICENSE="GPL-2 LGPL-2.1"
|
| 22 |
26 |
SLOT="0"
|
| 23 |
|
KEYWORDS="amd64 ~arm arm64 ~ppc64 ~riscv ~x86"
|
| 24 |
|
IUSE="doc +perl +python static-libs"
|
|
27 |
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
|
|
28 |
IUSE="doc +perl +python ${GENTOO_PERL_USESTRING}"
|
| 25 |
29 |
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
|
| 26 |
|
# depends on the package already being installed
|
| 27 |
|
RESTRICT="test"
|
| 28 |
30 |
|
| 29 |
31 |
RDEPEND="
|
| 30 |
|
perl? ( dev-lang/perl:= )
|
|
32 |
perl? (
|
|
33 |
${GENTOO_PERL_DEPSTRING}
|
|
34 |
dev-lang/perl:=
|
|
35 |
)
|
| 31 |
36 |
python? (
|
| 32 |
37 |
${PYTHON_DEPS}
|
| 33 |
38 |
)
|
| ... | ... | |
| 35 |
40 |
DEPEND="${RDEPEND}"
|
| 36 |
41 |
BDEPEND="
|
| 37 |
42 |
dev-build/autoconf-archive
|
|
43 |
sys-apps/which
|
| 38 |
44 |
sys-devel/bison
|
| 39 |
45 |
sys-devel/flex
|
| 40 |
46 |
doc? ( dev-lang/perl )
|
| ... | ... | |
| 44 |
50 |
${DISTUTILS_DEPS}
|
| 45 |
51 |
dev-lang/swig
|
| 46 |
52 |
)
|
|
53 |
test? (
|
|
54 |
dev-util/dejagnu
|
|
55 |
)
|
|
56 |
verify-sig? ( sec-keys/openpgp-keys-apparmor )
|
| 47 |
57 |
"
|
| 48 |
58 |
|
| 49 |
59 |
PATCHES=(
|
| 50 |
|
"${FILESDIR}"/${PN}-3.1.4-clang-flto-partition.patch
|
|
60 |
"${FILESDIR}/apparmor_disable_test_libapparmor.aa_query_file_path.patch"
|
| 51 |
61 |
)
|
| 52 |
62 |
|
|
63 |
distutils_enable_tests unittest
|
|
64 |
|
| 53 |
65 |
src_prepare() {
|
| 54 |
66 |
default
|
| 55 |
67 |
|
| ... | ... | |
| 64 |
76 |
}
|
| 65 |
77 |
|
| 66 |
78 |
src_configure() {
|
|
79 |
lto-guarantee-fat
|
|
80 |
|
| 67 |
81 |
# Run configure through distutils-r1.eclass. Bug 764779
|
| 68 |
82 |
if use python; then
|
| 69 |
83 |
distutils-r1_src_configure
|
| ... | ... | |
| 78 |
92 |
export YACC=yacc.bison
|
| 79 |
93 |
|
| 80 |
94 |
local myeconfargs=(
|
| 81 |
|
$(use_enable static-libs static)
|
|
95 |
# Needed for tests, just always install them.
|
|
96 |
--enable-static
|
| 82 |
97 |
$(use_with perl)
|
| 83 |
98 |
$(use_with python)
|
| 84 |
99 |
)
|
| ... | ... | |
| 93 |
108 |
use perl && emake -C swig/perl
|
| 94 |
109 |
|
| 95 |
110 |
if use python ; then
|
| 96 |
|
pushd swig/python > /dev/null
|
|
111 |
pushd swig/python > /dev/null || die
|
| 97 |
112 |
emake libapparmor_wrap.c
|
| 98 |
113 |
distutils-r1_src_compile
|
| 99 |
|
popd > /dev/null
|
|
114 |
popd > /dev/null || die
|
|
115 |
fi
|
|
116 |
}
|
|
117 |
|
|
118 |
src_test() {
|
|
119 |
# Avoid perl-module_src_test. We also need to avoid running the
|
|
120 |
# Python tests in the wrong environment here.
|
|
121 |
mv swig/python/test/test_python.py.in{,.bak} || die
|
|
122 |
touch swig/python/test/test_python.py.in
|
|
123 |
default
|
|
124 |
mv swig/python/test/test_python.py.in{.bak,} || die
|
|
125 |
|
|
126 |
if use python ; then
|
|
127 |
pushd swig/python > /dev/null || die
|
|
128 |
distutils-r1_src_test
|
|
129 |
popd > /dev/null || die
|
| 100 |
130 |
fi
|
| 101 |
131 |
}
|
| 102 |
132 |
|
|
133 |
python_test() {
|
|
134 |
cd test || die
|
|
135 |
|
|
136 |
# Force regeneration wrt the earlier hack we did
|
|
137 |
touch test_python.py.in || die
|
|
138 |
# Create test_python.py from test_python.py.in
|
|
139 |
emake test_python.py
|
|
140 |
|
|
141 |
LD_LIBRARY_PATH="${S}/src/.libs:${LD_LIBRARY_PATH}" ${EPYTHON} test_python.py || die
|
|
142 |
}
|
|
143 |
|
| 103 |
144 |
src_install() {
|
| 104 |
145 |
emake DESTDIR="${D}" -C src install
|
| 105 |
146 |
emake DESTDIR="${D}" -C include install
|
| ... | ... | |
| 124 |
165 |
|
| 125 |
166 |
dodoc AUTHORS ChangeLog NEWS README
|
| 126 |
167 |
|
|
168 |
strip-lto-bytecode
|
| 127 |
169 |
find "${D}" -name '*.la' -delete || die
|
| 128 |
170 |
}
|
| 129 |
171 |
|