Merge pull request #232713 from eliasnaur/unix-tools-on-darwin

util-linux: 2.38.1 -> 2.39, add darwin support
This commit is contained in:
Weijia Wang 2023-05-23 08:50:26 +03:00 committed by GitHub
commit 9c777baebf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 12 deletions

View File

@ -1,5 +1,5 @@
{ lib, stdenv, fetchurl, pkg-config, zlib, shadow { lib, stdenv, fetchurl, pkg-config, zlib, shadow
, capabilitiesSupport ? true , capabilitiesSupport ? stdenv.isLinux
, libcap_ng , libcap_ng
, libxcrypt , libxcrypt
, ncursesSupport ? true , ncursesSupport ? true
@ -12,15 +12,18 @@
, translateManpages ? true , translateManpages ? true
, po4a , po4a
, installShellFiles , installShellFiles
, writeSupport ? stdenv.isLinux
, shadowSupport ? stdenv.isLinux
, memstreamHook
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "util-linux" + lib.optionalString (!nlsSupport && !ncursesSupport && !systemdSupport) "-minimal"; pname = "util-linux" + lib.optionalString (!nlsSupport && !ncursesSupport && !systemdSupport) "-minimal";
version = "2.38.1"; version = "2.39";
src = fetchurl { src = fetchurl {
url = "mirror://kernel/linux/utils/util-linux/v${lib.versions.majorMinor version}/util-linux-${version}.tar.xz"; url = "mirror://kernel/linux/utils/util-linux/v${lib.versions.majorMinor version}/util-linux-${version}.tar.xz";
hash = "sha256-YEkqGbRObPmj3f9oMlszO4tStsWc4+vWoOyqTFEX6E8="; hash = "sha256-MrMKM2zakDGC7WH+s+m5CLdipeZv4U5D77iNNxYgdcs=";
}; };
patches = [ patches = [
@ -33,10 +36,11 @@ stdenv.mkDerivation rec {
postPatch = '' postPatch = ''
patchShebangs tests/run.sh patchShebangs tests/run.sh
substituteInPlace include/pathnames.h \
--replace "/bin/login" "${shadow}/bin/login"
substituteInPlace sys-utils/eject.c \ substituteInPlace sys-utils/eject.c \
--replace "/bin/umount" "$bin/bin/umount" --replace "/bin/umount" "$bin/bin/umount"
'' + lib.optionalString shadowSupport ''
substituteInPlace include/pathnames.h \
--replace "/bin/login" "${shadow}/bin/login"
''; '';
# !!! It would be better to obtain the path to the mount helpers # !!! It would be better to obtain the path to the mount helpers
@ -45,11 +49,11 @@ stdenv.mkDerivation rec {
# root... # root...
configureFlags = [ configureFlags = [
"--localstatedir=/var" "--localstatedir=/var"
"--enable-write"
"--disable-use-tty-group" "--disable-use-tty-group"
"--enable-fs-paths-default=/run/wrappers/bin:/run/current-system/sw/bin:/sbin" "--enable-fs-paths-default=/run/wrappers/bin:/run/current-system/sw/bin:/sbin"
"--disable-makeinstall-setuid" "--disable-makeinstall-chown" "--disable-makeinstall-setuid" "--disable-makeinstall-chown"
"--disable-su" # provided by shadow "--disable-su" # provided by shadow
(lib.enableFeature writeSupport "write")
(lib.enableFeature nlsSupport "nls") (lib.enableFeature nlsSupport "nls")
(lib.withFeature ncursesSupport "ncursesw") (lib.withFeature ncursesSupport "ncursesw")
(lib.withFeature systemdSupport "systemd") (lib.withFeature systemdSupport "systemd")
@ -74,7 +78,8 @@ stdenv.mkDerivation rec {
++ lib.optionals pamSupport [ pam ] ++ lib.optionals pamSupport [ pam ]
++ lib.optionals capabilitiesSupport [ libcap_ng ] ++ lib.optionals capabilitiesSupport [ libcap_ng ]
++ lib.optionals ncursesSupport [ ncurses ] ++ lib.optionals ncursesSupport [ ncurses ]
++ lib.optionals systemdSupport [ systemd ]; ++ lib.optionals systemdSupport [ systemd ]
++ lib.optionals (stdenv.system == "x86_64-darwin") [ memstreamHook ];
doCheck = false; # "For development purpose only. Don't execute on production system!" doCheck = false; # "For development purpose only. Don't execute on production system!"
@ -90,7 +95,7 @@ stdenv.mkDerivation rec {
changelog = "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v${lib.versions.majorMinor version}/v${version}-ReleaseNotes"; changelog = "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v${lib.versions.majorMinor version}/v${version}-ReleaseNotes";
# https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/README.licensing # https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/README.licensing
license = with licenses; [ gpl2Only gpl2Plus gpl3Plus lgpl21Plus bsd3 bsdOriginalUC publicDomain ]; license = with licenses; [ gpl2Only gpl2Plus gpl3Plus lgpl21Plus bsd3 bsdOriginalUC publicDomain ];
platforms = platforms.linux; platforms = platforms.unix;
priority = 6; # lower priority than coreutils ("kill") and shadow ("login" etc.) packages priority = 6; # lower priority than coreutils ("kill") and shadow ("login" etc.) packages
}; };
} }

View File

@ -27803,15 +27803,14 @@ with pkgs;
usermount = callPackage ../os-specific/linux/usermount { }; usermount = callPackage ../os-specific/linux/usermount { };
util-linux = if stdenv.isLinux then callPackage ../os-specific/linux/util-linux { } util-linux = callPackage ../os-specific/linux/util-linux { };
else unixtools.util-linux;
util-linuxMinimal = if stdenv.isLinux then util-linux.override { util-linuxMinimal = util-linux.override {
nlsSupport = false; nlsSupport = false;
ncursesSupport = false; ncursesSupport = false;
systemdSupport = false; systemdSupport = false;
translateManpages = false; translateManpages = false;
} else util-linux; };
v4l-utils = qt5.callPackage ../os-specific/linux/v4l-utils { }; v4l-utils = qt5.callPackage ../os-specific/linux/v4l-utils { };