2021-05-07 14:50:19 -07:00
|
|
|
{ lib, stdenv, fetchurl, cmake, llvmPackages, python3 }:
|
2015-02-11 00:14:15 +01:00
|
|
|
|
2015-12-20 03:22:24 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "include-what-you-use";
|
2016-01-24 20:31:44 +01:00
|
|
|
# Also bump llvmPackages in all-packages.nix to the supported version!
|
2020-07-06 22:31:08 +02:00
|
|
|
version = "0.14";
|
2015-02-11 00:14:15 +01:00
|
|
|
|
|
|
|
|
src = fetchurl {
|
2020-07-06 22:31:08 +02:00
|
|
|
sha256 = "1vq0c8jqspvlss8hbazml44fi0mbslgnp2i9wcr0qrjpvfbl6623";
|
2019-08-15 12:41:18 +00:00
|
|
|
url = "${meta.homepage}/downloads/${pname}-${version}.src.tar.gz";
|
2015-02-11 00:14:15 +01:00
|
|
|
};
|
|
|
|
|
|
2021-05-07 14:50:19 -07:00
|
|
|
nativeBuildInputs = with llvmPackages; [ cmake llvm.dev llvm clang-unwrapped python3];
|
|
|
|
|
buildInputs = [ llvmPackages.libclang ];
|
2015-11-26 18:44:44 +01:00
|
|
|
|
|
|
|
|
cmakeFlags = [ "-DIWYU_LLVM_ROOT_PATH=${llvmPackages.clang-unwrapped}" ];
|
|
|
|
|
|
2018-09-26 20:38:28 +02:00
|
|
|
postInstall = ''
|
|
|
|
|
substituteInPlace $out/bin/iwyu_tool.py \
|
2019-08-28 22:31:57 -07:00
|
|
|
--replace "'include-what-you-use'" "'$out/bin/include-what-you-use'"
|
2018-09-26 20:38:28 +02:00
|
|
|
'';
|
|
|
|
|
|
2021-01-23 19:26:19 +07:00
|
|
|
meta = with lib; {
|
2015-02-11 00:14:15 +01:00
|
|
|
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-26 00:25:09 +01: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-11 00:14:15 +01:00
|
|
|
replacing #includes with forward-declares when possible.
|
|
|
|
|
'';
|
2020-03-31 21:11:51 -04:00
|
|
|
homepage = "https://include-what-you-use.org";
|
2015-05-28 19:20:29 +02:00
|
|
|
license = licenses.bsd3;
|
2018-03-09 17:03:03 -05:00
|
|
|
platforms = platforms.unix;
|
2015-02-11 00:14:15 +01:00
|
|
|
};
|
|
|
|
|
}
|