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.
This commit is contained in:
Randy Eckenrode 2024-07-27 20:52:00 -04:00
parent 202ad9365a
commit 0fcde6e343
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9

View File

@ -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 GHCs 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: