# 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; }; }