1 |
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
6 |
inherit autotools flag-o-matic linux-info pam systemd
|
7 |
7 |
|
8 |
8 |
DESCRIPTION="Tools and libraries to configure and manage kernel control groups"
|
9 |
|
HOMEPAGE="http://libcg.sourceforge.net/"
|
10 |
|
SRC_URI="mirror://sourceforge/project/libcg/${PN}/v${PV}/${P}.tar.bz2"
|
|
9 |
HOMEPAGE="https://github.com/libcgroup/libcgroup"
|
|
10 |
SRC_URI="https://github.com/libcgroup/libcgroup/releases/download/v$(ver_cut 1-2)/${P}.tar.gz"
|
11 |
11 |
|
12 |
12 |
LICENSE="LGPL-2.1"
|
13 |
13 |
SLOT="0"
|
... | ... | |
15 |
15 |
IUSE="+daemon pam static-libs test +tools"
|
16 |
16 |
REQUIRED_USE="daemon? ( tools )"
|
17 |
17 |
|
18 |
|
# Use mount cgroup to build directory
|
19 |
|
# sandbox restricted to trivial build,
|
20 |
|
RESTRICT="test"
|
|
18 |
# Test failure needs investigation
|
|
19 |
RESTRICT="!test? ( test ) test"
|
21 |
20 |
|
22 |
21 |
BDEPEND="
|
23 |
22 |
sys-devel/bison
|
24 |
23 |
sys-devel/flex
|
|
24 |
"
|
|
25 |
DEPEND="
|
25 |
26 |
elibc_musl? ( sys-libs/fts-standalone )
|
|
27 |
pam? ( sys-libs/pam )
|
26 |
28 |
"
|
27 |
|
DEPEND="pam? ( sys-libs/pam )"
|
28 |
29 |
RDEPEND="${DEPEND}"
|
29 |
30 |
|
30 |
31 |
PATCHES=(
|
31 |
|
"${FILESDIR}"/${P}-replace_DECLS.patch
|
32 |
|
"${FILESDIR}"/${P}-replace_INLCUDES.patch
|
33 |
|
"${FILESDIR}"/${P}-reorder-headers.patch
|
34 |
|
"${FILESDIR}"/${P}-remove-umask.patch
|
35 |
|
"${FILESDIR}"/${P}-slibtool.patch
|
|
32 |
"${FILESDIR}"/${PN}-3.0.0-configure-bashism.patch
|
|
33 |
"${FILESDIR}"/${PN}-3.0.0-musl-strerror_r.patch
|
36 |
34 |
)
|
37 |
35 |
|
38 |
36 |
pkg_setup() {
|
... | ... | |
45 |
43 |
|
46 |
44 |
src_prepare() {
|
47 |
45 |
default
|
|
46 |
|
48 |
47 |
# Change rules file location
|
49 |
|
sed -e 's:/etc/cgrules.conf:/etc/cgroup/cgrules.conf:' \
|
50 |
|
-i src/libcgroup-internal.h || die "sed failed"
|
51 |
|
sed -e 's:/etc/cgconfig.conf:/etc/cgroup/cgconfig.conf:' \
|
52 |
|
-i src/libcgroup-internal.h || die "sed failed"
|
53 |
|
sed -e 's:\(pam_cgroup_la_LDFLAGS.*\):\1\ -avoid-version:' \
|
54 |
|
-i src/pam/Makefile.am || die "sed failed"
|
55 |
|
sed -e 's#/var/run#/run#g' -i configure.in || die "sed failed"
|
|
48 |
find src -name *.c -o -name *.h \
|
|
49 |
| xargs sed -i '/^#define/s:/etc/cg:/etc/cgroup/cg:'
|
|
50 |
sed -i 's:/etc/cg:/etc/cgroup/cg:' \
|
|
51 |
doc/man/cg* samples/config/*.conf README* || die "sed failed"
|
|
52 |
|
|
53 |
# Drop native libcgconfig init config
|
|
54 |
sed -i '/^man_MANS/s:cgred.conf.5::' \
|
|
55 |
doc/man/Makefile.am || die "sed failed"
|
56 |
56 |
|
57 |
57 |
# If we're not running tests, don't bother building them.
|
58 |
58 |
if ! use test; then
|
59 |
59 |
sed -i '/^SUBDIRS/s:tests::' Makefile.am || die
|
60 |
60 |
fi
|
61 |
61 |
|
62 |
|
# Workaround configure.in
|
63 |
|
mv configure.in configure.ac || die
|
64 |
|
|
65 |
62 |
eautoreconf
|
66 |
63 |
}
|
67 |
64 |
|
68 |
65 |
src_configure() {
|
69 |
|
local my_conf
|
|
66 |
use elibc_musl && append-ldflags -lfts
|
|
67 |
|
|
68 |
local my_conf=(
|
|
69 |
$(use_enable static-libs static)
|
|
70 |
$(use_enable daemon)
|
|
71 |
$(use_enable pam)
|
|
72 |
$(use_enable tools)
|
|
73 |
$(use_enable test tests)
|
|
74 |
)
|
70 |
75 |
|
71 |
76 |
if use pam; then
|
72 |
|
my_conf=" --enable-pam-module-dir=$(getpam_mod_dir) "
|
|
77 |
my_conf+=( --enable-pam-module-dir="$(getpam_mod_dir)" )
|
73 |
78 |
fi
|
74 |
79 |
|
75 |
|
use elibc_musl && append-ldflags "-lfts"
|
76 |
|
econf \
|
77 |
|
$(use_enable static-libs static) \
|
78 |
|
$(use_enable daemon) \
|
79 |
|
$(use_enable pam) \
|
80 |
|
$(use_enable tools) \
|
81 |
|
${my_conf}
|
|
80 |
econf "${my_conf[@]}"
|
|
81 |
}
|
|
82 |
|
|
83 |
src_test() {
|
|
84 |
# Run just the unit tests rather than the full lot as they
|
|
85 |
# need fewer permissions, no containers, etc.
|
|
86 |
emake -C tests/gunit check
|
82 |
87 |
}
|
83 |
88 |
|
84 |
89 |
src_install() {
|
85 |
90 |
default
|
86 |
|
find "${D}" -name '*.la' -delete || die
|
|
91 |
|
|
92 |
find "${ED}" -name '*.la' -delete || die
|
87 |
93 |
|
88 |
94 |
insinto /etc/cgroup
|
89 |
|
doins samples/*.conf
|
|
95 |
doins samples/config/cgconfig.conf
|
|
96 |
doins samples/config/cgrules.conf
|
|
97 |
doins samples/config/cgsnapshot_blacklist.conf
|
|
98 |
|
|
99 |
keepdir /etc/cgroup/cgconfig.d
|
|
100 |
keepdir /etc/cgroup/cgrules.d
|
90 |
101 |
|
91 |
102 |
if use tools; then
|
92 |
103 |
newconfd "${FILESDIR}"/cgconfig.confd-r1 cgconfig
|