From 0fcde6e3435add598610d44822ce8bf79c92f7c6 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 27 Jul 2024 20:52:00 -0400 Subject: [PATCH] haskell.compiler.ghc963Binary: work around `ar -L` issue on Darwin The bindist defaults to enabling `ar -L` if it detects a compatible `ar`. Suppress this behavior by overriding the setting. This allows the bindist to be used to bootstrap GHC 9.8. --- pkgs/development/compilers/ghc/9.6.3-binary.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/development/compilers/ghc/9.6.3-binary.nix b/pkgs/development/compilers/ghc/9.6.3-binary.nix index 65ed655e5797..7e043262f015 100644 --- a/pkgs/development/compilers/ghc/9.6.3-binary.nix +++ b/pkgs/development/compilers/ghc/9.6.3-binary.nix @@ -282,6 +282,12 @@ stdenv.mkDerivation rec { isScript "$i" || continue sed -i -e '2i export PATH="${lib.makeBinPath runtimeDeps}:$PATH"' "$i" done + '' + lib.optionalString stdenv.targetPlatform.isDarwin '' + # Work around building with binary GHC on Darwin due to GHC’s use of `ar -L` when it + # detects `llvm-ar` even though the resulting archives are not supported by ld64. + # https://gitlab.haskell.org/ghc/ghc/-/issues/23188 + # https://github.com/haskell/cabal/issues/8882 + sed -i -e 's/,("ar supports -L", "YES")/,("ar supports -L", "NO")/' "$out/lib/ghc-${version}/lib/settings" ''; # Apparently necessary for the ghc Alpine (musl) bindist: