at 24.11-pre 1.9 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4 5, docbook_xml_dtd_45 6, docbook_xsl 7, installShellFiles 8, libxslt 9, pcre 10, pkg-config 11, python3 12, which 13}: 14 15stdenv.mkDerivation (finalAttrs: { 16 pname = "cppcheck"; 17 version = "2.14.0"; 18 19 outputs = [ "out" "man" ]; 20 21 src = fetchFromGitHub { 22 owner = "danmar"; 23 repo = "cppcheck"; 24 rev = finalAttrs.version; 25 hash = "sha256-w5k7WO2Kwx0ac/vP54ndPUp/AG6jG3MDf03h5z/+Cso="; 26 }; 27 28 nativeBuildInputs = [ 29 docbook_xml_dtd_45 30 docbook_xsl 31 installShellFiles 32 libxslt 33 pkg-config 34 python3 35 which 36 ]; 37 38 buildInputs = [ 39 pcre 40 (python3.withPackages (ps: [ ps.pygments ])) 41 ]; 42 43 makeFlags = [ "PREFIX=$(out)" "MATCHCOMPILER=yes" "FILESDIR=$(out)/share/cppcheck" "HAVE_RULES=yes" ]; 44 45 enableParallelBuilding = true; 46 strictDeps = true; 47 48 # test/testcondition.cpp:4949(TestCondition::alwaysTrueContainer): Assertion failed. 49 doCheck = !(stdenv.isLinux && stdenv.isAarch64); 50 doInstallCheck = true; 51 52 postPatch = '' 53 substituteInPlace Makefile \ 54 --replace 'PCRE_CONFIG = $(shell which pcre-config)' 'PCRE_CONFIG = $(PKG_CONFIG) libpcre' 55 ''; 56 57 postBuild = '' 58 make DB2MAN=${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl man 59 ''; 60 61 postInstall = '' 62 installManPage cppcheck.1 63 ''; 64 65 installCheckPhase = '' 66 runHook preInstallCheck 67 68 echo 'int main() {}' > ./installcheck.cpp 69 $out/bin/cppcheck ./installcheck.cpp > /dev/null 70 71 runHook postInstallCheck 72 ''; 73 74 meta = { 75 description = "A static analysis tool for C/C++ code"; 76 homepage = "http://cppcheck.sourceforge.net"; 77 license = lib.licenses.gpl3Plus; 78 longDescription = '' 79 Check C/C++ code for memory leaks, mismatching allocation-deallocation, 80 buffer overruns and more. 81 ''; 82 maintainers = with lib.maintainers; [ joachifm paveloom ]; 83 platforms = lib.platforms.unix; 84 }; 85})