2022-08-14 10:21:32 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, cmake, gflags, gtest, perl }:
|
2014-01-24 14:51:04 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "glog";
|
2022-04-08 23:30:19 +00:00
|
|
|
version = "0.6.0";
|
2017-10-26 23:44:19 +00:00
|
|
|
|
2015-04-21 22:33:39 +00:00
|
|
|
src = fetchFromGitHub {
|
2017-11-12 13:37:36 +00:00
|
|
|
owner = "google";
|
2015-04-21 22:33:39 +00:00
|
|
|
repo = "glog";
|
|
|
|
rev = "v${version}";
|
2022-04-08 23:30:19 +00:00
|
|
|
sha256 = "sha256-xqRp9vaauBkKz2CXbh/Z4TWqhaUtqfbsSlbYZR/kW9s=";
|
2014-01-24 14:51:04 +00:00
|
|
|
};
|
|
|
|
|
2019-12-16 12:04:53 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
2022-08-14 10:21:32 +00:00
|
|
|
buildInputs = [ gtest ];
|
|
|
|
|
2020-01-12 21:53:27 +00:00
|
|
|
propagatedBuildInputs = [ gflags ];
|
|
|
|
|
2021-11-04 01:38:03 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_SHARED_LIBS=ON"
|
2023-08-11 14:01:43 +00:00
|
|
|
# glog's custom FindUnwind.cmake module detects LLVM's unwind in case
|
|
|
|
# stdenv.cc is clang. But the module doesn't get installed, causing
|
|
|
|
# consumers of the CMake config file to fail at the configuration step.
|
|
|
|
# Explicitly disabling unwind support sidesteps the issue.
|
|
|
|
"-DWITH_UNWIND=OFF"
|
2021-11-04 01:38:03 +00:00
|
|
|
];
|
2015-04-21 22:33:39 +00:00
|
|
|
|
2023-08-11 14:01:43 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2022-03-26 00:39:28 +00:00
|
|
|
# There are some non-thread safe tests that can fail
|
|
|
|
enableParallelChecking = false;
|
2023-01-21 12:00:00 +00:00
|
|
|
nativeCheckInputs = [ perl ];
|
2021-11-03 22:56:12 +00:00
|
|
|
|
2023-08-11 14:01:43 +00:00
|
|
|
env.GTEST_FILTER =
|
2022-08-14 10:21:32 +00:00
|
|
|
let
|
|
|
|
filteredTests = lib.optionals stdenv.hostPlatform.isMusl [
|
|
|
|
"Symbolize.SymbolizeStackConsumption"
|
|
|
|
"Symbolize.SymbolizeWithDemanglingStackConsumption"
|
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isStatic [
|
|
|
|
"LogBacktraceAt.DoesBacktraceAtRightLineWhenEnabled"
|
2023-08-11 14:01:43 +00:00
|
|
|
] ++ lib.optionals stdenv.cc.isClang [
|
|
|
|
# Clang optimizes an expected allocation away.
|
|
|
|
# See https://github.com/google/glog/issues/937
|
|
|
|
"DeathNoAllocNewHook.logging"
|
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
|
|
"LogBacktraceAt.DoesBacktraceAtRightLineWhenEnabled"
|
|
|
|
];
|
|
|
|
in
|
|
|
|
"-${builtins.concatStringsSep ":" filteredTests}";
|
|
|
|
|
|
|
|
checkPhase =
|
|
|
|
let
|
|
|
|
excludedTests = lib.optionals stdenv.hostPlatform.isDarwin [
|
|
|
|
"mock-log"
|
2023-08-27 08:01:33 +00:00
|
|
|
] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
|
|
|
|
"logging" # works around segfaults on aarch64-darwin for now
|
2022-08-14 10:21:32 +00:00
|
|
|
];
|
2023-08-11 14:01:43 +00:00
|
|
|
excludedTestsRegex = lib.optionalString (excludedTests != [ ]) "(${lib.concatStringsSep "|" excludedTests})";
|
2022-08-14 10:21:32 +00:00
|
|
|
in
|
2023-08-11 14:01:43 +00:00
|
|
|
''
|
|
|
|
runHook preCheck
|
|
|
|
ctest -E "${excludedTestsRegex}" --output-on-failure
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
2022-08-14 10:21:32 +00:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2019-12-16 12:04:53 +00:00
|
|
|
homepage = "https://github.com/google/glog";
|
2015-04-21 22:33:39 +00:00
|
|
|
license = licenses.bsd3;
|
2014-08-24 14:21:08 +00:00
|
|
|
description = "Library for application-level logging";
|
2015-04-21 22:33:39 +00:00
|
|
|
platforms = platforms.unix;
|
2021-11-11 13:47:03 +00:00
|
|
|
maintainers = with maintainers; [ nh2 r-burns ];
|
2014-01-24 14:51:04 +00:00
|
|
|
};
|
|
|
|
}
|