about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/gbenchmark
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/gbenchmark')
-rw-r--r--nixpkgs/pkgs/development/libraries/gbenchmark/default.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/gbenchmark/default.nix b/nixpkgs/pkgs/development/libraries/gbenchmark/default.nix
new file mode 100644
index 000000000000..7292b3452826
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gbenchmark/default.nix
@@ -0,0 +1,46 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+, gtest
+, prometheus-cpp
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gbenchmark";
+  version = "1.8.3";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "benchmark";
+    rev = "v${version}";
+    sha256 = "sha256-gztnxui9Fe/FTieMjdvfJjWHjkImtlsHn6fM1FruyME=";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  postPatch = ''
+    cp -r ${gtest.src} googletest
+    chmod -R u+w googletest
+
+    # https://github.com/google/benchmark/issues/1396
+    substituteInPlace cmake/benchmark.pc.in \
+      --replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
+      --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
+  '';
+
+  # Tests fail on 32-bit due to not enough precision
+  doCheck = stdenv.is64bit;
+
+  passthru.tests = {
+    inherit prometheus-cpp;
+  };
+
+  meta = with lib; {
+    description = "A microbenchmark support library";
+    homepage = "https://github.com/google/benchmark";
+    license = licenses.asl20;
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}