mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-20 11:11:43 -04:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
98 lines
1.9 KiB
Nix
98 lines
1.9 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitHub,
|
|
|
|
docbook_xml_dtd_45,
|
|
docbook_xsl,
|
|
installShellFiles,
|
|
libxslt,
|
|
pcre,
|
|
pkg-config,
|
|
python3,
|
|
which,
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "cppcheck";
|
|
version = "2.15.0";
|
|
|
|
outputs = [
|
|
"out"
|
|
"man"
|
|
];
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "danmar";
|
|
repo = "cppcheck";
|
|
rev = finalAttrs.version;
|
|
hash = "sha256-6AI3sy4D+YhUOpy02UHJWyhelbqcoEW+Tw/ADCPEbuM=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
docbook_xml_dtd_45
|
|
docbook_xsl
|
|
installShellFiles
|
|
libxslt
|
|
pkg-config
|
|
python3
|
|
which
|
|
];
|
|
|
|
buildInputs = [
|
|
pcre
|
|
(python3.withPackages (ps: [ ps.pygments ]))
|
|
];
|
|
|
|
makeFlags = [
|
|
"PREFIX=$(out)"
|
|
"MATCHCOMPILER=yes"
|
|
"FILESDIR=$(out)/share/cppcheck"
|
|
"HAVE_RULES=yes"
|
|
];
|
|
|
|
enableParallelBuilding = true;
|
|
strictDeps = true;
|
|
|
|
# test/testcondition.cpp:4949(TestCondition::alwaysTrueContainer): Assertion failed.
|
|
doCheck = !(stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64);
|
|
doInstallCheck = true;
|
|
|
|
postPatch = ''
|
|
substituteInPlace Makefile \
|
|
--replace 'PCRE_CONFIG = $(shell which pcre-config)' 'PCRE_CONFIG = $(PKG_CONFIG) libpcre'
|
|
'';
|
|
|
|
postBuild = ''
|
|
make DB2MAN=${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl man
|
|
'';
|
|
|
|
postInstall = ''
|
|
installManPage cppcheck.1
|
|
'';
|
|
|
|
installCheckPhase = ''
|
|
runHook preInstallCheck
|
|
|
|
echo 'int main() {}' > ./installcheck.cpp
|
|
$out/bin/cppcheck ./installcheck.cpp > /dev/null
|
|
|
|
runHook postInstallCheck
|
|
'';
|
|
|
|
meta = {
|
|
description = "Static analysis tool for C/C++ code";
|
|
longDescription = ''
|
|
Check C/C++ code for memory leaks, mismatching allocation-deallocation,
|
|
buffer overruns and more.
|
|
'';
|
|
homepage = "http://cppcheck.sourceforge.net";
|
|
license = lib.licenses.gpl3Plus;
|
|
maintainers = with lib.maintainers; [
|
|
joachifm
|
|
paveloom
|
|
];
|
|
platforms = lib.platforms.unix;
|
|
};
|
|
})
|