gap: ship Makefile.gappkg for future gap package use (#380430)
[NixPkgs.git] / pkgs / by-name / cr / criterion / package.nix
blob958a9a7c89ed5381a67768f4a3f51e253fe4593a
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   boxfort,
6   meson,
7   libcsptr,
8   pkg-config,
9   gettext,
10   cmake,
11   ninja,
12   protobuf,
13   libffi,
14   libgit2,
15   dyncall,
16   nanomsg,
17   nanopbMalloc,
18   python3Packages,
19   testers,
20   criterion,
21   callPackage,
24 let
25   # follow revisions defined in .wrap files
26   debugbreak = fetchFromGitHub {
27     owner = "MrAnno";
28     repo = "debugbreak";
29     rev = "83bf7e933311b88613cbaadeced9c2e2c811054a";
30     hash = "sha256-OPrPGBUZN73Nl5NMEf/nME843yTolt913yjut3rAos0=";
31   };
33   klib = fetchFromGitHub {
34     owner = "attractivechaos";
35     repo = "klib";
36     rev = "cdb7e9236dc47abf8da7ebd702cc6f7f21f0c502";
37     hash = "sha256-+GaI5nXz4jYI0rO17xDhNtFpLlGL2WzeSVLMfB6Cl6E=";
38   };
40 stdenv.mkDerivation rec {
41   pname = "criterion";
42   version = "2.4.2";
44   src = fetchFromGitHub {
45     owner = "Snaipe";
46     repo = "Criterion";
47     rev = "v${version}";
48     fetchSubmodules = true;
49     hash = "sha256-5GH7AYjrnBnqiSmp28BoaM1Xmy8sPs1atfqJkGy3Yf0=";
50   };
52   nativeBuildInputs = [
53     meson
54     ninja
55     cmake
56     pkg-config
57     protobuf
58   ];
60   buildInputs = [
61     (lib.getDev boxfort)
62     dyncall
63     gettext
64     libcsptr
65     nanomsg
66     nanopbMalloc
67     libgit2
68     libffi
69   ];
71   nativeCheckInputs = with python3Packages; [ cram ];
73   doCheck = true;
75   prePatch = ''
76     cp -r ${debugbreak} subprojects/debugbreak
77     cp -r ${klib} subprojects/klib
79     for dep in "debugbreak" "klib"; do
80       local meson="$dep/meson.build"
82       chmod +w subprojects/$dep
83       cp subprojects/packagefiles/$meson subprojects/$meson
84     done
85   '';
87   postPatch = ''
88     patchShebangs ci/isdir.py src/protocol/gen-pb.py
89   '';
91   outputs = [
92     "out"
93     "dev"
94   ];
96   passthru.tests.version =
97     let
98       tester = callPackage ./tests/001-version.nix { };
99     in
100     testers.testVersion {
101       package = criterion;
102       command = "${lib.getExe tester} --version";
103       version = "v${version}";
104     };
106   meta = {
107     description = "Cross-platform C and C++ unit testing framework for the 21th century";
108     homepage = "https://github.com/Snaipe/Criterion";
109     license = lib.licenses.mit;
110     maintainers = with lib.maintainers; [
111       thesola10
112       Yumasi
113       sigmanificient
114     ];
115     platforms = lib.platforms.unix;
116   };