0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 06:00:33 +03:00

polkit: Disable systemd support on musl, it needs elogind there

This commit is contained in:
Niklas Hambüchen 2019-10-26 17:53:52 +02:00
parent 3f4bd0e04b
commit 1ca49b80cb
2 changed files with 30 additions and 9 deletions

View file

@ -12,7 +12,7 @@
, udev , udev
, eudev , eudev
, libxslt , libxslt
, python3Packages , python3
, docbook5 , docbook5
, docbook_xsl , docbook_xsl
, docbook_xsl_ns , docbook_xsl_ns
@ -49,14 +49,22 @@ stdenv.mkDerivation rec {
gettext gettext
libxslt.bin # xsltproc libxslt.bin # xsltproc
docbook5 docbook_xsl docbook_xsl_ns docbook_xml_dtd_42 docbook_xml_dtd_45 # needed for docbook without Internet docbook5 docbook_xsl docbook_xsl_ns docbook_xml_dtd_42 docbook_xml_dtd_45 # needed for docbook without Internet
python3Packages.lxml # fixes: man/meson.build:111:0: ERROR: Could not execute command "/build/source/tools/xml_helper.py". (python3.withPackages (p: with p; [ lxml ])) # fixes: man/meson.build:111:0: ERROR: Could not execute command "/build/source/tools/xml_helper.py".
]; ];
buildInputs = buildInputs =
if enableSystemd then [udev] else [eudev]; if enableSystemd then [ udev ] else [ eudev ];
# 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 = '' preConfigure = ''
patchShebangs . for dir in tools src/test; do
patchShebangs $dir
done
patchShebangs src/basic/generate-*.{sh,py}
''; '';
mesonFlags = [ mesonFlags = [
@ -65,10 +73,10 @@ stdenv.mkDerivation rec {
]; ];
meta = { meta = {
homepage = https://github.com/elogind/elogind/releases; homepage = https://github.com/elogind/elogind;
description = ''The systemd project's "logind", extracted to a standalone package''; description = ''The systemd project's "logind", extracted to a standalone package'';
platforms = platforms.linux; # probably more platforms = platforms.linux; # probably more
license = licenses.gpl2; license = licenses.lgpl21Plus;
maintainers = with maintainers; [ nh2 ]; maintainers = with maintainers; [ nh2 ];
}; };
} }

View file

@ -1,9 +1,13 @@
{ stdenv, fetchurl, pkgconfig, glib, expat, pam, perl, fetchpatch { stdenv, fetchurl, pkgconfig, glib, expat, pam, perl, fetchpatch
, intltool, spidermonkey_60 , gobject-introspection, libxslt, docbook_xsl, dbus , intltool, spidermonkey_60 , gobject-introspection, libxslt, docbook_xsl, dbus
, docbook_xml_dtd_412, gtk-doc, coreutils , docbook_xml_dtd_412, gtk-doc, coreutils
, useSystemd ? stdenv.isLinux, systemd , useSystemd ? (stdenv.isLinux && !stdenv.hostPlatform.isMusl), systemd, elogind
, withGnome ? true , withGnome ? true
, doCheck ? stdenv.isLinux # A few tests currently fail on musl (polkitunixusertest, polkitunixgrouptest, polkitidentitytest segfault).
# Not yet investigated; it may be due to the "Make netgroup support optional"
# patch not updating the tests correctly yet, or doing something wrong,
# or being unrelated to that.
, doCheck ? (stdenv.isLinux && !stdenv.hostPlatform.isMusl)
}: }:
let let
@ -28,6 +32,15 @@ stdenv.mkDerivation rec {
url = "https://gitlab.freedesktop.org/polkit/polkit/merge_requests/11.patch"; url = "https://gitlab.freedesktop.org/polkit/polkit/merge_requests/11.patch";
sha256 = "17lv7xj5ksa27iv4zpm4zwd4iy8zbwjj4ximslfq3sasiz9kxhlp"; sha256 = "17lv7xj5ksa27iv4zpm4zwd4iy8zbwjj4ximslfq3sasiz9kxhlp";
}) })
] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
# Make netgroup support optional (musl does not have it)
# Upstream MR: https://gitlab.freedesktop.org/polkit/polkit/merge_requests/10
# We use the version of the patch that Alpine uses successfully.
(fetchpatch {
name = "make-innetgr-optional.patch";
url = "https://git.alpinelinux.org/aports/plain/main/polkit/make-innetgr-optional.patch?id=391e7de6ced1a96c2dac812e0b12f1d7e0ea705e";
sha256 = "1p9qqqhnrfyjvvd50qh6vpl256kyfblm1qnhz5pm09klrl1bh1n4";
})
]; ];
postPatch = stdenv.lib.optionalString stdenv.isDarwin '' postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
@ -41,7 +54,7 @@ stdenv.mkDerivation rec {
++ [ libxslt docbook_xsl docbook_xml_dtd_412 ]; # man pages ++ [ libxslt docbook_xsl docbook_xml_dtd_412 ]; # man pages
buildInputs = buildInputs =
[ expat pam spidermonkey_60 ] [ expat pam spidermonkey_60 ]
++ stdenv.lib.optional useSystemd systemd ++ (if useSystemd then [systemd] else [elogind])
++ stdenv.lib.optional withGnome gobject-introspection; ++ stdenv.lib.optional withGnome gobject-introspection;
propagatedBuildInputs = [ propagatedBuildInputs = [