cppcheck: use recommended build options

From the readme:

> The recommended release build is:
>     make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes
>
> Flags:
> MATCHCOMPILER=yes               : Python is used to optimise cppcheck at compile time
> FILESDIR=/usr/share/cppcheck    : Specify folder where cppcheck files are installed
> HAVE_RULES=yes                  : Enable rules (pcre is required if this is used)

This adds MATCHCOMPILER and fixes the location of FILESDIR into a
standard directory instead of that ugly '$out/cfg' directory.

The Makefile needs 'which' to locate Python.
This commit is contained in:
Sebastián Mancilla 2022-07-16 12:33:32 -04:00 committed by Bjørn Forsman
parent ec5eb91c8d
commit 47f0f32de5

View file

@ -1,4 +1,15 @@
{ lib, stdenv, fetchFromGitHub, libxslt, docbook_xsl, docbook_xml_dtd_45, pcre, withZ3 ? true, z3, python3 }:
{ lib
, stdenv
, fetchFromGitHub
, pcre
, python3
, libxslt
, docbook_xsl
, docbook_xml_dtd_45
, withZ3 ? true
, z3
, which
}:
stdenv.mkDerivation rec {
pname = "cppcheck";
@ -14,9 +25,9 @@ stdenv.mkDerivation rec {
buildInputs = [ pcre
(python3.withPackages (ps: [ps.pygments]))
] ++ lib.optionals withZ3 [ z3 ];
nativeBuildInputs = [ libxslt docbook_xsl docbook_xml_dtd_45 ];
nativeBuildInputs = [ libxslt docbook_xsl docbook_xml_dtd_45 which ];
makeFlags = [ "PREFIX=$(out)" "FILESDIR=$(out)/cfg" "HAVE_RULES=yes" ]
makeFlags = [ "PREFIX=$(out)" "MATCHCOMPILER=yes" "FILESDIR=$(out)/share/cppcheck" "HAVE_RULES=yes" ]
++ lib.optionals withZ3 [ "USE_Z3=yes" "CPPFLAGS=-DNEW_Z3=1" ];
outputs = [ "out" "man" ];