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