diff --git a/pkgs/by-name/ut/util-linux/fix-darwin-build.patch b/pkgs/by-name/ut/util-linux/fix-darwin-build.patch new file mode 100644 index 000000000000..c65266e88690 --- /dev/null +++ b/pkgs/by-name/ut/util-linux/fix-darwin-build.patch @@ -0,0 +1,35 @@ +From e47c6f751a7ef87640c61316ada774e8e9cc6b07 Mon Sep 17 00:00:00 2001 +From: Eugene Gershnik +Date: Mon, 6 May 2024 09:29:39 -0700 +Subject: [PATCH] libuuid: fix uuid_time on macOS without attribute((alias)) + +Weak aliases are not supported by clang on Darwin. +Instead this fix uses inline asm to make `_uuid_time` an alias to +`___uuid_time` + +It appears that on macOS the time API is purely 32 or 64 bit depending +on the build type. There is no ABI issue on that platform and `uuid_time` +can be unconditionally aliased to `_uuid_time`. This is all conjectural, +however, since I have no ability to make 32-bit builds for macOS - the +Apple toolchain doesn't support this since 2019. + +Fixes util-linux/util-linux#2873 +--- + libuuid/src/uuid_time.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/libuuid/src/uuid_time.c b/libuuid/src/uuid_time.c +index 9b415b3ee73..df0478e1909 100644 +--- a/libuuid/src/uuid_time.c ++++ b/libuuid/src/uuid_time.c +@@ -85,6 +85,10 @@ time_t __uuid_time(const uuid_t uu, struct timeval *ret_tv) + } + #if defined(__USE_TIME_BITS64) && defined(__GLIBC__) + extern time_t uuid_time64(const uuid_t uu, struct timeval *ret_tv) __attribute__((weak, alias("__uuid_time"))); ++#elif defined(__clang__) && defined(__APPLE__) ++__asm__(".globl _uuid_time"); ++__asm__(".set _uuid_time, ___uuid_time"); ++extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv); + #else + extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv) __attribute__((weak, alias("__uuid_time"))); + #endif diff --git a/pkgs/by-name/ut/util-linux/package.nix b/pkgs/by-name/ut/util-linux/package.nix index e726ec46d343..c4c0bfa28194 100644 --- a/pkgs/by-name/ut/util-linux/package.nix +++ b/pkgs/by-name/ut/util-linux/package.nix @@ -2,7 +2,6 @@ lib, stdenv, fetchurl, - fetchpatch, pkg-config, zlib, shadow, @@ -15,6 +14,7 @@ pam, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd, + sqlite, nlsSupport ? true, translateManpages ? true, po4a, @@ -27,21 +27,16 @@ stdenv.mkDerivation rec { pname = "util-linux" + lib.optionalString (!nlsSupport && !ncursesSupport && !systemdSupport) "-minimal"; - version = "2.39.4"; + version = "2.40.4"; src = fetchurl { url = "mirror://kernel/linux/utils/util-linux/v${lib.versions.majorMinor version}/util-linux-${version}.tar.xz"; - hash = "sha256-bE+HI9r9QcOdk+y/FlCfyIwzzVvTJ3iArlodl6AU/Q4="; + hash = "sha256-XB2vczsE6YWa/cO9h8xIEYDuD4i1wJRrFv3skxl1+3k="; }; patches = [ ./rtcwake-search-PATH-for-shutdown.patch - - (fetchpatch { - name = "basename.patch"; - url = "https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/patch/?id=77454e58d58f904cfdc02d3ca5bb65f1bd8739fc"; - hash = "sha256-ELWC4bYN3rvn9XIN0XgCo55pXNfS2VpbZWuwzRLfO/0="; - }) + ./fix-darwin-build.patch ]; # We separate some of the utilities into their own outputs. This @@ -64,7 +59,7 @@ stdenv.mkDerivation rec { postPatch = '' - patchShebangs tests/run.sh + patchShebangs tests/run.sh tools/all_syscalls substituteInPlace sys-utils/eject.c \ --replace "/bin/umount" "$bin/bin/umount" @@ -95,6 +90,7 @@ stdenv.mkDerivation rec { (lib.withFeature ncursesSupport "ncursesw") (lib.withFeature systemdSupport "systemd") (lib.withFeatureAs systemdSupport "systemdsystemunitdir" "${placeholder "bin"}/lib/systemd/system/") + (lib.withFeatureAs systemdSupport "tmpfilesdir" "${placeholder "out"}/lib/tmpfiles.d") (lib.enableFeature translateManpages "poman") "SYSCONFSTATICDIR=${placeholder "lib"}/lib" ] @@ -121,6 +117,7 @@ stdenv.mkDerivation rec { [ zlib libxcrypt + sqlite ] ++ lib.optionals pamSupport [ pam ] ++ lib.optionals capabilitiesSupport [ libcap_ng ]