Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions pkgs/development/compilers/llvm/common/clang/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
buildLlvmTools,
fixDarwinDylibNames,
enableManpages ? false,
enableClangToolsExtra ? true,
devExtraCmakeFlags ? [ ],
replaceVars,
getVersionFile,
fetchpatch,
# for tests
libclang,
}:
stdenv.mkDerivation (
finalAttrs:
Expand All @@ -32,7 +35,7 @@ stdenv.mkDerivation (
mkdir -p "$out"
cp -r ${monorepoSrc}/cmake "$out"
cp -r ${monorepoSrc}/clang "$out"
cp -r ${monorepoSrc}/clang-tools-extra "$out"
${lib.optionalString enableClangToolsExtra "cp -r ${monorepoSrc}/clang-tools-extra \"$out\""}
'')
else
src;
Expand Down Expand Up @@ -171,7 +174,8 @@ stdenv.mkDerivation (

mkdir -p $dev/bin
''
+ (
# TODO(@LunNova): Clean up this rebuild avoidance in staging
+ lib.optionalString enableClangToolsExtra (
if lib.versionOlder release_version "20" then
''
cp bin/{clang-tblgen,clang-tidy-confusable-chars-gen,clang-pseudo-gen} $dev/bin
Expand All @@ -180,7 +184,10 @@ stdenv.mkDerivation (
''
cp bin/{clang-tblgen,clang-tidy-confusable-chars-gen} $dev/bin
''
);
)
+ lib.optionalString (!enableClangToolsExtra) ''
cp bin/clang-tblgen $dev/bin
'';

env =
lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform && !stdenv.hostPlatform.useLLVM)
Expand Down Expand Up @@ -209,6 +216,9 @@ stdenv.mkDerivation (
) "stackclashprotection"
++ lib.optional (!(targetPlatform.isx86_64 || targetPlatform.isAarch64)) "zerocallusedregs"
++ (finalAttrs.passthru.hardeningUnsupportedFlags or [ ]);
tests.withoutOptionalFeatures = libclang.override {
enableClangToolsExtra = false;
};
};

requiredSystemFeatures = [ "big-parallel" ];
Expand Down
Loading