summary refs log tree commit diff
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2023-06-05 19:26:06 +0200
committerGitHub <noreply@github.com>2023-06-05 19:26:06 +0200
commit501dcc2d3e5bf68002688afa2545a91ae8e010a8 (patch)
tree07cfcbdeb1af31b6eeb7b57feaf3995b56fafa87
parent203f3a647117ba98838d5dfc439bda39ee3d7fb5 (diff)
parent09799e8b80d7bb647cf28b2ca99875145e71417f (diff)
downloadnixpkgs-501dcc2d3e5bf68002688afa2545a91ae8e010a8.tar
nixpkgs-501dcc2d3e5bf68002688afa2545a91ae8e010a8.tar.gz
nixpkgs-501dcc2d3e5bf68002688afa2545a91ae8e010a8.tar.bz2
nixpkgs-501dcc2d3e5bf68002688afa2545a91ae8e010a8.tar.lz
nixpkgs-501dcc2d3e5bf68002688afa2545a91ae8e010a8.tar.xz
nixpkgs-501dcc2d3e5bf68002688afa2545a91ae8e010a8.tar.zst
nixpkgs-501dcc2d3e5bf68002688afa2545a91ae8e010a8.zip
Merge pull request #234857 from reckenrode/configd-fix
configd: fix build with newer LLVM and bootstrap
-rw-r--r--pkgs/os-specific/darwin/apple-sdk/default.nix7
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/configd/default.nix65
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/default.nix2
3 files changed, 22 insertions, 52 deletions
diff --git a/pkgs/os-specific/darwin/apple-sdk/default.nix b/pkgs/os-specific/darwin/apple-sdk/default.nix
index 48c423c9892..0c959695d77 100644
--- a/pkgs/os-specific/darwin/apple-sdk/default.nix
+++ b/pkgs/os-specific/darwin/apple-sdk/default.nix
@@ -1,6 +1,9 @@
-{ stdenv, fetchurl, xar, cpio, pkgs, python3, pbzx, lib, darwin-stubs, print-reexports }:
+{ stdenv, fetchurl, libxml2, xar, cpio, pkgs, python3Minimal, pbzx, lib, darwin-stubs, print-reexports }:
 
 let
+  xarMinimal = xar.override {
+    libxml2 = libxml2.override { pythonSupport = false; };
+  };
   # sadly needs to be exported because security_tool needs it
   sdk = stdenv.mkDerivation rec {
     pname = "MacOS_SDK";
@@ -16,7 +19,7 @@ let
       sha256 = "13xq34sb7383b37hwy076gnhf96prpk1b4087p87xnwswxbrisih";
     };
 
-    nativeBuildInputs = [ xar cpio python3 pbzx ];
+    nativeBuildInputs = [ xarMinimal cpio python3Minimal pbzx ];
 
     outputs = [ "out" "dev" "man" ];
 
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 37830c0665e..d17db5a345a 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 ];
 
-  patchPhase = lib.optionalString (!headersOnly) ''
-    HACK=$PWD/hack
-    mkdir $HACK
-    cp -r ${xnu}/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/net $HACK
-
+  env = lib.optionalAttrs (!headersOnly) {
+    NIX_CFLAGS_COMPILE = toString [
+      "-ISystemConfiguration.framework/Headers"
+      "-I${xnu}/Library/Frameworks/System.framework/Versions/B/PrivateHeaders"
+    ];
+  };
 
-    substituteInPlace SystemConfiguration.fproj/SCNetworkReachabilityInternal.h \
-      --replace '#include <xpc/xpc.h>' ""
+  patchPhase = lib.optionalString (!headersOnly) ''
+    substituteInPlace SystemConfiguration.fproj/reachability/SCNetworkReachabilityServer_client.c \
+      --replace '#include <xpc/private.h>' ""
 
     substituteInPlace SystemConfiguration.fproj/SCNetworkReachability.c \
       --replace ''$'#define\tHAVE_VPN_STATUS' ""
 
-    substituteInPlace SystemConfiguration.fproj/reachability/SCNetworkReachabilityServer_client.c \
-      --replace '#include <xpc/xpc.h>' '#include "fake_xpc.h"' \
-      --replace '#include <xpc/private.h>' "" \
-
     # 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 <<EOF
-    typedef void *xpc_type_t;
-    typedef void *xpc_object_t;
-    typedef void *xpc_connection_t;
-
-    xpc_type_t xpc_get_type(xpc_object_t object);
-    xpc_object_t xpc_dictionary_create(const char * const *keys, const xpc_object_t *values, size_t count);
-    char *xpc_copy_description(xpc_object_t object);
-    int64_t  xpc_dictionary_get_int64(xpc_object_t xdict, const char *key);
-    uint64_t xpc_dictionary_get_uint64(xpc_object_t xdict, const char *key);
-    void xpc_connection_set_event_handler(xpc_connection_t connection, void *handler);
-
-    extern const struct _xpc_type_s _xpc_type_error;
-    #define XPC_TYPE_ERROR (&_xpc_type_error)
-
-    extern const struct _xpc_type_s _xpc_type_dictionary;
-    #define XPC_TYPE_DICTIONARY (&_xpc_type_dictionary)
-
-    extern const struct _xpc_type_s _xpc_type_array;
-    #define XPC_TYPE_ARRAY (&_xpc_type_array)
-
-    extern const struct _xpc_dictionary_s _xpc_error_connection_interrupted;
-    #define XPC_ERROR_CONNECTION_INTERRUPTED (&_xpc_error_connection_interrupted)
-
-    extern const struct _xpc_dictionary_s _xpc_error_connection_invalid;
-    #define XPC_ERROR_CONNECTION_INVALID (&_xpc_error_connection_invalid)
-
-    extern const char *const _xpc_error_key_description;
-    #define XPC_ERROR_KEY_DESCRIPTION _xpc_error_key_description
-
-    #define XPC_CONNECTION_MACH_SERVICE_PRIVILEGED (1 << 1)
-    EOF
   '';
 
   dontBuild = headersOnly;
