From b810da025f6445ba0914db3082bbaae5bb6f38dc Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 27 Oct 2023 08:39:40 -0400 Subject: [PATCH] darwin.diskdev_cmds: fix build with clang 16 Fix an implicit `int` on argc, which is an error with newer clangs. --- .../apple-source-releases/diskdev_cmds/default.nix | 7 ++++++- .../diskdev_cmds/fix-implicit-int.patch | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 pkgs/os-specific/darwin/apple-source-releases/diskdev_cmds/fix-implicit-int.patch diff --git a/pkgs/os-specific/darwin/apple-source-releases/diskdev_cmds/default.nix b/pkgs/os-specific/darwin/apple-source-releases/diskdev_cmds/default.nix index 30d123ab804c8..e4431c68c9aad 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/diskdev_cmds/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/diskdev_cmds/default.nix @@ -5,12 +5,17 @@ let xnu-src = if stdenv.isAarch64 then macosPackages_11_0_1.xnu.src else xnu.src; arch = if stdenv.isAarch64 then "arm" else "i386"; in appleDerivation { + patches = [ + # Fixes a build failure with newer versions of clang that make implicit int an error. + ./fix-implicit-int.patch + ]; + nativeBuildInputs = [ xcbuildHook ]; buildInputs = [ libutil ]; env.NIX_CFLAGS_COMPILE = "-I."; NIX_LDFLAGS = "-lutil"; - patchPhase = '' + prePatch = '' # ugly hacks for missing headers # most are bsd related - probably should make this a drv unpackFile ${Libc.src} diff --git a/pkgs/os-specific/darwin/apple-source-releases/diskdev_cmds/fix-implicit-int.patch b/pkgs/os-specific/darwin/apple-source-releases/diskdev_cmds/fix-implicit-int.patch new file mode 100644 index 0000000000000..df0fff930daf1 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/diskdev_cmds/fix-implicit-int.patch @@ -0,0 +1,11 @@ +diff -ur a/diskdev_cmds.xcodeproj/project.pbxproj b/diskdev_cmds.xcodeproj/project.pbxproj +--- a/quota.tproj/quota.c 2021-10-06 01:13:40.000000000 -0400 ++++ b/quota.tproj/quota.c 2023-10-27 08:24:05.960965958 -0400 +@@ -115,6 +115,7 @@ + + int + main(argc, argv) ++ int argc; + char *argv[]; + { + int ngroups;