Merge pull request #148079 from sternenseemann/ghc-set-clang-only-if-use-llvm

haskell.compiler.*: only set CLANG to match llc/opt
This commit is contained in:
sterni 2021-12-01 17:34:38 +01:00 committed by GitHub
commit c85d141221
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 35 deletions

View file

@ -240,13 +240,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

View file

@ -227,13 +227,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

View file

@ -206,13 +206,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

View file

@ -207,13 +207,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

View file

@ -220,13 +220,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