Merge pull request #308951 from Sigmanificient/criterion

criterion: 2.4.1 -> 2.4.2, add maintainer, migrate by-name, add version check
This commit is contained in:
Weijia Wang 2024-05-12 20:45:53 +02:00 committed by GitHub
commit 72803c77db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 149 additions and 52 deletions

View File

@ -0,0 +1,117 @@
{
lib,
stdenv,
fetchFromGitHub,
boxfort,
meson,
libcsptr,
pkg-config,
gettext,
cmake,
ninja,
protobuf,
libffi,
libgit2,
dyncall,
nanomsg,
nanopbMalloc,
python3Packages,
testers,
criterion,
callPackage
}:
let
# follow revisions defined in .wrap files
debugbreak = fetchFromGitHub {
owner = "MrAnno";
repo = "debugbreak";
rev = "83bf7e933311b88613cbaadeced9c2e2c811054a";
hash = "sha256-OPrPGBUZN73Nl5NMEf/nME843yTolt913yjut3rAos0=";
};
klib = fetchFromGitHub {
owner = "attractivechaos";
repo = "klib";
rev = "cdb7e9236dc47abf8da7ebd702cc6f7f21f0c502";
hash = "sha256-+GaI5nXz4jYI0rO17xDhNtFpLlGL2WzeSVLMfB6Cl6E=";
};
in
stdenv.mkDerivation rec {
pname = "criterion";
version = "2.4.2";
src = fetchFromGitHub {
owner = "Snaipe";
repo = "Criterion";
rev = "v${version}";
fetchSubmodules = true;
hash = "sha256-5GH7AYjrnBnqiSmp28BoaM1Xmy8sPs1atfqJkGy3Yf0=";
};
nativeBuildInputs = [
meson
ninja
cmake
pkg-config
protobuf
];
buildInputs = [
(lib.getDev boxfort)
dyncall
gettext
libcsptr
nanomsg
nanopbMalloc
libgit2
libffi
];
nativeCheckInputs = with python3Packages; [ cram ];
doCheck = true;
prePatch = ''
cp -r ${debugbreak} subprojects/debugbreak
cp -r ${klib} subprojects/klib
for dep in "debugbreak" "klib"; do
local meson="$dep/meson.build"
chmod +w subprojects/$dep
cp subprojects/packagefiles/$meson subprojects/$meson
done
'';
postPatch = ''
patchShebangs ci/isdir.py src/protocol/gen-pb.py
'';
outputs = [
"out"
"dev"
];
passthru.tests.version =
let
tester = callPackage ./tests/001-version.nix {};
in
testers.testVersion {
package = criterion;
command = "${lib.getExe tester} --version";
version = "v${version}";
};
meta = {
description = "A cross-platform C and C++ unit testing framework for the 21th century";
homepage = "https://github.com/Snaipe/Criterion";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
thesola10
Yumasi
sigmanificient
];
platforms = lib.platforms.unix;
};
}

View File

@ -0,0 +1,25 @@
{
stdenv,
pkg-config,
criterion,
}:
stdenv.mkDerivation rec {
name = "version-tester";
version = "v${criterion.version}";
src = ./test_dummy.c;
dontUnpack = true;
buildInputs = [ criterion ];
nativeBuildInputs = [ pkg-config ];
buildPhase = ''
cc -o ${name} $src `pkg-config --libs criterion`
'';
installPhase = ''
mkdir -p $out/bin
cp ${name} $out/bin/${name}
'';
meta.mainProgram = name;
}

View File

@ -0,0 +1,7 @@
#include <stdbool.h>
#include <criterion/criterion.h>
Test(test_dummy, always_succeed)
{
cr_assert(true);
}

View File

@ -1,50 +0,0 @@
{ lib, stdenv, fetchFromGitHub, boxfort, meson, libcsptr, pkg-config, gettext
, cmake, ninja, protobuf, libffi, libgit2, dyncall, nanomsg, nanopbMalloc
, python3Packages }:
stdenv.mkDerivation rec {
pname = "criterion";
version = "2.4.1";
src = fetchFromGitHub {
owner = "Snaipe";
repo = "Criterion";
rev = "v${version}";
sha256 = "KT1XvhT9t07/ubsqzrVUp4iKcpVc1Z+saGF4pm2RsgQ=";
fetchSubmodules = true;
};
nativeBuildInputs = [ meson ninja cmake pkg-config protobuf ];
buildInputs = [
boxfort.dev
dyncall
gettext
libcsptr
nanomsg
nanopbMalloc
libgit2
libffi
];
nativeCheckInputs = with python3Packages; [ cram ];
doCheck = true;
postPatch = ''
patchShebangs ci/isdir.py src/protocol/gen-pb.py
'';
outputs = [ "dev" "out" ];
meta = with lib; {
description = "A cross-platform C and C++ unit testing framework for the 21th century";
homepage = "https://github.com/Snaipe/Criterion";
license = licenses.mit;
maintainers = with maintainers; [
thesola10
Yumasi
];
platforms = platforms.unix;
};
}

View File

@ -20470,8 +20470,6 @@ with pkgs;
cre2 = callPackage ../development/libraries/cre2 { };
criterion = callPackage ../development/libraries/criterion { };
croaring = callPackage ../development/libraries/croaring { };
crocoddyl = callPackage ../development/libraries/crocoddyl { };