2024-06-19 19:32:53 +01:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchFromGitHub,
|
|
|
|
|
|
|
|
docbook_xml_dtd_45,
|
|
|
|
docbook_xsl,
|
|
|
|
installShellFiles,
|
|
|
|
libxslt,
|
|
|
|
pcre,
|
|
|
|
pkg-config,
|
|
|
|
python3,
|
|
|
|
which,
|
2022-07-16 17:33:32 +01:00
|
|
|
}:
|
2012-02-15 16:07:45 +00:00
|
|
|
|
2023-08-12 10:07:54 +01:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2016-07-17 10:52:13 +01:00
|
|
|
pname = "cppcheck";
|
2024-06-19 19:40:22 +01:00
|
|
|
version = "2.14.2";
|
2012-02-15 16:07:45 +00:00
|
|
|
|
2024-06-19 19:32:53 +01:00
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"man"
|
|
|
|
];
|
2023-09-11 15:59:50 +01:00
|
|
|
|
2022-03-23 09:38:45 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "danmar";
|
|
|
|
repo = "cppcheck";
|
2023-08-12 10:07:54 +01:00
|
|
|
rev = finalAttrs.version;
|
2024-06-19 19:40:22 +01:00
|
|
|
hash = "sha256-aVjQqwsTw6TCLxs2oQif3hX5kfXHua7ekBpO/PyneAQ=";
|
2012-02-15 16:07:45 +00:00
|
|
|
};
|
|
|
|
|
2023-08-12 10:08:35 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
docbook_xml_dtd_45
|
2023-09-11 15:59:50 +01:00
|
|
|
docbook_xsl
|
2023-08-12 10:08:35 +01:00
|
|
|
installShellFiles
|
|
|
|
libxslt
|
|
|
|
pkg-config
|
|
|
|
python3
|
|
|
|
which
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
pcre
|
|
|
|
(python3.withPackages (ps: [ ps.pygments ]))
|
|
|
|
];
|
2014-05-08 13:27:48 +01:00
|
|
|
|
2024-06-19 19:32:53 +01:00
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=$(out)"
|
|
|
|
"MATCHCOMPILER=yes"
|
|
|
|
"FILESDIR=$(out)/share/cppcheck"
|
|
|
|
"HAVE_RULES=yes"
|
|
|
|
];
|
2015-05-02 23:22:23 +01:00
|
|
|
|
2016-10-21 14:56:20 +01:00
|
|
|
enableParallelBuilding = true;
|
2023-09-11 15:59:50 +01:00
|
|
|
strictDeps = true;
|
|
|
|
|
|
|
|
# test/testcondition.cpp:4949(TestCondition::alwaysTrueContainer): Assertion failed.
|
|
|
|
doCheck = !(stdenv.isLinux && stdenv.isAarch64);
|
|
|
|
doInstallCheck = true;
|
2016-10-21 14:56:20 +01:00
|
|
|
|
2023-03-20 16:48:53 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace 'PCRE_CONFIG = $(shell which pcre-config)' 'PCRE_CONFIG = $(PKG_CONFIG) libpcre'
|
|
|
|
'';
|
|
|
|
|
2023-02-15 21:15:17 +00:00
|
|
|
postBuild = ''
|
|
|
|
make DB2MAN=${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl man
|
|
|
|
'';
|
|
|
|
|
2015-05-02 23:22:23 +01:00
|
|
|
postInstall = ''
|
2023-02-15 21:15:17 +00:00
|
|
|
installManPage cppcheck.1
|
|
|
|
'';
|
|
|
|
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
|
|
|
|
echo 'int main() {}' > ./installcheck.cpp
|
|
|
|
$out/bin/cppcheck ./installcheck.cpp > /dev/null
|
|
|
|
|
|
|
|
runHook postInstallCheck
|
2015-05-02 23:22:23 +01:00
|
|
|
'';
|
2012-02-15 16:07:45 +00:00
|
|
|
|
2023-08-12 10:08:35 +01:00
|
|
|
meta = {
|
2015-05-02 23:22:23 +01:00
|
|
|
description = "Static analysis tool for C/C++ code";
|
|
|
|
longDescription = ''
|
2016-07-17 10:52:13 +01:00
|
|
|
Check C/C++ code for memory leaks, mismatching allocation-deallocation,
|
|
|
|
buffer overruns and more.
|
2015-05-02 23:22:23 +01:00
|
|
|
'';
|
2024-06-19 19:32:53 +01:00
|
|
|
homepage = "http://cppcheck.sourceforge.net";
|
|
|
|
license = lib.licenses.gpl3Plus;
|
|
|
|
maintainers = with lib.maintainers; [
|
|
|
|
joachifm
|
|
|
|
paveloom
|
|
|
|
];
|
2023-08-12 10:08:35 +01:00
|
|
|
platforms = lib.platforms.unix;
|
2012-02-15 16:07:45 +00:00
|
|
|
};
|
2023-08-12 10:07:54 +01:00
|
|
|
})
|