2022-07-18 16:21:45 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2023-02-22 10:55:15 +00:00
|
|
|
, installShellFiles
|
2022-07-18 16:21:45 +00:00
|
|
|
, pcre
|
|
|
|
, python3
|
|
|
|
, libxslt
|
|
|
|
, docbook_xsl
|
|
|
|
, docbook_xml_dtd_45
|
|
|
|
, which
|
2023-03-27 19:17:25 +00:00
|
|
|
, pkg-config
|
2022-07-18 16:21:45 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "cppcheck";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "2.11";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "danmar";
|
|
|
|
repo = "cppcheck";
|
|
|
|
rev = version;
|
2023-07-15 17:15:38 +00:00
|
|
|
hash = "sha256-Zu1Ly5KsgmjtsVQlBzgB/h+varfkyB73t8bxzqB3a3M=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-03-27 19:17:25 +00:00
|
|
|
strictDeps = true;
|
|
|
|
nativeBuildInputs = [ pkg-config installShellFiles libxslt docbook_xsl docbook_xml_dtd_45 which python3 ];
|
2023-02-22 10:55:15 +00:00
|
|
|
buildInputs = [ pcre (python3.withPackages (ps: [ps.pygments])) ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
makeFlags = [ "PREFIX=$(out)" "MATCHCOMPILER=yes" "FILESDIR=$(out)/share/cppcheck" "HAVE_RULES=yes" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2023-03-27 19:17:25 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace 'PCRE_CONFIG = $(shell which pcre-config)' 'PCRE_CONFIG = $(PKG_CONFIG) libpcre'
|
|
|
|
'';
|
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
postBuild = ''
|
|
|
|
make DB2MAN=${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl man
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postInstall = ''
|
2023-02-22 10:55:15 +00:00
|
|
|
installManPage cppcheck.1
|
|
|
|
'';
|
|
|
|
|
2023-03-27 19:17:25 +00:00
|
|
|
# test/testcondition.cpp:4949(TestCondition::alwaysTrueContainer): Assertion failed.
|
|
|
|
doCheck = !(stdenv.isLinux && stdenv.isAarch64);
|
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
|
|
|
|
echo 'int main() {}' > ./installcheck.cpp
|
|
|
|
$out/bin/cppcheck ./installcheck.cpp > /dev/null
|
|
|
|
|
|
|
|
runHook postInstallCheck
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A static analysis tool for C/C++ code";
|
|
|
|
longDescription = ''
|
|
|
|
Check C/C++ code for memory leaks, mismatching allocation-deallocation,
|
|
|
|
buffer overruns and more.
|
|
|
|
'';
|
|
|
|
homepage = "http://cppcheck.sourceforge.net/";
|
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ joachifm ];
|
|
|
|
};
|
|
|
|
}
|