From 5ce912ea381df1746c33255d0a976560972c15f7 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Wed, 4 Dec 2024 10:52:17 +0900 Subject: [PATCH] fix potentially broken install_name_tool (#2284) * fix potentially broken install_name_tool We by default try to pull the one from the targetCC, only if that fails fall back to the bintools one. * Consistent use of `${targetCC.targetPrefix}` --------- Co-authored-by: Hamish Mackenzie --- compiler/ghc/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/ghc/default.nix b/compiler/ghc/default.nix index 420e802697..1bafff3d33 100644 --- a/compiler/ghc/default.nix +++ b/compiler/ghc/default.nix @@ -434,7 +434,11 @@ stdenv.mkDerivation (rec { export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip" '' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") '' export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool" - export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool" + if [ -f ${targetCC}/bin/${targetCC.targetPrefix}install_name_tool ]; then + export INSTALL_NAME_TOOL="${targetCC}/bin/${targetCC.targetPrefix}install_name_tool" + else + export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool" + fi '') + lib.optionalString (targetPlatform == hostPlatform && useLdGold) # set LD explicitly if we want gold even if we aren't cross compiling ''