1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 pam,
6 bison,
7 flex,
8 enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemdLibs,
9 systemdLibs,
10 musl-fts,
11 autoreconfHook,
12}:
13
14stdenv.mkDerivation rec {
15 pname = "libcgroup";
16 version = "3.2.0";
17
18 src = fetchFromGitHub {
19 owner = "libcgroup";
20 repo = "libcgroup";
21 rev = "v${version}";
22 fetchSubmodules = true;
23 hash = "sha256-kWW9ID/eYZH0O/Ge8pf3Cso4yu644R5EiQFYfZMcizs=";
24 };
25
26 configureFlags = [
27 (lib.enableFeature enableSystemd "systemd")
28 ]
29 # implicit declaration of function 'rpl_malloc', ; did you mean 'realloc'
30 #
31 # It looks like in case of cross-compilation, autoconf assumes that malloc of the
32 # target platform is broken.
33 ++ lib.optionals (!lib.systems.equals stdenv.buildPlatform stdenv.hostPlatform) [
34 "ac_cv_func_malloc_0_nonnull=yes"
35 "ac_cv_func_realloc_0_nonnull=yes"
36 ];
37
38 nativeBuildInputs = [
39 autoreconfHook
40 bison
41 flex
42 ];
43 buildInputs = [
44 pam
45 ]
46 ++ lib.optional enableSystemd systemdLibs
47 ++ lib.optional stdenv.hostPlatform.isMusl musl-fts;
48
49 postPatch = ''
50 substituteInPlace src/tools/Makefile.am \
51 --replace 'chmod u+s' 'chmod +x'
52 '';
53
54 meta = {
55 description = "Library and tools to manage Linux cgroups";
56 homepage = "https://github.com/libcgroup/libcgroup";
57 license = lib.licenses.lgpl2;
58 platforms = lib.platforms.linux;
59 maintainers = [ lib.maintainers.thoughtpolice ];
60 };
61}