From 2dae22748f572b52002767e3fcf86b0f70d50cdc Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Thu, 5 Sep 2024 23:44:11 +0200 Subject: [PATCH] haskell.compiler.*: set correct runtime LLVM tools in settings Note that the clang command should be adapted in the future as done for CLANG in #338782. --- pkgs/development/compilers/ghc/8.10.7.nix | 10 ++++++++++ pkgs/development/compilers/ghc/common-hadrian.nix | 10 ++++++++++ .../compilers/ghc/common-make-native-bignum.nix | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/pkgs/development/compilers/ghc/8.10.7.nix b/pkgs/development/compilers/ghc/8.10.7.nix index 3fe17f620d074..bf1c27f2a812e 100644 --- a/pkgs/development/compilers/ghc/8.10.7.nix +++ b/pkgs/development/compilers/ghc/8.10.7.nix @@ -472,6 +472,16 @@ stdenv.mkDerivation (rec { "otool command" "${toolPath "otool" installCC}" \ "install_name_tool command" "${toolPath "install_name_tool" installCC}" '' + + lib.optionalString useLLVM '' + ghc-settings-edit "$settingsFile" \ + "LLVM llc command" "${lib.getBin llvmPackages.llvm}/bin/llc" \ + "LLVM opt command" "${lib.getBin llvmPackages.llvm}/bin/opt" + '' + # FIXME(@sternenseemann): use installCC instead if possible + + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) '' + ghc-settings-edit "$settingsFile" \ + "LLVM clang command" "${llvmPackages.clang}/bin/${llvmPackages.clang.targetPrefix}clang" + '' + '' # Install the bash completion file. diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index 7ccd781544848..f9b24f291aaa0 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -622,6 +622,16 @@ stdenv.mkDerivation ({ "otool command" "${toolPath "otool" installCC}" \ "install_name_tool command" "${toolPath "install_name_tool" installCC}" '' + + lib.optionalString useLLVM '' + ghc-settings-edit "$settingsFile" \ + "LLVM llc command" "${lib.getBin llvmPackages.llvm}/bin/llc" \ + "LLVM opt command" "${lib.getBin llvmPackages.llvm}/bin/opt" + '' + # FIXME(@sternenseemann): use installCC instead if possible + + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) '' + ghc-settings-edit "$settingsFile" \ + "LLVM clang command" "${llvmPackages.clang}/bin/${llvmPackages.clang.targetPrefix}clang" + '' # Work around a GHC bug which causes unlit to be installed under a different # name than is used in the settings file. # https://gitlab.haskell.org/ghc/ghc/-/issues/23317 diff --git a/pkgs/development/compilers/ghc/common-make-native-bignum.nix b/pkgs/development/compilers/ghc/common-make-native-bignum.nix index d121baf21c24c..03d7697e2de39 100644 --- a/pkgs/development/compilers/ghc/common-make-native-bignum.nix +++ b/pkgs/development/compilers/ghc/common-make-native-bignum.nix @@ -489,6 +489,16 @@ stdenv.mkDerivation (rec { "otool command" "${toolPath "otool" installCC}" \ "install_name_tool command" "${toolPath "install_name_tool" installCC}" '' + + lib.optionalString useLLVM '' + ghc-settings-edit "$settingsFile" \ + "LLVM llc command" "${lib.getBin llvmPackages.llvm}/bin/llc" \ + "LLVM opt command" "${lib.getBin llvmPackages.llvm}/bin/opt" + '' + # FIXME(@sternenseemann): use installCC instead if possible + + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) '' + ghc-settings-edit "$settingsFile" \ + "LLVM clang command" "${llvmPackages.clang}/bin/${llvmPackages.clang.targetPrefix}clang" + '' + '' # Install the bash completion file.