2024-07-01 15:47:52 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchFromGitHub,
|
|
|
|
|
|
|
|
docbook_xml_dtd_45,
|
|
|
|
docbook_xsl,
|
|
|
|
installShellFiles,
|
|
|
|
libxslt,
|
|
|
|
pcre,
|
|
|
|
pkg-config,
|
|
|
|
python3,
|
|
|
|
which,
|
2022-07-18 16:21:45 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "cppcheck";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "2.15.0";
|
2023-10-09 19:29:22 +00:00
|
|
|
|
2024-07-01 15:47:52 +00:00
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"man"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "danmar";
|
|
|
|
repo = "cppcheck";
|
2023-08-22 20:05:09 +00:00
|
|
|
rev = finalAttrs.version;
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-6AI3sy4D+YhUOpy02UHJWyhelbqcoEW+Tw/ADCPEbuM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
docbook_xml_dtd_45
|
2023-10-09 19:29:22 +00:00
|
|
|
docbook_xsl
|
2023-08-22 20:05:09 +00:00
|
|
|
installShellFiles
|
|
|
|
libxslt
|
|
|
|
pkg-config
|
|
|
|
python3
|
|
|
|
which
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
pcre
|
|
|
|
(python3.withPackages (ps: [ ps.pygments ]))
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-07-01 15:47:52 +00:00
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=$(out)"
|
|
|
|
"MATCHCOMPILER=yes"
|
|
|
|
"FILESDIR=$(out)/share/cppcheck"
|
|
|
|
"HAVE_RULES=yes"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2023-10-09 19:29:22 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
|
|
|
# test/testcondition.cpp:4949(TestCondition::alwaysTrueContainer): Assertion failed.
|
|
|
|
doCheck = !(stdenv.isLinux && stdenv.isAarch64);
|
|
|
|
doInstallCheck = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
|
|
|
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
|
|
|
'';
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
meta = {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Static analysis tool for C/C++ code";
|
2020-04-24 23:36:52 +00:00
|
|
|
longDescription = ''
|
|
|
|
Check C/C++ code for memory leaks, mismatching allocation-deallocation,
|
|
|
|
buffer overruns and more.
|
|
|
|
'';
|
2024-07-01 15:47:52 +00:00
|
|
|
homepage = "http://cppcheck.sourceforge.net";
|
|
|
|
license = lib.licenses.gpl3Plus;
|
|
|
|
maintainers = with lib.maintainers; [
|
|
|
|
joachifm
|
|
|
|
paveloom
|
|
|
|
];
|
2023-08-22 20:05:09 +00:00
|
|
|
platforms = lib.platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-08-22 20:05:09 +00:00
|
|
|
})
|