haskell.compiler.*: only set CLANG to match llc/opt
* By taking clang from llvmPackages we make sure there is no version mismatch between LLVM (where llc and opt come from) and clang (which previously would be taken from stdenv on darwin for example). * Only pass CLANG if useLLVM is true. Previously we also set this if targetCC was clang. This would cause potentially confusing behavior if llc and opt as well as clang are provided via PATH (and GHC is compiled with useLLVM == false), because clang from PATH would be ignored, but not llc and opt.
This commit is contained in:
parent
4db84ed126
commit
c876c7498e
5 changed files with 20 additions and 35 deletions
|
@ -214,13 +214,10 @@ stdenv.mkDerivation (rec {
|
|||
'' + lib.optionalString useLLVM ''
|
||||
export LLC="${lib.getBin llvmPackages.llvm}/bin/llc"
|
||||
export OPT="${lib.getBin llvmPackages.llvm}/bin/opt"
|
||||
'' + lib.optionalString (targetCC.isClang || (useLLVM && stdenv.targetPlatform.isDarwin)) (let
|
||||
# LLVM backend on Darwin needs clang, if we are already using clang, might as well set the environment variable.
|
||||
# See also https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
clang = if targetCC.isClang then targetCC else llvmPackages.clang;
|
||||
in ''
|
||||
export CLANG="${clang}/bin/${clang.targetPrefix}clang"
|
||||
'') + ''
|
||||
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
|
||||
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
export CLANG="${llvmPackages.clang}/bin/${llvmPackages.clang.targetPrefix}clang"
|
||||
'' + ''
|
||||
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
|
|
|
@ -219,13 +219,10 @@ stdenv.mkDerivation (rec {
|
|||
'' + lib.optionalString useLLVM ''
|
||||
export LLC="${lib.getBin llvmPackages.llvm}/bin/llc"
|
||||
export OPT="${lib.getBin llvmPackages.llvm}/bin/opt"
|
||||
'' + lib.optionalString (targetCC.isClang || (useLLVM && stdenv.targetPlatform.isDarwin)) (let
|
||||
# LLVM backend on Darwin needs clang, if we are already using clang, might as well set the environment variable.
|
||||
# See also https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
clang = if targetCC.isClang then targetCC else llvmPackages.clang;
|
||||
in ''
|
||||
export CLANG="${clang}/bin/${clang.targetPrefix}clang"
|
||||
'') + ''
|
||||
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
|
||||
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
export CLANG="${llvmPackages.clang}/bin/${llvmPackages.clang.targetPrefix}clang"
|
||||
'' + ''
|
||||
|
||||
echo -n "${buildMK dontStrip}" > mk/build.mk
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
|
|
|
@ -180,13 +180,10 @@ stdenv.mkDerivation (rec {
|
|||
'' + lib.optionalString useLLVM ''
|
||||
export LLC="${lib.getBin llvmPackages.llvm}/bin/llc"
|
||||
export OPT="${lib.getBin llvmPackages.llvm}/bin/opt"
|
||||
'' + lib.optionalString (targetCC.isClang || (useLLVM && stdenv.targetPlatform.isDarwin)) (let
|
||||
# LLVM backend on Darwin needs clang, if we are already using clang, might as well set the environment variable.
|
||||
# See also https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
clang = if targetCC.isClang then targetCC else llvmPackages.clang;
|
||||
in ''
|
||||
export CLANG="${clang}/bin/${clang.targetPrefix}clang"
|
||||
'') + ''
|
||||
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
|
||||
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
export CLANG="${llvmPackages.clang}/bin/${llvmPackages.clang.targetPrefix}clang"
|
||||
'' + ''
|
||||
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
|
|
|
@ -180,13 +180,10 @@ stdenv.mkDerivation (rec {
|
|||
'' + lib.optionalString useLLVM ''
|
||||
export LLC="${lib.getBin llvmPackages.llvm}/bin/llc"
|
||||
export OPT="${lib.getBin llvmPackages.llvm}/bin/opt"
|
||||
'' + lib.optionalString (targetCC.isClang || (useLLVM && stdenv.targetPlatform.isDarwin)) (let
|
||||
# LLVM backend on Darwin needs clang, if we are already using clang, might as well set the environment variable.
|
||||
# See also https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
clang = if targetCC.isClang then targetCC else llvmPackages.clang;
|
||||
in ''
|
||||
export CLANG="${clang}/bin/${clang.targetPrefix}clang"
|
||||
'') + ''
|
||||
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
|
||||
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
export CLANG="${llvmPackages.clang}/bin/${llvmPackages.clang.targetPrefix}clang"
|
||||
'' + ''
|
||||
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
|
|
|
@ -194,13 +194,10 @@ stdenv.mkDerivation (rec {
|
|||
'' + lib.optionalString useLLVM ''
|
||||
export LLC="${lib.getBin llvmPackages.llvm}/bin/llc"
|
||||
export OPT="${lib.getBin llvmPackages.llvm}/bin/opt"
|
||||
'' + lib.optionalString (targetCC.isClang || (useLLVM && stdenv.targetPlatform.isDarwin)) (let
|
||||
# LLVM backend on Darwin needs clang, if we are already using clang, might as well set the environment variable.
|
||||
# See also https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
clang = if targetCC.isClang then targetCC else llvmPackages.clang;
|
||||
in ''
|
||||
export CLANG="${clang}/bin/${clang.targetPrefix}clang"
|
||||
'') + ''
|
||||
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
|
||||
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
export CLANG="${llvmPackages.clang}/bin/${llvmPackages.clang.targetPrefix}clang"
|
||||
'' + ''
|
||||
|
||||
# otherwise haddock fails when generating the compiler docs
|
||||
export LANG=C.UTF-8
|
||||
|
|
Loading…
Reference in a new issue