commit:     3f34c4d94727a44935b381b06d00367a2755930a
Author:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Mon Sep  5 06:40:29 2022 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Mon Sep  5 06:40:29 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f34c4d9

sci-libs/caffe2: support glog-0.5.0

Closes: https://bugs.gentoo.org/865681
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>

 sci-libs/caffe2/caffe2-1.12.0.ebuild               |  3 ++-
 .../caffe2/files/caffe2-1.12.0-glog-0.6.0.patch    | 29 ++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/sci-libs/caffe2/caffe2-1.12.0.ebuild 
b/sci-libs/caffe2/caffe2-1.12.0.ebuild
index 08e81ce1c8ab..0a44b6824c3c 100644
--- a/sci-libs/caffe2/caffe2-1.12.0.ebuild
+++ b/sci-libs/caffe2/caffe2-1.12.0.ebuild
@@ -27,7 +27,7 @@ REQUIRED_USE="
 RDEPEND="
        ${PYTHON_DEPS}
        dev-cpp/gflags:=
-       <dev-cpp/glog-0.5.0
+       >=dev-cpp/glog-0.5.0
        dev-libs/cpuinfo
        dev-libs/libfmt
        dev-libs/protobuf
@@ -66,6 +66,7 @@ S="${WORKDIR}"/${MYP}
 PATCHES=(
        "${FILESDIR}"/${PN}-1.11.0-gentoo.patch
        "${FILESDIR}"/${PN}-1.12.0-install-dirs.patch
+       "${FILESDIR}"/${P}-glog-0.6.0.patch
 )
 
 src_prepare() {

diff --git a/sci-libs/caffe2/files/caffe2-1.12.0-glog-0.6.0.patch 
b/sci-libs/caffe2/files/caffe2-1.12.0-glog-0.6.0.patch
new file mode 100644
index 000000000000..a821ebedf7b7
--- /dev/null
+++ b/sci-libs/caffe2/files/caffe2-1.12.0-glog-0.6.0.patch
@@ -0,0 +1,29 @@
+https://github.com/pytorch/pytorch/issues/58054
+
+--- /c10/util/Logging.cpp
++++ /c10/util/Logging.cpp
+@@ -192,23 +192,13 @@
+     google::GLOG_WARNING,
+     "The minimum log level that caffe2 will output.");
+ 
+-// Google glog's api does not have an external function that allows one to 
check
+-// if glog is initialized or not. It does have an internal function - so we 
are
+-// declaring it here. This is a hack but has been used by a bunch of others 
too
+-// (e.g. Torch).
+-namespace google {
+-namespace glog_internal_namespace_ {
+-bool IsGoogleLoggingInitialized();
+-} // namespace glog_internal_namespace_
+-} // namespace google
+-
+ namespace c10 {
+ namespace {
+ 
+ void initGoogleLogging(char const* name) {
+ #if !defined(_MSC_VER)
+   // This trick can only be used on UNIX platforms
+-  if (!::google::glog_internal_namespace_::IsGoogleLoggingInitialized())
++  if (!::google::IsGoogleLoggingInitialized())
+ #endif
+   {
+     ::google::InitGoogleLogging(name);

Reply via email to