Skip to content

Commit 10a4dec

Browse files
authored
llvmPackages: clean up rebuild avoidance (#447071)
2 parents 25f2aaa + 957d7fe commit 10a4dec

8 files changed

Lines changed: 21 additions & 69 deletions

File tree

pkgs/development/compilers/llvm/common/clang/default.nix

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -95,37 +95,28 @@ stdenv.mkDerivation (
9595
(lib.cmakeFeature "CLANG_INSTALL_PACKAGE_DIR" "${placeholder "dev"}/lib/cmake/clang")
9696
(lib.cmakeBool "CLANGD_BUILD_XPC" false)
9797
(lib.cmakeBool "LLVM_ENABLE_RTTI" true)
98+
(lib.cmakeBool "LLVM_INCLUDE_TESTS" false)
9899
(lib.cmakeFeature "LLVM_TABLEGEN_EXE" "${buildLlvmTools.tblgen}/bin/llvm-tblgen")
99100
(lib.cmakeFeature "CLANG_TABLEGEN" "${buildLlvmTools.tblgen}/bin/clang-tblgen")
101+
(lib.cmakeFeature "CLANG_TIDY_CONFUSABLE_CHARS_GEN" "${buildLlvmTools.tblgen}/bin/clang-tidy-confusable-chars-gen")
100102
]
103+
++ lib.optional (lib.versionAtLeast release_version "20") (
104+
lib.cmakeFeature "LLVM_DIR" "${libllvm.dev}/lib/cmake/llvm"
105+
)
101106
++ lib.optionals (lib.versionAtLeast release_version "21") [
102107
(lib.cmakeFeature "CLANG_RESOURCE_DIR" "${placeholder "lib"}/lib/clang/${lib.versions.major release_version}")
103108
]
104-
# TODO: Clean up on `staging`.
105-
++ [
106-
(lib.cmakeBool "LLVM_INCLUDE_TESTS" false)
107-
]
108109
++ lib.optionals enableManpages [
109110
(lib.cmakeBool "CLANG_INCLUDE_DOCS" true)
110111
(lib.cmakeBool "LLVM_ENABLE_SPHINX" true)
111112
(lib.cmakeBool "SPHINX_OUTPUT_MAN" true)
112113
(lib.cmakeBool "SPHINX_OUTPUT_HTML" false)
113114
(lib.cmakeBool "SPHINX_WARNINGS_AS_ERRORS" false)
114115
]
115-
# TODO: Clean up on `staging`.
116-
++ [
117-
# Added in LLVM15:
118-
# `clang-tidy-confusable-chars-gen`: https://github.com/llvm/llvm-project/commit/c3574ef739fbfcc59d405985a3a4fa6f4619ecdb
119-
# `clang-pseudo-gen`: https://github.com/llvm/llvm-project/commit/cd2292ef824591cc34cc299910a3098545c840c7
120-
(lib.cmakeFeature "CLANG_TIDY_CONFUSABLE_CHARS_GEN" "${buildLlvmTools.tblgen}/bin/clang-tidy-confusable-chars-gen")
121-
]
122116
++ lib.optionals (lib.versionOlder release_version "20") [
123117
# clang-pseudo removed in LLVM20: https://github.com/llvm/llvm-project/commit/ed8f78827895050442f544edef2933a60d4a7935
124118
(lib.cmakeFeature "CLANG_PSEUDO_GEN" "${buildLlvmTools.tblgen}/bin/clang-pseudo-gen")
125119
]
126-
++ lib.optional (lib.versionAtLeast release_version "20") (
127-
lib.cmakeFeature "LLVM_DIR" "${libllvm.dev}/lib/cmake/llvm"
128-
)
129120
++ devExtraCmakeFlags;
130121

131122
postPatch = ''
@@ -173,20 +164,13 @@ stdenv.mkDerivation (
173164
patchShebangs $python/bin
174165
175166
mkdir -p $dev/bin
176-
''
177-
# TODO(@LunNova): Clean up this rebuild avoidance in staging
178-
+ lib.optionalString enableClangToolsExtra (
179-
if lib.versionOlder release_version "20" then
180-
''
181-
cp bin/{clang-tblgen,clang-tidy-confusable-chars-gen,clang-pseudo-gen} $dev/bin
182-
''
183-
else
184-
''
185-
cp bin/{clang-tblgen,clang-tidy-confusable-chars-gen} $dev/bin
186-
''
187-
)
188-
+ lib.optionalString (!enableClangToolsExtra) ''
189167
cp bin/clang-tblgen $dev/bin
168+
''
169+
+ lib.optionalString enableClangToolsExtra ''
170+
cp bin/clang-tidy-confusable-chars-gen $dev/bin
171+
''
172+
+ lib.optionalString (enableClangToolsExtra && lib.versionOlder release_version "20") ''
173+
cp bin/clang-pseudo-gen $dev/bin
190174
'';
191175

192176
env =

pkgs/development/compilers/llvm/common/default.nix

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -374,18 +374,14 @@ let
374374

375375
# This is an "oddly ordered" bootstrap just for Darwin. Probably
376376
# don't want it otherwise.
377-
clangNoCompilerRtWithLibc =
378-
wrapCCWith rec {
379-
cc = tools.clang-unwrapped;
380-
libcxx = null;
381-
bintools = bintools';
382-
extraPackages = [ ];
383-
extraBuildCommands = mkExtraBuildCommands0 cc;
384-
}
385-
# FIXME: This should be inside the `wrapCCWith` call.
386-
// lib.optionalAttrs stdenv.targetPlatform.isWasm {
387-
nixSupport.cc-cflags = [ "-fno-exceptions" ];
388-
};
377+
clangNoCompilerRtWithLibc = wrapCCWith rec {
378+
cc = tools.clang-unwrapped;
379+
libcxx = null;
380+
bintools = bintools';
381+
extraPackages = [ ];
382+
extraBuildCommands = mkExtraBuildCommands0 cc;
383+
nixSupport.cc-cflags = lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
384+
};
389385

390386
# Aliases
391387
clangNoCompilerRt = tools.clangNoLibcNoRt;

pkgs/development/compilers/llvm/common/libcxx/default.nix

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ stdenv.mkDerivation (finalAttrs: {
143143
patchShebangs utils/cat_files.py
144144
'';
145145

146-
# TODO: Remove on `staging`.
147-
patches = [ ];
148-
149146
nativeBuildInputs = [
150147
cmake
151148
ninja

pkgs/development/compilers/llvm/common/libunwind/default.nix

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ stdenv.mkDerivation (finalAttrs: {
2121

2222
inherit version;
2323

24-
# TODO: Remove on `staging`.
25-
patches = [ ];
26-
2724
src =
2825
if monorepoSrc != null then
2926
runCommand "libunwind-src-${version}" { inherit (monorepoSrc) passthru; } ''
@@ -60,10 +57,6 @@ stdenv.mkDerivation (finalAttrs: {
6057
]
6158
++ devExtraCmakeFlags;
6259

63-
# TODO: Remove on `staging`.
64-
prePatch = "";
65-
postPatch = "";
66-
6760
postInstall =
6861
lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isWindows)
6962
''

pkgs/development/compilers/llvm/common/lld/default.nix

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ stdenv.mkDerivation (finalAttrs: {
6363
]
6464
++ devExtraCmakeFlags;
6565

66-
# TODO: Remove on `staging`.
67-
postPatch = "";
68-
6966
# Musl's default stack size is too small for lld to be able to link Firefox.
7067
LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-Wl,-z,stack-size=2097152";
7168

pkgs/development/compilers/llvm/common/lldb/default.nix

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ stdenv.mkDerivation (
7474

7575
nativeBuildInputs = [
7676
cmake
77+
ninja
7778
python3
7879
which
7980
swig
@@ -84,10 +85,6 @@ stdenv.mkDerivation (
8485
++ lib.optionals enableManpages [
8586
python3.pkgs.sphinx
8687
python3.pkgs.myst-parser
87-
]
88-
# TODO: Clean up on `staging`.
89-
++ [
90-
ninja
9188
];
9289

9390
buildInputs = [
@@ -112,17 +109,14 @@ stdenv.mkDerivation (
112109
(lib.cmakeBool "LLVM_ENABLE_RTTI" false)
113110
(lib.cmakeFeature "Clang_DIR" "${lib.getDev libclang}/lib/cmake")
114111
(lib.cmakeFeature "LLVM_EXTERNAL_LIT" "${lit}/bin/lit")
112+
(lib.cmakeFeature "CLANG_RESOURCE_DIR" "../../../../${lib.getLib libclang}")
115113
]
116114
++ lib.optionals stdenv.hostPlatform.isDarwin [
117115
(lib.cmakeBool "LLDB_USE_SYSTEM_DEBUGSERVER" true)
118116
]
119117
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
120118
(lib.cmakeFeature "LLDB_CODESIGN_IDENTITY" "") # codesigning makes nondeterministic
121119
]
122-
# TODO: Clean up on `staging`.
123-
++ [
124-
(lib.cmakeFeature "CLANG_RESOURCE_DIR" "../../../../${lib.getLib libclang}")
125-
]
126120
++ lib.optionals enableManpages [
127121
(lib.cmakeBool "LLVM_ENABLE_SPHINX" true)
128122
(lib.cmakeBool "SPHINX_OUTPUT_MAN" true)
@@ -184,9 +178,6 @@ stdenv.mkDerivation (
184178
// lib.optionalAttrs enableManpages {
185179
pname = "lldb-manpages";
186180

187-
# TODO: Remove on `staging`.
188-
buildPhase = "";
189-
190181
ninjaFlags = [ "docs-lldb-man" ];
191182

192183
propagatedBuildInputs = [ ];

pkgs/development/compilers/llvm/common/llvm/default.nix

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ stdenv.mkDerivation (
8585
pname = "llvm";
8686
inherit version;
8787

88-
# TODO: Remove on `staging`.
89-
shortVersion = lib.concatStringsSep "." (lib.take 1 (lib.splitString "." release_version));
90-
9188
src =
9289
if monorepoSrc != null then
9390
runCommand "llvm-src-${version}" { inherit (monorepoSrc) passthru; } (

pkgs/development/compilers/llvm/common/openmp/default.nix

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ stdenv.mkDerivation (finalAttrs: {
4646
"dev"
4747
];
4848

49-
# TODO: Remove on `staging`.
50-
patchFlags = null;
51-
5249
patches =
5350
lib.optional (lib.versionOlder release_version "19") (getVersionFile "openmp/fix-find-tool.patch")
5451
++ [

0 commit comments

Comments
 (0)