2018-09-26 19:38:28 +01:00
|
|
|
{ stdenv, fetchurl, cmake, llvmPackages, python2 }:
|
2015-02-10 23:14:15 +00:00
|
|
|
|
2015-12-20 02:22:24 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "include-what-you-use";
|
2016-01-24 19:31:44 +00:00
|
|
|
# Also bump llvmPackages in all-packages.nix to the supported version!
|
2019-11-02 06:16:50 +00:00
|
|
|
version = "0.13";
|
2015-02-10 23:14:15 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-11-02 06:16:50 +00:00
|
|
|
sha256 = "1jav4qf7d303by9iy6v08w73wfwzj76i54inh90w1s34m9q44aa9";
|
2019-08-15 13:41:18 +01:00
|
|
|
url = "${meta.homepage}/downloads/${pname}-${version}.src.tar.gz";
|
2015-02-10 23:14:15 +00:00
|
|
|
};
|
|
|
|
|
2018-09-26 19:38:28 +01:00
|
|
|
buildInputs = with llvmPackages; [ clang-unwrapped llvm python2 ];
|
2015-11-26 17:44:44 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
|
|
|
cmakeFlags = [ "-DIWYU_LLVM_ROOT_PATH=${llvmPackages.clang-unwrapped}" ];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2018-09-26 19:38:28 +01:00
|
|
|
postInstall = ''
|
|
|
|
substituteInPlace $out/bin/iwyu_tool.py \
|
2019-08-29 06:31:57 +01:00
|
|
|
--replace "'include-what-you-use'" "'$out/bin/include-what-you-use'"
|
2018-09-26 19:38:28 +01:00
|
|
|
'';
|
|
|
|
|
2015-02-10 23:14:15 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Analyze #includes in C/C++ source files with clang";
|
|
|
|
longDescription = ''
|
|
|
|
For every symbol (type, function variable, or macro) that you use in
|
|
|
|
foo.cc, either foo.cc or foo.h should #include a .h file that exports the
|
2015-03-25 23:25:09 +00:00
|
|
|
declaration of that symbol. The main goal of include-what-you-use is to
|
|
|
|
remove superfluous #includes, both by figuring out what #includes are not
|
|
|
|
actually needed for this file (for both .cc and .h files), and by
|
2015-02-10 23:14:15 +00:00
|
|
|
replacing #includes with forward-declares when possible.
|
|
|
|
'';
|
2018-05-01 04:03:23 +01:00
|
|
|
homepage = https://include-what-you-use.org;
|
2015-05-28 18:20:29 +01:00
|
|
|
license = licenses.bsd3;
|
2018-03-09 22:03:03 +00:00
|
|
|
platforms = platforms.unix;
|
2015-02-10 23:14:15 +00:00
|
|
|
};
|
|
|
|
}
|