summaryrefslogtreecommitdiff
path: root/packages/dev-libs/libcgroup/libcgroup.exlib
blob: 13f5d557ba1e19abb99b3e4e79219b43c3491a57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Copyright 2010-2017 Wulf C. Krueger <philantrop@exherbo.org>
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

require sourceforge [ project="libcg" ]
require autotools [ supported_autoconf=[ 2.5 ] supported_automake=[ 1.13 ] ]

export_exlib_phases pkg_postinst src_prepare

SUMMARY="libcg is a library that abstracts the control group file system in Linux"
DESCRIPTION="
libcgroup aims to provide programmers easily usable APIs to use the control group
file system. It should satisfy the following requirements:
- Provide a programmable interface for cgroups
- Provide persistent configuration across reboots
- Provide a programmable interface for manipulating configurations
"

#BUGS_TO="philantrop@exherbo.org"

UPSTREAM_DOCUMENTATION="${HOMEPAGE}/html/index.html [[ lang = en ]]"

LICENCES="LGPL-2.1"
SLOT="0"
MYOPTIONS=""

DEPENDENCIES="
    build+run:
        sys-libs/pam
"

# The tests since 0.38 want to mess directly with /sys *and* expect libcgroup to
# be already installed. Last checked: 0.41
RESTRICT="test"

DEFAULT_SRC_CONFIGURE_PARAMS=(
    --enable-cgred-socket=/run/cgred.sock
    --enable-daemon
    --enable-pam
    --enable-shared
    --enable-static
    --enable-tools
)

DEFAULT_SRC_CONFIGURE_PARAMS=( --enable-opaque-hierarchy=name=systemd )

DEFAULT_SRC_PREPARE_PATCHES=(
   	"${FILES}"/${PNV}-replace_DECLS.patch
	"${FILES}"/${PNV}-replace_INLCUDES.patch
	"${FILES}"/${PNV}-reorder-headers.patch
    "${FILES}"/1bce3ab63968022e97599bbd73ec1a66aacf45bc.diff
)

libcgroup_src_prepare() {
   	# Change rules file location
	edo sed -e 's:/etc/cgrules.conf:/etc/cgroup/cgrules.conf:' \
		-i src/libcgroup-internal.h
	edo sed -e 's:/etc/cgconfig.conf:/etc/cgroup/cgconfig.conf:' \
		-i src/libcgroup-internal.h
	edo sed -e 's:\(pam_cgroup_la_LDFLAGS.*\):\1\ -avoid-version:' \
		-i src/pam/Makefile.am
	edo sed -e 's#/var/run#/run#g' -i configure.in || die "sed failed"
    autotools_src_prepare
}

libcgroup_pkg_postinst() {
    default

    local cruft=( /etc/rc.d/init.d/cgconfig /etc/rc.d/init.d/cgred )
    for file in ${cruft[@]}; do
        if test -f "${file}" ; then
            nonfatal edo rm "${file}" || ewarn "removing ${file} failed"
        fi
    done
}