about summary refs log tree commit diff
path: root/cppcheck
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2023-08-30 11:31:40 +0900
committerNguyễn Gia Phong <cnx@loang.net>2023-08-30 14:47:34 +0900
commitbb25f70192a3276f2cca2913e9012d2c56393bd6 (patch)
tree356a76368c9547256ffa9fc0d8118bf6dd5d8379 /cppcheck
parenteb04d8c8cb4521bf611b8df46a96c4132af2520b (diff)
downloadbux-bb25f70192a3276f2cca2913e9012d2c56393bd6.tar.gz
Add md4c bug 107
References: https://github.com/mity/md4c/issues/107
Diffstat (limited to 'cppcheck')
-rw-r--r--cppcheck/default.nix74
1 files changed, 74 insertions, 0 deletions
diff --git a/cppcheck/default.nix b/cppcheck/default.nix
new file mode 100644
index 0000000..60991a7
--- /dev/null
+++ b/cppcheck/default.nix
@@ -0,0 +1,74 @@
+# 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, 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 = [
+    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;
+  };
+}