Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] glog: 0.6.0 -> 0.7.1 #349183

Draft
wants to merge 7 commits into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkgs/applications/science/math/caffe/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ stdenv.mkDerivation rec {
});

postPatch = ''
substituteInPlace CMakeLists.txt \
--replace-fail "# ---[ Flags" \
"# ---[ Flags
add_compile_definitions(GLOG_USE_GLOG_EXPORT)"

substituteInPlace src/caffe/util/io.cpp --replace \
'SetTotalBytesLimit(kProtoReadBytesLimit, 536870912)' \
'SetTotalBytesLimit(kProtoReadBytesLimit)'
Expand Down
108 changes: 108 additions & 0 deletions pkgs/by-name/gl/glog/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
cmake,
fetchFromGitHub,
gflags,
gtest,
lib,
perl,
stdenv,
}:

stdenv.mkDerivation rec {
pname = "glog";
version = "0.7.1";

src = fetchFromGitHub {
owner = "google";
repo = "glog";
rev = "v${version}";
hash = "sha256-+nwWP6VBmhgU7GCPSEGUzvUSCc48wXME181WpJ5ABP4=";
};

outputs = [
"dev"
"out"
];

cmakeFlags = [
"-DBUILD_SHARED_LIBS=ON"
# 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"
# Upstream disabled generation of pkg-config `.pc` files since
# https://github.com/google/glog/releases/tag/v0.7.0
# because they are "undocumented and untested".
# Non-C++ dependents (that thus can't use CMake) may need them though
# to find `glog`, so we enable them.
"-DWITH_PKGCONFIG=ON"
];

env.GTEST_FILTER =
let
filteredTests =
lib.optionals stdenv.hostPlatform.isMusl [
"Symbolize.SymbolizeStackConsumption"
"Symbolize.SymbolizeWithDemanglingStackConsumption"
]
++ lib.optionals stdenv.hostPlatform.isStatic [
"LogBacktraceAt.DoesBacktraceAtRightLineWhenEnabled"
]
++ 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}";

# Non-thread safe tests can fail
enableParallelChecking = false;

strictDeps = true;

nativeBuildInputs = [ cmake ];

buildInputs = [ gtest ];

propagatedBuildInputs = [ gflags ];

doCheck = true;

nativeCheckInputs = [ perl ];

checkPhase =
let
excludedTests =
lib.optionals stdenv.hostPlatform.isDarwin [
"mock-log"
]
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
"logging" # works around segfaults on aarch64-darwin for now
];
excludedTestsRegex = lib.optionalString (
excludedTests != [ ]
) "(${lib.concatStringsSep "|" excludedTests})";
in
''
runHook preCheck
ctest -E "${excludedTestsRegex}" --output-on-failure
runHook postCheck
'';

meta = {
description = "Library for application-level logging";
changelog = "https://github.com/google/glog/releases/tag/v${version}";
homepage = "https://github.com/google/glog";
license = lib.licenses.bsd3;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [
nh2
r-burns
];
};
}
5 changes: 5 additions & 0 deletions pkgs/desktops/lomiri/development/trust-store/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ stdenv.mkDerivation (finalAttrs: {
];

postPatch = ''
substituteInPlace CMakeLists.txt \
--replace-fail "option(ENABLE_WERROR \"Treat all build warnings as errors\" ON)" \
"option(ENABLE_WERROR \"Treat all build warnings as errors\" ON)
add_compile_definitions(GLOG_USE_GLOG_EXPORT)"
# pkg-config patching hook expects prefix variable
substituteInPlace data/trust-store.pc.in \
--replace-fail 'libdir=''${exec_prefix}' 'libdir=''${prefix}' \
Expand Down
16 changes: 16 additions & 0 deletions pkgs/development/libraries/folly/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, boost
, cmake
, double-conversion
Expand Down Expand Up @@ -35,6 +36,21 @@ stdenv.mkDerivation rec {
sha256 = "sha256-INvWTw27fmVbKQIT9ebdRGMCOIzpc/NepRN2EnKLJx0=";
};

patches = [
# Fix incorrect include of glog >= 0.7.0, see https://github.com/facebook/folly/issues/2171
(fetchpatch {
name = "folly-fix-cmake-find-glog.patch";
url = "https://aur.archlinux.org/cgit/aur.git/plain/fix-cmake-find-glog.patch?h=folly&id=4b68f47338d4b20111e3ffa1291433120bb899f0";
hash = "sha256-QGNpS5UNEm+0PW9+agwUVILzpK9t020KXDGyP03OAwE=";
})
# Fix missing includes with glog >= 0.7.0, see https://github.com/facebook/folly/pull/2245
(fetchpatch {
name = "folly-symbolizer-Fix-missing-unistd-h-include.patch";
url = "https://github.com/facebook/folly/commit/f64cfb8aca569c1259c1e202861281b4704565c6.patch";
hash = "sha256-j1uV0JDFsMReCG7XVVADwW1f/2PICYzqdyfEjP314Dg=";
})
];

nativeBuildInputs = [
cmake
pkg-config
Expand Down
74 changes: 0 additions & 74 deletions pkgs/development/libraries/glog/default.nix

This file was deleted.

5 changes: 5 additions & 0 deletions pkgs/development/python-modules/opensfm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ buildPythonPackage rec {
./fix-scripts.patch
];
postPatch = ''
substituteInPlace opensfm/src/CMakeLists.txt \
--replace-fail "####### Find Dependencies #######" \
"####### Find Dependencies #######
add_compile_definitions(GLOG_USE_GLOG_EXPORT)"

rm opensfm/src/cmake/FindGlog.cmake
rm opensfm/src/cmake/FindGflags.cmake

Expand Down
2 changes: 0 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19839,8 +19839,6 @@ with pkgs;

glm = callPackage ../development/libraries/glm { };

glog = callPackage ../development/libraries/glog { };

gloox = callPackage ../development/libraries/gloox { };

glpk = callPackage ../development/libraries/glpk { };
Expand Down