1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, gtest
6, prometheus-cpp
7}:
8
9stdenv.mkDerivation rec {
10 pname = "gbenchmark";
11 version = "1.8.4";
12
13 src = fetchFromGitHub {
14 owner = "google";
15 repo = "benchmark";
16 rev = "v${version}";
17 sha256 = "sha256-O+1ZHaNHSkKz3PlKDyI94LqiLtjyrKxjOIi8Q236/MI=";
18 };
19
20 nativeBuildInputs = [ cmake ];
21
22 postPatch = ''
23 cp -r ${gtest.src} googletest
24 chmod -R u+w googletest
25
26 # https://github.com/google/benchmark/issues/1396
27 substituteInPlace cmake/benchmark.pc.in \
28 --replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
29 --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
30 '';
31
32 # Tests fail on 32-bit due to not enough precision
33 doCheck = stdenv.is64bit;
34
35 passthru.tests = {
36 inherit prometheus-cpp;
37 };
38
39 meta = with lib; {
40 description = "Microbenchmark support library";
41 homepage = "https://github.com/google/benchmark";
42 license = licenses.asl20;
43 platforms = platforms.linux ++ platforms.darwin;
44 maintainers = with maintainers; [ abbradar ];
45 };
46}