nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, fetchFromGitHub, libxslt, docbook_xsl, docbook_xml_dtd_45, pcre, withZ3 ? true, z3, python3 }:
2
3stdenv.mkDerivation rec {
4 pname = "cppcheck";
5 version = "2.7.5";
6
7 src = fetchFromGitHub {
8 owner = "danmar";
9 repo = "cppcheck";
10 rev = version;
11 sha256 = "sha256-GRhQXGldirIhUBI4CucDTTxuZhG0XW0qp1FjYXhVS0o=";
12 };
13
14 buildInputs = [ pcre
15 (python3.withPackages (ps: [ps.pygments]))
16 ] ++ lib.optionals withZ3 [ z3 ];
17 nativeBuildInputs = [ libxslt docbook_xsl docbook_xml_dtd_45 ];
18
19 makeFlags = [ "PREFIX=$(out)" "FILESDIR=$(out)/cfg" "HAVE_RULES=yes" ]
20 ++ lib.optionals withZ3 [ "USE_Z3=yes" "CPPFLAGS=-DNEW_Z3=1" ];
21
22 outputs = [ "out" "man" ];
23
24 enableParallelBuilding = true;
25
26 doCheck = true;
27
28 postInstall = ''
29 make DB2MAN=${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl man
30 mkdir -p $man/share/man/man1
31 cp cppcheck.1 $man/share/man/man1/cppcheck.1
32 '';
33
34 meta = with lib; {
35 description = "A static analysis tool for C/C++ code";
36 longDescription = ''
37 Check C/C++ code for memory leaks, mismatching allocation-deallocation,
38 buffer overruns and more.
39 '';
40 homepage = "http://cppcheck.sourceforge.net/";
41 license = licenses.gpl3Plus;
42 platforms = platforms.unix;
43 maintainers = with maintainers; [ joachifm ];
44 };
45}