0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 14:10:33 +03:00

llvmPackages_12.clang: use nostdlibinc patch instead of sed command

Seems like the patch we've written for LLVM 13 and above also works for
LLVM 12 which seems a little more robust.

(cherry picked from commit 37437849de)
This commit is contained in:
sternenseemann 2024-10-12 18:36:45 +02:00 committed by github-actions[bot]
parent e33308016c
commit f30f8ee969
2 changed files with 2 additions and 14 deletions

View file

@ -78,17 +78,7 @@ let
substituteInPlace lib/Driver/ToolChains/Darwin.cpp \
--replace-fail 'StringRef P = llvm::sys::path::parent_path(D.Dir);' 'StringRef P = "${lib.getLib libllvm}";'
(cd tools && ln -s ../../clang-tools-extra extra)
'' + lib.optionalString (
lib.versionOlder release_version "13"
# See the comment on the `add-nostdlibinc-flag.patch` patch in
# `../default.nix` for why we skip Darwin here.
&& (!stdenv.hostPlatform.isDarwin || !stdenv.targetPlatform.isDarwin
) ''
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
-e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \
lib/Driver/ToolChains/*.cpp
''
+ lib.optionalString (lib.versionOlder release_version "13") ''
'' + lib.optionalString (lib.versionOlder release_version "13") ''
substituteInPlace tools/extra/clangd/quality/CompletionModel.cmake \
--replace ' ''${CMAKE_SOURCE_DIR}/../clang-tools-extra' ' ''${CMAKE_SOURCE_DIR}/tools/extra'
''

View file

@ -555,9 +555,7 @@ let
# compilers breaking libclang when we can do LinuxtoDarwin
# crosscompilation again.
++ lib.optional (
# TODO: This also applies for clang == 12, do we need it?
lib.versionAtLeast metadata.release_version "13" &&
(!args.stdenv.hostPlatform.isDarwin || !args.stdenv.targetPlatform.isDarwin)
!args.stdenv.hostPlatform.isDarwin || !args.stdenv.targetPlatform.isDarwin
) ./clang/add-nostdlibinc-flag.patch
++ [
(substituteAll {