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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
{
stdenv,
lib,
fetchFromGitHub,
fetchurl,
fetchpatch,
meson,
ninja,
m4,
gperf,
getent,
acl,
audit,
dbus,
libcap,
libselinux,
pam,
gettext,
pkg-config,
udev,
eudev,
util-linux,
libxslt,
python3Packages,
docbook5,
docbook_xsl,
docbook_xsl_ns,
docbook_xml_dtd_42,
docbook_xml_dtd_45,
udevCheckHook,
# Defaulting to false because usually the rationale for using elogind is to
# use it in situation where a systemd dependency does not work (especially
# when building with musl, which elogind explicitly supports).
enableSystemd ? false,
}:
stdenv.mkDerivation rec {
pname = "elogind";
version = "255.5";
src = fetchFromGitHub {
owner = "elogind";
repo = "elogind";
rev = "v${version}";
hash = "sha256-4KZr/NiiGVwzdDROhiX3GEQTUyIGva6ezb+xC2U3bkg=";
};
nativeBuildInputs = [
meson
ninja
m4
pkg-config
gperf
getent
libcap
gettext
libxslt.bin # xsltproc
docbook5
docbook_xsl
docbook_xsl_ns
docbook_xml_dtd_42
docbook_xml_dtd_45 # needed for docbook without Internet
python3Packages.python
python3Packages.jinja2
]
++ lib.optionals enableSystemd [
# udevCheckHook introduces a dependency on systemdMinimal
udevCheckHook
];
buildInputs = [
acl
audit
dbus
libcap
libselinux
pam
util-linux
]
++ (if enableSystemd then [ udev ] else [ eudev ]);
postPatch = ''
substituteInPlace meson.build --replace-fail "install_emptydir(elogindstatedir)" ""
'';
patches = [
(fetchurl {
url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/strerror_r.patch";
hash = "sha256-amqXP12mLtrkWuAURb3/aoQeeTSRYlYqL2q2zrKbhxk=";
})
(fetchurl {
url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/strerror_r_1.patch";
hash = "sha256-tVUlmPValUPApqRX+Cqkzn7bkIILYSuCouvgRsdl9XE=";
})
(fetchpatch {
url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/xxx-musl-fixes.patch";
includes = [
"src/basic/missing_prctl.h"
"src/libelogind/sd-journal/journal-file.h"
];
hash = "sha256-JYPB9AKbQpVgid5BhwBTvcebE5rxDFRMYhKRNS8KPTc=";
})
(fetchurl {
url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/gshadow.patch";
hash = "sha256-YBy1OeWD1EluLTeUvqUvZKyrZyoUbGg1mxwqG5+VNO0=";
})
(fetchurl {
name = "FTW.patch";
url = "https://git.openembedded.org/openembedded-core/plain/meta/recipes-core/systemd/systemd/0005-add-missing-FTW_-macros-for-musl.patch?id=6bc5e3f3cd882c81c972dbd27aacc1ce00e5e59a";
hash = "sha256-SGvP0GT43vfyHxrmvl4AbsWQz8CPmNGyH001s3lTxng=";
})
(fetchurl {
name = "malloc_info.patch";
url = "https://git.openembedded.org/openembedded-core/plain/meta/recipes-core/systemd/systemd/0016-pass-correct-parameters-to-getdents64.patch?id=6bc5e3f3cd882c81c972dbd27aacc1ce00e5e59a";
hash = "sha256-8aOw+BTtl5Qta8aqLmliKSHEirTjp1xLM195EmBdEDI=";
})
(fetchpatch {
name = "malloc_trim.patch";
url = "https://git.openembedded.org/openembedded-core/plain/meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch?id=6bc5e3f3cd882c81c972dbd27aacc1ce00e5e59a";
stripLen = 3;
extraPrefix = [ "src/libelogind/" ];
hash = "sha256-rtSnCEK+frhnlwl/UW3YHxB8MUCAq48jEzQRURpxdXk=";
})
(fetchurl {
name = "malloc_info.patch";
url = "https://git.openembedded.org/openembedded-core/plain/meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch?id=6bc5e3f3cd882c81c972dbd27aacc1ce00e5e59a";
hash = "sha256-ZyOCmM5LcwJ7mHiZr0lQjV4G+XMxjhsUm7g7L3OzDDM=";
})
./Add-missing-musl_missing.h-includes-for-basename.patch
./Remove-outdated-musl-hack-in-rlimit_nofile_safe.patch
];
# Inspired by the systemd `preConfigure`.
# Conceptually we should patch all files required during the build, but not scripts
# supposed to run at run-time of the software (important for cross-compilation).
# This package seems to have mostly scripts that run at build time.
preConfigure = ''
for dir in tools src/test; do
patchShebangs $dir
done
patchShebangs src/basic/generate-*.{sh,py}
'';
mesonFlags = [
(lib.mesonOption "dbuspolicydir" "${placeholder "out"}/share/dbus-1/system.d")
(lib.mesonOption "dbussystemservicedir" "${placeholder "out"}/share/dbus-1/system-services")
(lib.mesonOption "sysconfdir" "${placeholder "out"}/etc")
(lib.mesonBool "utmp" (!stdenv.hostPlatform.isMusl))
(lib.mesonEnable "xenctrl" false)
];
meta = with lib; {
homepage = "https://github.com/elogind/elogind";
description = ''The systemd project's "logind", extracted to a standalone package'';
platforms = platforms.linux; # probably more
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ nh2 ];
};
}
|