From fbf56c14a808ed3b016d44061489388e3e35dd0d Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Tue, 17 Sep 2024 00:27:22 -0400 Subject: [PATCH] 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 ff2cd75eb8695..7f17b9b487521 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