1 { lib, stdenv, fetchurl, clang, llvmPackages, perl, makeWrapper, python3 }:
3 stdenv.mkDerivation rec {
4 pname = "clang-analyzer";
5 inherit (llvmPackages.clang-unwrapped) src version;
7 patches = [ ./0001-Fix-scan-build-to-use-NIX_CFLAGS_COMPILE.patch ];
8 buildInputs = [ clang llvmPackages.clang perl python3 ];
9 nativeBuildInputs = [ makeWrapper ];
14 mkdir -p $out/share/scan-view $out/bin
15 cp -R clang/tools/scan-view/share/* $out/share/scan-view
16 cp -R clang/tools/scan-view/bin/* $out/bin/scan-view
17 cp -R clang/tools/scan-build/* $out
19 rm $out/bin/*.bat $out/libexec/*.bat $out/CMakeLists.txt
21 wrapProgram $out/bin/scan-build \
22 --add-flags "--use-cc=${clang}/bin/clang" \
23 --add-flags "--use-c++=${clang}/bin/clang++" \
24 --add-flags "--use-analyzer='${llvmPackages.clang}/bin/clang'"
28 description = "Clang Static Analyzer";
30 The Clang Static Analyzer is a source code analysis tool that finds bugs
31 in C, C++, and Objective-C programs.
33 homepage = "https://clang-analyzer.llvm.org/";
34 license = lib.licenses.bsd3;
35 platforms = lib.platforms.unix;
36 maintainers = [ lib.maintainers.thoughtpolice ];