mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 18:03:04 +00:00
clang_15: fix build!=(host==target) cross compilation
clang_15 appears to not cross compile in the build!=(host==target) case due to two problems, which this commit fixes: - It trips -Wmaybe-uninitialized on recent gcc, but only in the build!=host case (likely due to #ifdefs) - Two more buildPlatform tools have been added: clang-tidy-confusable-chars-gen and clang-pseudo-gen Co-authored-by: Rahul Butani <rrbutani@users.noreply.github.com>
This commit is contained in:
parent
ac413afd08
commit
2e77eb8190
@ -36,9 +36,14 @@ let
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
||||
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
|
||||
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
|
||||
"-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
|
||||
# Added in LLVM15:
|
||||
# `clang-tidy-confusable-chars-gen`: https://github.com/llvm/llvm-project/commit/c3574ef739fbfcc59d405985a3a4fa6f4619ecdb
|
||||
# `clang-pseudo-gen`: https://github.com/llvm/llvm-project/commit/cd2292ef824591cc34cc299910a3098545c840c7
|
||||
"-DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${buildLlvmTools.libclang.dev}/bin/clang-tidy-confusable-chars-gen"
|
||||
"-DCLANG_PSEUDO_GEN=${buildLlvmTools.libclang.dev}/bin/clang-pseudo-gen"
|
||||
];
|
||||
|
||||
patches = [
|
||||
@ -60,6 +65,12 @@ let
|
||||
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
env = lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) {
|
||||
# The following warning is triggered with (at least) gcc >=
|
||||
# 12, but appears to occur only for cross compiles.
|
||||
NIX_CFLAGS_COMPILE = "-Wno-maybe-uninitialized";
|
||||
};
|
||||
|
||||
postInstall = ''
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
||||
@ -80,7 +91,7 @@ let
|
||||
patchShebangs $python/bin
|
||||
|
||||
mkdir -p $dev/bin
|
||||
cp bin/clang-tblgen $dev/bin
|
||||
cp bin/{clang-tblgen,clang-tidy-confusable-chars-gen,clang-pseudo-gen} $dev/bin
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
|
@ -36,9 +36,14 @@ let
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
||||
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
|
||||
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
|
||||
"-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
|
||||
# Added in LLVM15:
|
||||
# `clang-tidy-confusable-chars-gen`: https://github.com/llvm/llvm-project/commit/c3574ef739fbfcc59d405985a3a4fa6f4619ecdb
|
||||
# `clang-pseudo-gen`: https://github.com/llvm/llvm-project/commit/cd2292ef824591cc34cc299910a3098545c840c7
|
||||
"-DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${buildLlvmTools.libclang.dev}/bin/clang-tidy-confusable-chars-gen"
|
||||
"-DCLANG_PSEUDO_GEN=${buildLlvmTools.libclang.dev}/bin/clang-pseudo-gen"
|
||||
];
|
||||
|
||||
patches = [
|
||||
@ -60,6 +65,12 @@ let
|
||||
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
env = lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) {
|
||||
# The following warning is triggered with (at least) gcc >=
|
||||
# 12, but appears to occur only for cross compiles.
|
||||
NIX_CFLAGS_COMPILE = "-Wno-maybe-uninitialized";
|
||||
};
|
||||
|
||||
postInstall = ''
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
||||
@ -80,7 +91,7 @@ let
|
||||
patchShebangs $python/bin
|
||||
|
||||
mkdir -p $dev/bin
|
||||
cp bin/clang-tblgen $dev/bin
|
||||
cp bin/{clang-tblgen,clang-tidy-confusable-chars-gen,clang-pseudo-gen} $dev/bin
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
|
Loading…
Reference in New Issue
Block a user