From 15da7dce6ac7e1950c0e3bc1747a81899843de12 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 19 May 2023 15:55:12 -0400 Subject: [PATCH] configd: fix build with newer LLVM and bootstrap Clang 15 does not like the fake xpc headers. Use the real ones instead. Doing this no longer causes an infinite recursion because xnu now depends on python3Minimal, which does not include configd support. --- .../apple-source-releases/configd/default.nix | 65 +++++-------------- .../darwin/apple-source-releases/default.nix | 2 + 2 files changed, 17 insertions(+), 50 deletions(-) diff --git a/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix b/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix index 37830c0665e1..d17db5a345a8 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix @@ -1,67 +1,32 @@ -{ lib, stdenv, appleDerivation', launchd, bootstrap_cmds, xnu, ppp, IOKit, eap8021x, Security +{ lib, stdenv, appleDerivation', launchd, bootstrap_cmds, xnu, xpc, ppp, IOKit, eap8021x, Security , headersOnly ? false }: appleDerivation' stdenv { meta.broken = stdenv.cc.nativeLibc; nativeBuildInputs = lib.optionals (!headersOnly) [ bootstrap_cmds ]; - buildInputs = lib.optionals (!headersOnly) [ launchd ppp IOKit eap8021x ]; + buildInputs = lib.optionals (!headersOnly) [ launchd ppp xpc IOKit eap8021x ]; propagatedBuildInputs = lib.optionals (!headersOnly) [ Security ]; + env = lib.optionalAttrs (!headersOnly) { + NIX_CFLAGS_COMPILE = toString [ + "-ISystemConfiguration.framework/Headers" + "-I${xnu}/Library/Frameworks/System.framework/Versions/B/PrivateHeaders" + ]; + }; + patchPhase = lib.optionalString (!headersOnly) '' - HACK=$PWD/hack - mkdir $HACK - cp -r ${xnu}/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/net $HACK - - - substituteInPlace SystemConfiguration.fproj/SCNetworkReachabilityInternal.h \ - --replace '#include ' "" + substituteInPlace SystemConfiguration.fproj/reachability/SCNetworkReachabilityServer_client.c \ + --replace '#include ' "" substituteInPlace SystemConfiguration.fproj/SCNetworkReachability.c \ --replace ''$'#define\tHAVE_VPN_STATUS' "" - substituteInPlace SystemConfiguration.fproj/reachability/SCNetworkReachabilityServer_client.c \ - --replace '#include ' '#include "fake_xpc.h"' \ - --replace '#include ' "" \ - # Our neutered CoreFoundation doesn't have this function, but I think we'll live... substituteInPlace SystemConfiguration.fproj/SCNetworkConnectionPrivate.c \ --replace 'CFPreferencesAppValueIsForced(serviceID, USER_PREFERENCES_APPLICATION_ID)' 'FALSE' \ --replace 'CFPreferencesAppValueIsForced(userPrivate->serviceID, USER_PREFERENCES_APPLICATION_ID)' 'FALSE' - - cat >SystemConfiguration.fproj/fake_xpc.h <