qimgv: 1.0.3-alpha -> 1.0.3-unstable-2024-10-11 (#366375)
[NixPkgs.git] / pkgs / by-name / el / elogind / package.nix
blob95b90e030d94753ceb4339e81361ca5af6496abf
2   stdenv,
3   lib,
4   fetchFromGitHub,
5   fetchurl,
6   fetchpatch,
7   meson,
8   ninja,
9   m4,
10   gperf,
11   getent,
12   acl,
13   audit,
14   dbus,
15   libcap,
16   libselinux,
17   pam,
18   gettext,
19   pkg-config,
20   udev,
21   eudev,
22   util-linux,
23   libxslt,
24   python3Packages,
25   docbook5,
26   docbook_xsl,
27   docbook_xsl_ns,
28   docbook_xml_dtd_42,
29   docbook_xml_dtd_45,
31   # Defaulting to false because usually the rationale for using elogind is to
32   # use it in situation where a systemd dependency does not work (especially
33   # when building with musl, which elogind explicitly supports).
34   enableSystemd ? false,
37 stdenv.mkDerivation rec {
38   pname = "elogind";
39   version = "255.5";
41   src = fetchFromGitHub {
42     owner = "elogind";
43     repo = pname;
44     rev = "v${version}";
45     hash = "sha256-4KZr/NiiGVwzdDROhiX3GEQTUyIGva6ezb+xC2U3bkg=";
46   };
48   nativeBuildInputs = [
49     meson
50     ninja
51     m4
52     pkg-config
53     gperf
54     getent
55     libcap
56     gettext
57     libxslt.bin # xsltproc
58     docbook5
59     docbook_xsl
60     docbook_xsl_ns
61     docbook_xml_dtd_42
62     docbook_xml_dtd_45 # needed for docbook without Internet
64     python3Packages.python
65     python3Packages.jinja2
66   ];
68   buildInputs = [
69     acl
70     audit
71     dbus
72     libcap
73     libselinux
74     pam
75     util-linux
76   ] ++ (if enableSystemd then [ udev ] else [ eudev ]);
78   postPatch = ''
79     substituteInPlace meson.build --replace-fail "install_emptydir(elogindstatedir)" ""
80   '';
82   patches = [
83     (fetchurl {
84       url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/strerror_r.patch";
85       hash = "sha256-amqXP12mLtrkWuAURb3/aoQeeTSRYlYqL2q2zrKbhxk=";
86     })
87     (fetchurl {
88       url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/strerror_r_1.patch";
89       hash = "sha256-tVUlmPValUPApqRX+Cqkzn7bkIILYSuCouvgRsdl9XE=";
90     })
91     (fetchpatch {
92       url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/xxx-musl-fixes.patch";
93       includes = [
94         "src/basic/missing_prctl.h"
95         "src/libelogind/sd-journal/journal-file.h"
96       ];
97       hash = "sha256-JYPB9AKbQpVgid5BhwBTvcebE5rxDFRMYhKRNS8KPTc=";
98     })
99     (fetchurl {
100       url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/gshadow.patch";
101       hash = "sha256-YBy1OeWD1EluLTeUvqUvZKyrZyoUbGg1mxwqG5+VNO0=";
102     })
103     (fetchurl {
104       name = "FTW.patch";
105       url = "https://git.openembedded.org/openembedded-core/plain/meta/recipes-core/systemd/systemd/0005-add-missing-FTW_-macros-for-musl.patch?id=6bc5e3f3cd882c81c972dbd27aacc1ce00e5e59a";
106       hash = "sha256-SGvP0GT43vfyHxrmvl4AbsWQz8CPmNGyH001s3lTxng=";
107     })
108     (fetchurl {
109       name = "malloc_info.patch";
110       url = "https://git.openembedded.org/openembedded-core/plain/meta/recipes-core/systemd/systemd/0016-pass-correct-parameters-to-getdents64.patch?id=6bc5e3f3cd882c81c972dbd27aacc1ce00e5e59a";
111       hash = "sha256-8aOw+BTtl5Qta8aqLmliKSHEirTjp1xLM195EmBdEDI=";
112     })
113     (fetchpatch {
114       name = "malloc_trim.patch";
115       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";
116       stripLen = 3;
117       extraPrefix = [ "src/libelogind/" ];
118       hash = "sha256-rtSnCEK+frhnlwl/UW3YHxB8MUCAq48jEzQRURpxdXk=";
119     })
120     (fetchurl {
121       name = "malloc_info.patch";
122       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";
123       hash = "sha256-ZyOCmM5LcwJ7mHiZr0lQjV4G+XMxjhsUm7g7L3OzDDM=";
124     })
125     ./Add-missing-musl_missing.h-includes-for-basename.patch
126     ./Remove-outdated-musl-hack-in-rlimit_nofile_safe.patch
127   ];
129   # Inspired by the systemd `preConfigure`.
130   # Conceptually we should patch all files required during the build, but not scripts
131   # supposed to run at run-time of the software (important for cross-compilation).
132   # This package seems to have mostly scripts that run at build time.
133   preConfigure = ''
134     for dir in tools src/test; do
135       patchShebangs $dir
136     done
138     patchShebangs src/basic/generate-*.{sh,py}
139   '';
141   mesonFlags = [
142     (lib.mesonOption "dbuspolicydir" "${placeholder "out"}/share/dbus-1/system.d")
143     (lib.mesonOption "dbussystemservicedir" "${placeholder "out"}/share/dbus-1/system-services")
144     (lib.mesonOption "sysconfdir" "${placeholder "out"}/etc")
145     (lib.mesonBool "utmp" (!stdenv.hostPlatform.isMusl))
146     (lib.mesonEnable "xenctrl" false)
147   ];
149   meta = with lib; {
150     homepage = "https://github.com/elogind/elogind";
151     description = ''The systemd project's "logind", extracted to a standalone package'';
152     platforms = platforms.linux; # probably more
153     license = licenses.lgpl21Plus;
154     maintainers = with maintainers; [ nh2 ];
155   };