clang-tools: New package

Creates and installs wrapper scripts around the clang-tools from
`llvmPackages.clang-unwrapped`.

Motivation
----------

Fixes #9214

Allows to install clang-tools for C++ development without also installing the
clang compiler and its tool-chain. This way it is possible to use e.g.
`clang-format` without conflicting with e.g. GCC's tool-chain, or the global
system tool-chain.
This commit is contained in:
Andreas Herrmann 2016-09-27 23:55:26 +02:00
parent 124f25bc7d
commit 4a3e6d3091
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,28 @@
{ stdenv, makeWrapper, writeScript, llvmPackages }:
let
clang = llvmPackages.clang-unwrapped;
version = stdenv.lib.getVersion clang;
in
stdenv.mkDerivation {
name = "clang-tools-${version}";
builder = writeScript "builder" ''
source $stdenv/setup
for tool in \
clang-apply-replacements \
clang-check \
clang-format \
clang-rename \
clang-tidy
do
makeWrapper $clang/bin/$tool $out/bin/$tool --argv0 $tool
done
'';
buildInputs = [ makeWrapper ];
inherit clang;
meta = clang.meta // {
description = "Standalone command line tools for C++ development";
maintainers = with stdenv.lib.maintainers; [ aherrmann ];
};
}

View File

@ -4424,6 +4424,8 @@ in
clang_35 = wrapCC llvmPackages_35.clang;
clang_34 = wrapCC llvmPackages_34.clang;
clang-tools = callPackage ../development/tools/clang-tools { };
clang-analyzer = callPackage ../development/tools/analysis/clang-analyzer { };
clangUnwrapped = llvm: pkg: callPackage pkg { inherit llvm; };