From 2ab1817d71b577320ac4d80fdb49e74cc2f4eabe Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 31 Aug 2024 23:53:24 -0400 Subject: [PATCH 1/2] curl: allow static builds on x86_64-darwin --- pkgs/tools/networking/curl/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix index 567ddcbf7d02..ff2cd75eb869 100644 --- a/pkgs/tools/networking/curl/default.nix +++ b/pkgs/tools/networking/curl/default.nix @@ -228,7 +228,7 @@ stdenv.mkDerivation (finalAttrs: { maintainers = with lib.maintainers; [ lovek323 ]; platforms = lib.platforms.all; # Fails to link against static brotli or gss - broken = stdenv.hostPlatform.isStatic && (brotliSupport || gssSupport || stdenv.hostPlatform.system == "x86_64-darwin"); + broken = stdenv.hostPlatform.isStatic && (brotliSupport || gssSupport); pkgConfigModules = [ "libcurl" ]; mainProgram = "curl"; }; From fbf56c14a808ed3b016d44061489388e3e35dd0d Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Tue, 17 Sep 2024 00:27:22 -0400 Subject: [PATCH 2/2] curl: link libiconv in static builds on Darwin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of curl’s dependencies require libiconv, but the `configure` script is not including `-liconv` in the linker flags when checking for those dependencies in static builds. That causes the check to fail and prevents curl from building statically on Darwin. --- pkgs/tools/networking/curl/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix index ff2cd75eb869..7f17b9b48752 100644 --- a/pkgs/tools/networking/curl/default.nix +++ b/pkgs/tools/networking/curl/default.nix @@ -82,6 +82,12 @@ stdenv.mkDerivation (finalAttrs: { strictDeps = true; + env = lib.optionalAttrs (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isStatic) { + # Not having this causes curl’s `configure` script to fail with static builds on Darwin because + # some of curl’s propagated inputs need libiconv. + NIX_LDFLAGS = "-liconv"; + }; + nativeBuildInputs = [ pkg-config perl ]; # Zlib and OpenSSL must be propagated because `libcurl.la' contains