1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# Recipe for building cppcheck at specific revision
#
# SPDX-FileCopyrightText: 2012, 2014, 2016 Peter Simons
# SPDX-FileCopyrightText: 2013 Bjørn Forsman
# SPDX-FileCopyrightText: 2014 Linquize
# SPDX-FileCopyrightText: 2014 Moritz Ulrich
# SPDX-FileCopyrightText: 2014 Pascal Wittmann
# SPDX-FileCopyrightText: 2014 Peter Simons
# SPDX-FileCopyrightText: 2015-2017 Joachim Fasting
# SPDX-FileCopyrightText: 2015 koral
# SPDX-FileCopyrightText: 2016 Nikolay Amiantov
# SPDX-FileCopyrightText: 2017 Guillaume Maudoux
# SPDX-FileCopyrightText: 2018 Ignat Loskutov
# SPDX-License-Identifier: MIT
#
# SPDX-FileCopyrightText: 2023 Nguyễn Gia Phong
# SPDX-License-Identifier: AGPL-3.0-or-later
{ lib, stdenv, fetchFromGitHub, fetchpatch, version, commit, hash
, bcExtractHook, binRenameHook
, docbook_xsl, docbook_xml_dtd_45, libxslt
, python3, which, pcre }:
stdenv.mkDerivation rec {
pname = "cppcheck";
inherit version;
src = fetchFromGitHub {
owner = "danmar";
repo = pname;
rev = commit;
inherit hash;
};
patches = [
(fetchpatch {
name = "glibc-2.34-compat.patch";
url = "https://github.com/danmar/cppcheck/commit/8869ee3554f19ce63892891a697378d8b745414b.patch";
hash = "sha256-K9+/2VIb5OFz+es8ZrprCBx8nkKZZycagw6ripWavPw=";
})
];
# strictDeps = true;
nativeBuildInputs = [
bcExtractHook binRenameHook
docbook_xsl docbook_xml_dtd_45 libxslt
python3 which
];
buildInputs = [ pcre ];
makeFlags = [
"PREFIX=$(out)"
"MATCHCOMPILER=yes"
"FILESDIR=$(out)/cfg"
"HAVE_RULES=yes"
];
enableParallelBuilding = true;
outputs = [ "out" "man" ];
postInstall = ''
make DB2MAN=${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl man
mkdir -p $man/share/man/man1
cp cppcheck.1 $man/share/man/man1/cppcheck.1
'';
meta = with lib; {
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 = "https://cppcheck.sourceforge.net";
license = licenses.gpl3Plus;
platforms = platforms.unix;
};
}
|