cmake: Fix on darwin-arm64

Adds the SystemConfiguration framework to buildInputs unless we're
bootstrapping.

For the bootstrap version, we revert
31f631a142
instead so CMake builds without SystemConfiguration.
This commit is contained in:
Tobias Mayer 2021-07-29 17:46:58 +02:00
parent 12da67f0c6
commit 4aac491f18
3 changed files with 101 additions and 3 deletions

View file

@ -2,6 +2,7 @@
, bzip2, curlMinimal, expat, libarchive, xz, zlib, libuv, rhash
, buildPackages
# darwin attributes
, SystemConfiguration
, ps
, isBootstrap ? false
, useSharedLibraries ? (!isBootstrap && !stdenv.isCygwin)
@ -33,7 +34,9 @@ stdenv.mkDerivation rec {
# Derived from https://github.com/libuv/libuv/commit/1a5d4f08238dd532c3718e210078de1186a5920d
./libuv-application-services.patch
] ++ lib.optional stdenv.isCygwin ./3.2.2-cygwin.patch;
] ++ lib.optional stdenv.isCygwin ./3.2.2-cygwin.patch
# Derived from https://github.com/curl/curl/commit/31f631a142d855f069242f3e0c643beec25d1b51
++ lib.optional (stdenv.isDarwin && isBootstrap) ./remove-systemconfiguration-dep.patch;
outputs = [ "out" ]
++ lib.optionals buildDocs [ "man" "info" ];
@ -50,7 +53,8 @@ stdenv.mkDerivation rec {
buildInputs = lib.optionals useSharedLibraries [ bzip2 curlMinimal expat libarchive xz zlib libuv rhash ]
++ lib.optional useOpenSSL openssl
++ lib.optional useNcurses ncurses
++ lib.optional withQt5 qtbase;
++ lib.optional withQt5 qtbase
++ lib.optional (stdenv.isDarwin && !isBootstrap) SystemConfiguration;
propagatedBuildInputs = lib.optional stdenv.isDarwin ps;

View file

@ -0,0 +1,89 @@
From 76523ca5b2227085bb65253900e866b08a2b5efb Mon Sep 17 00:00:00 2001
From: Tobias Mayer <tobim@fastmail.fm>
Date: Fri, 30 Jul 2021 10:50:16 +0200
Subject: [PATCH] Disable NAT64 address synthesis on darwin
This intentionally breaks the feature by partially reverting
https://github.com/curl/curl/commit/31f631a142d855f069242f3e0c643beec25d1b51
This is a stop-gap to get CMake to build without the SystemConfiguration
framework.
---
Utilities/cmcurl/CMakeLists.txt | 8 --------
Utilities/cmcurl/lib/curl_setup.h | 4 ----
Utilities/cmcurl/lib/hostip.c | 17 -----------------
3 files changed, 29 deletions(-)
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index 16ef037ccc..17564bbb69 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -511,14 +511,6 @@ if(CMAKE_USE_SECTRANSP)
list(APPEND CURL_LIBS "${COREFOUNDATION_FRAMEWORK}" "${SECURITY_FRAMEWORK}")
endif()
-if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
- find_library(SYSTEMCONFIGURATION_FRAMEWORK "SystemConfiguration")
- if(NOT SYSTEMCONFIGURATION_FRAMEWORK)
- message(FATAL_ERROR "SystemConfiguration framework not found")
- endif()
- list(APPEND CURL_LIBS "${SYSTEMCONFIGURATION_FRAMEWORK}")
-endif()
-
if(CMAKE_USE_OPENSSL)
find_package(OpenSSL)
if(NOT OpenSSL_FOUND)
diff --git a/Utilities/cmcurl/lib/curl_setup.h b/Utilities/cmcurl/lib/curl_setup.h
index 2d13a40a55..35160bc0f5 100644
--- a/Utilities/cmcurl/lib/curl_setup.h
+++ b/Utilities/cmcurl/lib/curl_setup.h
@@ -251,11 +251,7 @@
* performing this task will result in a synthesized IPv6 address.
*/
#if defined(__APPLE__) && !defined(USE_ARES)
-#include <TargetConditionals.h>
#define USE_RESOLVE_ON_IPS 1
-# if defined(TARGET_OS_OSX) && TARGET_OS_OSX
-# define CURL_OSX_CALL_COPYPROXIES 1
-# endif
#endif
#ifdef USE_LWIPSOCK
diff --git a/Utilities/cmcurl/lib/hostip.c b/Utilities/cmcurl/lib/hostip.c
index e0e3cfc2cb..45190a100b 100644
--- a/Utilities/cmcurl/lib/hostip.c
+++ b/Utilities/cmcurl/lib/hostip.c
@@ -68,10 +68,6 @@
#include "curl_memory.h"
#include "memdebug.h"
-#if defined(ENABLE_IPV6) && defined(CURL_OSX_CALL_COPYPROXIES)
-#include <SystemConfiguration/SCDynamicStoreCopySpecific.h>
-#endif
-
#if defined(CURLRES_SYNCH) && \
defined(HAVE_ALARM) && defined(SIGALRM) && defined(HAVE_SIGSETJMP)
/* alarm-based timeouts can only be used with all the dependencies satisfied */
@@ -533,19 +529,6 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,
return CURLRESOLV_ERROR;
}
-#if defined(ENABLE_IPV6) && defined(CURL_OSX_CALL_COPYPROXIES)
- /*
- * The automagic conversion from IPv4 literals to IPv6 literals only works
- * if the SCDynamicStoreCopyProxies system function gets called first. As
- * Curl currently doesn't support system-wide HTTP proxies, we therefore
- * don't use any value this function might return.
- *
- * This function is only available on a macOS and is not needed for
- * IPv4-only builds, hence the conditions above.
- */
- SCDynamicStoreCopyProxies(NULL);
-#endif
-
#ifndef USE_RESOLVE_ON_IPS
/* First check if this is an IPv4 address string */
if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
--
2.32.0

View file

@ -13482,10 +13482,15 @@ with pkgs;
cmake_2_8 = callPackage ../development/tools/build-managers/cmake/2.8.nix { };
cmake = libsForQt5.callPackage ../development/tools/build-managers/cmake { };
cmake = libsForQt5.callPackage ../development/tools/build-managers/cmake {
inherit (darwin.apple_sdk.frameworks) SystemConfiguration;
};
cmakeMinimal = libsForQt5.callPackage ../development/tools/build-managers/cmake {
isBootstrap = true;
# There is no SystemConfiguration in bootstrapTools, so this version gets
# patched to remove that dependency.
SystemConfiguration = null;
};
cmakeCurses = cmake.override { useNcurses = true; };