2024-06-05 15:53:02 +00:00
|
|
|
{ lib, stdenv, clang, llvmPackages, perl, makeWrapper, python3 }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "clang-analyzer";
|
2020-12-25 13:55:36 +00:00
|
|
|
inherit (llvmPackages.clang-unwrapped) src version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
patches = [ ./0001-Fix-scan-build-to-use-NIX_CFLAGS_COMPILE.patch ];
|
2020-12-25 13:55:36 +00:00
|
|
|
buildInputs = [ clang llvmPackages.clang perl python3 ];
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
2020-12-25 13:55:36 +00:00
|
|
|
mkdir -p $out/share/scan-view $out/bin
|
2021-12-06 16:07:01 +00:00
|
|
|
cp -R clang/tools/scan-view/share/* $out/share/scan-view
|
|
|
|
cp -R clang/tools/scan-view/bin/* $out/bin/scan-view
|
|
|
|
cp -R clang/tools/scan-build/* $out
|
2020-12-25 13:55:36 +00:00
|
|
|
|
|
|
|
rm $out/bin/*.bat $out/libexec/*.bat $out/CMakeLists.txt
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
wrapProgram $out/bin/scan-build \
|
2020-04-24 23:36:52 +00:00
|
|
|
--add-flags "--use-cc=${clang}/bin/clang" \
|
|
|
|
--add-flags "--use-c++=${clang}/bin/clang++" \
|
|
|
|
--add-flags "--use-analyzer='${llvmPackages.clang}/bin/clang'"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Clang Static Analyzer";
|
2021-12-06 16:07:01 +00:00
|
|
|
longDescription = ''
|
|
|
|
The Clang Static Analyzer is a source code analysis tool that finds bugs
|
|
|
|
in C, C++, and Objective-C programs.
|
|
|
|
'';
|
|
|
|
homepage = "https://clang-analyzer.llvm.org/";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
platforms = lib.platforms.unix;
|
|
|
|
maintainers = [ lib.maintainers.thoughtpolice ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|