1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit autotools flag-o-matic linux-info pam systemd
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"
14 KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
15 IUSE="+daemon elibc_musl pam static-libs test +tools"
16 REQUIRED_USE="daemon? ( tools )"
18 # Use mount cgroup to build directory
19 # sandbox restricted to trivial build,
25 elibc_musl? ( sys-libs/fts-standalone )
27 DEPEND="pam? ( sys-libs/pam )"
31 "${FILESDIR}"/${P}-replace-DECLS.patch
32 "${FILESDIR}"/${P}-replace-INLCUDES.patch
33 "${FILESDIR}"/${P}-reorder-headers.patch
34 "${FILESDIR}"/${P}-remove-umask.patch
38 local CONFIG_CHECK="~CGROUPS"
40 CONFIG_CHECK="${CONFIG_CHECK} ~CONNECTOR ~PROC_EVENTS"
46 "${FILESDIR}"/${P}-replace_DECLS.patch
47 "${FILESDIR}"/${P}-replace_INLCUDES.patch
48 "${FILESDIR}"/${P}-reorder-headers.patch
49 "${FILESDIR}"/${P}-remove-umask.patch
54 # Change rules file location
55 sed -e 's:/etc/cgrules.conf:/etc/cgroup/cgrules.conf:' \
56 -i src/libcgroup-internal.h || die "sed failed"
57 sed -e 's:/etc/cgconfig.conf:/etc/cgroup/cgconfig.conf:' \
58 -i src/libcgroup-internal.h || die "sed failed"
59 sed -e 's:\(pam_cgroup_la_LDFLAGS.*\):\1\ -avoid-version:' \
60 -i src/pam/Makefile.am || die "sed failed"
61 sed -e 's#/var/run#/run#g' -i configure.in || die "sed failed"
63 # If we're not running tests, don't bother building them.
65 sed -i '/^SUBDIRS/s:tests::' Makefile.am || die
68 # Workaround configure.in
69 mv configure.in configure.ac || die
78 my_conf=" --enable-pam-module-dir=$(getpam_mod_dir) "
81 use elibc_musl && append-ldflags "-lfts"
83 $(use_enable static-libs static) \
84 $(use_enable daemon) \
92 find "${D}" -name '*.la' -delete || die
98 newconfd "${FILESDIR}"/cgconfig.confd-r1 cgconfig
99 newinitd "${FILESDIR}"/cgconfig.initd-r1 cgconfig
100 systemd_dounit "${FILESDIR}"/cgconfig.service
101 systemd_dounit "${FILESDIR}"/cgrules.service
105 newconfd "${FILESDIR}"/cgred.confd-r2 cgred
106 newinitd "${FILESDIR}"/cgred.initd-r1 cgred