depot/third_party/nixpkgs/pkgs/development/libraries/gbenchmark/default.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

46 lines
1.1 KiB
Nix

{ 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 = "Microbenchmark support library";
homepage = "https://github.com/google/benchmark";
license = licenses.asl20;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ abbradar ];
};
}