Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 41 lines 1.5 kB view raw
1{ lib, stdenv, fetchurl, cmake, llvmPackages, python3 }: 2 3stdenv.mkDerivation rec { 4 pname = "include-what-you-use"; 5 # Also bump llvmPackages in all-packages.nix to the supported version! 6 version = "0.19"; 7 8 src = fetchurl { 9 url = "${meta.homepage}/downloads/${pname}-${version}.src.tar.gz"; 10 hash = "sha256-KxAVe2DqCK3AjjiWtJIcc/yt1exOtlKymjQSnVAeXuA="; 11 }; 12 13 postPatch = '' 14 patchShebangs . 15 ''; 16 17 nativeBuildInputs = with llvmPackages; [ cmake llvm.dev llvm python3 ]; 18 buildInputs = with llvmPackages; [ libclang clang-unwrapped python3 ]; 19 20 cmakeFlags = [ "-DIWYU_LLVM_ROOT_PATH=${llvmPackages.clang-unwrapped}" ]; 21 22 postInstall = '' 23 substituteInPlace $out/bin/iwyu_tool.py \ 24 --replace "'include-what-you-use'" "'$out/bin/include-what-you-use'" 25 ''; 26 27 meta = with lib; { 28 description = "Analyze #includes in C/C++ source files with clang"; 29 longDescription = '' 30 For every symbol (type, function variable, or macro) that you use in 31 foo.cc, either foo.cc or foo.h should #include a .h file that exports the 32 declaration of that symbol. The main goal of include-what-you-use is to 33 remove superfluous #includes, both by figuring out what #includes are not 34 actually needed for this file (for both .cc and .h files), and by 35 replacing #includes with forward-declares when possible. 36 ''; 37 homepage = "https://include-what-you-use.org"; 38 license = licenses.bsd3; 39 platforms = platforms.unix; 40 }; 41}