Merge github#785: net-libs/nodejs: removal
[gentoo.git] / dev-libs / libcgroup / libcgroup-0.41-r3.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6
7 inherit autotools eutils flag-o-matic linux-info pam
8
9 DESCRIPTION="Tools and libraries to configure and manage kernel control groups"
10 HOMEPAGE="http://libcg.sourceforge.net/"
11 SRC_URI="mirror://sourceforge/project/libcg/${PN}/v${PV}/${P}.tar.bz2"
12
13 LICENSE="LGPL-2.1"
14 SLOT="0"
15 KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
16 IUSE="+daemon elibc_musl debug pam static-libs +tools"
17
18 RDEPEND="pam? ( virtual/pam )"
19
20 DEPEND="
21         ${RDEPEND}
22         sys-devel/bison
23         sys-devel/flex
24         elibc_musl? ( sys-libs/fts-standalone )
25         "
26 REQUIRED_USE="daemon? ( tools )"
27
28 DOCS=(README_daemon README README_systemd INSTALL)
29 pkg_setup() {
30         local CONFIG_CHECK="~CGROUPS"
31         if use daemon; then
32                 CONFIG_CHECK="${CONFIG_CHECK} ~CONNECTOR ~PROC_EVENTS"
33         fi
34         linux-info_pkg_setup
35 }
36
37 src_prepare() {
38         epatch "${FILESDIR}"/${P}-replace_DECLS.patch
39         epatch "${FILESDIR}"/${P}-replace_INLCUDES.patch
40         epatch "${FILESDIR}"/${P}-reorder-headers.patch
41
42         # Change rules file location
43         sed -e 's:/etc/cgrules.conf:/etc/cgroup/cgrules.conf:' \
44                 -i src/libcgroup-internal.h || die "sed failed"
45         sed -e 's:\(pam_cgroup_la_LDFLAGS.*\):\1\ -avoid-version:' \
46                 -i src/pam/Makefile.am || die "sed failed"
47         sed -e 's#/var/run#/run#g' -i configure.in || die "sed failed"
48
49         eautoreconf
50 }
51
52 src_configure() {
53         local my_conf
54
55         if use pam; then
56                 my_conf=" --enable-pam-module-dir=$(getpam_mod_dir) "
57         fi
58
59         use elibc_musl && append-ldflags "-lfts"
60         econf \
61                 $(use_enable static-libs static) \
62                 $(use_enable daemon) \
63                 $(use_enable debug) \
64                 $(use_enable pam) \
65                 $(use_enable tools) \
66                 ${my_conf}
67 }
68
69 src_test() {
70         # Use mount cgroup to build directory
71         # sandbox restricted to trivial build,
72         # possible kill Diego tanderbox ;)
73         true
74 }
75
76 src_install() {
77         default
78         prune_libtool_files --all
79
80         insinto /etc/cgroup
81         doins samples/*.conf || die
82
83         if use tools; then
84                 newconfd "${FILESDIR}"/cgconfig.confd-r1 cgconfig || die
85                 newinitd "${FILESDIR}"/cgconfig.initd-r1 cgconfig || die
86         fi
87
88         if use daemon; then
89                 newconfd "${FILESDIR}"/cgred.confd-r1 cgred || die
90                 newinitd "${FILESDIR}"/cgred.initd-r1 cgred || die
91         fi
92 }