cpptrace: init at 0.6.2

This commit is contained in:
Sergei Zimmerman
2024-06-24 17:09:36 +03:00
parent 69b095e77f
commit 79f4ac2747
2 changed files with 100 additions and 0 deletions
@@ -0,0 +1,39 @@
{
stdenv,
lib,
cmake,
cpptrace,
src,
checkOutput,
}:
stdenv.mkDerivation (finalAttrs: {
name = "cpptrace-findpackage-integration-test";
inherit src;
nativeBuildInputs = [ cmake ];
buildInputs = [ cpptrace ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install main $out/bin
runHook postInstall
'';
doInstallCheck = true;
installCheckPhase = lib.strings.concatLines (
[ "$out/bin/main" ]
# Check that the backtrace contains the path to the executable.
++ lib.optionals (checkOutput) [
''
if [[ !(`$out/bin/main 2>&1` =~ "${finalAttrs.name}") ]]; then
echo "ERROR: $out/bin/main does not output '${finalAttrs.name}'"
exit 1
fi
''
]
);
})
+61
View File
@@ -0,0 +1,61 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
pkg-config,
libdwarf,
gtest,
callPackage,
zstd,
static ? stdenv.hostPlatform.isStatic,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "cpptrace";
version = "0.6.2";
src = fetchFromGitHub {
owner = "jeremy-rifkin";
repo = "cpptrace";
rev = "v${finalAttrs.version}";
hash = "sha256-zjPxPtq+OQ104sJoeBD3jpMV9gV57FSHEJS4W6SF8GM=";
};
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = [ libdwarf ];
propagatedBuildInputs = [ zstd ];
cmakeFlags = [
(lib.cmakeBool "CPPTRACE_USE_EXTERNAL_LIBDWARF" true)
(lib.cmakeBool "CPPTRACE_FIND_LIBDWARF_WITH_PKGCONFIG" true)
(lib.cmakeBool "BUILD_SHARED_LIBS" (!static))
(lib.cmakeBool "BUILD_TESTING" finalAttrs.finalPackage.doCheck)
(lib.cmakeBool "CPPTRACE_USE_EXTERNAL_GTEST" true)
];
checkInputs = [ gtest ];
# Unit tests are flaky and hard to get right.
doCheck = false;
passthru.tests = {
findpackage-integration = callPackage ./findpackage-integration.nix {
src = "${finalAttrs.src}/test/findpackage-integration";
checkOutput = finalAttrs.finalPackage.doCheck;
};
};
meta = {
changelog = "https://github.com/jeremy-rifkin/cpptrace/releases/tag/v${finalAttrs.version}";
description = "Simple, portable, and self-contained stacktrace library for C++11 and newer";
homepage = "https://github.com/jeremy-rifkin/cpptrace";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ xokdvium ];
platforms = lib.platforms.all;
};
})