@@ -177,9 +142,9 @@ appleDerivation' stdenv {
     $CC -I. -Ihelper -Iderived -F. -c DHCP.c -o DHCP.o
     $CC -I. -Ihelper -Iderived -F. -c moh.c -o moh.o
     $CC -I. -Ihelper -Iderived -F. -c DeviceOnHold.c -o DeviceOnHold.o
-    $CC -I. -Ihelper -Iderived -I $HACK -F. -c LinkConfiguration.c -o LinkConfiguration.o
+    $CC -I. -Ihelper -Iderived -F. -c LinkConfiguration.c -o LinkConfiguration.o
     $CC -I. -Ihelper -Iderived -F. -c dy_framework.c -o dy_framework.o
-    $CC -I. -Ihelper -Iderived -I $HACK -F. -c VLANConfiguration.c -o VLANConfiguration.o
+    $CC -I. -Ihelper -Iderived -F. -c VLANConfiguration.c -o VLANConfiguration.o
     $CC -I. -Ihelper -Iderived -F. -c derived/configUser.c -o configUser.o
     $CC -I. -Ihelper -Iderived -F. -c SCPreferencesPathKey.c -o SCPreferencesPathKey.o
     $CC -I. -Ihelper -Iderived -I../dnsinfo -F. -c derived/shared_dns_infoUser.c -o shared_dns_infoUser.o
@@ -188,8 +153,8 @@ appleDerivation' stdenv {
     $CC -I. -Ihelper -Iderived -F. -c SCNetworkProtocol.c -o SCNetworkProtocol.o
     $CC -I. -Ihelper -Iderived -F. -c SCNetworkService.c -o SCNetworkService.o
     $CC -I. -Ihelper -Iderived -F. -c SCNetworkSet.c -o SCNetworkSet.o
-    $CC -I. -Ihelper -Iderived -I $HACK -F. -c BondConfiguration.c -o BondConfiguration.o
-    $CC -I. -Ihelper -Iderived -I $HACK -F. -c BridgeConfiguration.c -o BridgeConfiguration.o
+    $CC -I. -Ihelper -Iderived -F. -c BondConfiguration.c -o BondConfiguration.o
+    $CC -I. -Ihelper -Iderived -F. -c BridgeConfiguration.c -o BridgeConfiguration.o
     $CC -I. -Ihelper -Iderived -F. -c helper/SCHelper_client.c -o SCHelper_client.o
     $CC -I. -Ihelper -Iderived -F. -c SCPreferencesKeychainPrivate.c -o SCPreferencesKeychainPrivate.o
     $CC -I. -Ihelper -Iderived -F. -c SCNetworkSignature.c -o SCNetworkSignature.o
diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix
index ba0e5b3b78b..40f3fd2478a 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix
@@ -248,6 +248,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // {
     CommonCrypto    = applePackage "CommonCrypto"      "osx-10.12.6"     "sha256-FLgODBrfv+XsGaAjddncYAm/BIJJYw6LcwX/z7ncKFM=" {};
     configd         = applePackage "configd"           "osx-10.8.5"      "sha256-6I3FWNjTgds5abEcZrD++s9b+P9a2+qUf8KFAb72DwI=" {
       Security      = applePackage "Security/boot.nix" "osx-10.9.5"      "sha256-7qr0IamjCXCobIJ6V9KtvbMBkJDfRCy4C5eqpHJlQLI=" {};
+      inherit (pkgs.darwin.apple_sdk.libs) xpc;
     };
     copyfile        = applePackage "copyfile"          "osx-10.12.6"     "sha256-uHqLFOIpXK+n0RHyOZzVsP2DDZcFDivKCnqHBaXvHns=" {};
     Csu             = applePackage "Csu"               "osx-10.11.6"     "sha256-h6a/sQMEVeFxKNWAPgKBXjWhyL2L2nvX9BQUMaTQ6sY=" {};
@@ -310,6 +311,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // {
     configdHeaders  = applePackage "configd"           "osx-10.8.5"      "sha256-6I3FWNjTgds5abEcZrD++s9b+P9a2+qUf8KFAb72DwI=" {
       headersOnly = true;
       Security    = null;
+      xpc         = null;
     };
     libutilHeaders  = pkgs.darwin.libutil.override { headersOnly = true; };
     hfsHeaders      = pkgs.darwin.hfs.override { headersOnly = true; };