mirror of
https://github.com/wassname/ray.git
synced 2026-07-13 17:45:08 +08:00
Update glog (#6287)
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
licenses(['notice'])
|
||||
|
||||
load('@//bazel:glog.bzl', 'glog_library')
|
||||
|
||||
glog_library()
|
||||
-149
@@ -1,149 +0,0 @@
|
||||
# This script is copied from https://github.com/google/glog/blob/master/bazel/glog.bzl
|
||||
# with some modifications to enable printing call stack.
|
||||
# Implement a macro glog_library() that the BUILD file can load.
|
||||
|
||||
# By default, glog is built with gflags support. You can change this behavior
|
||||
# by using glog_library(with_gflags=0)
|
||||
#
|
||||
# This file is inspired by the following sample BUILD files:
|
||||
# https://github.com/google/glog/issues/61
|
||||
# https://github.com/google/glog/files/393474/BUILD.txt
|
||||
|
||||
def glog_library(namespace='google', with_gflags=1, **kwargs):
|
||||
if native.repository_name() != '@':
|
||||
gendir = '$(GENDIR)/external/' + native.repository_name().lstrip('@')
|
||||
else:
|
||||
gendir = '$(GENDIR)'
|
||||
|
||||
native.cc_library(
|
||||
name = 'glog',
|
||||
visibility = [ '//visibility:public' ],
|
||||
srcs = [
|
||||
':config_h',
|
||||
'src/base/commandlineflags.h',
|
||||
'src/base/googleinit.h',
|
||||
'src/base/mutex.h',
|
||||
'src/demangle.cc',
|
||||
'src/demangle.h',
|
||||
'src/logging.cc',
|
||||
'src/raw_logging.cc',
|
||||
'src/signalhandler.cc',
|
||||
'src/stacktrace.h',
|
||||
'src/stacktrace_generic-inl.h',
|
||||
'src/stacktrace_libunwind-inl.h',
|
||||
'src/stacktrace_powerpc-inl.h',
|
||||
'src/stacktrace_windows-inl.h',
|
||||
'src/stacktrace_x86-inl.h',
|
||||
'src/stacktrace_x86_64-inl.h',
|
||||
'src/symbolize.cc',
|
||||
'src/symbolize.h',
|
||||
'src/utilities.cc',
|
||||
'src/utilities.h',
|
||||
'src/vlog_is_on.cc',
|
||||
],
|
||||
hdrs = [
|
||||
':logging_h',
|
||||
':raw_logging_h',
|
||||
':stl_logging_h',
|
||||
':vlog_is_on_h',
|
||||
'src/glog/log_severity.h',
|
||||
],
|
||||
strip_include_prefix = 'src',
|
||||
copts = [
|
||||
# Disable warnings that exists in glog.
|
||||
'-Wno-sign-compare',
|
||||
'-Wno-unused-function',
|
||||
'-Wno-unused-local-typedefs',
|
||||
'-Wno-unused-variable',
|
||||
"-DGLOG_BAZEL_BUILD",
|
||||
# Inject a C++ namespace.
|
||||
"-DGOOGLE_NAMESPACE='%s'" % namespace,
|
||||
# Allows src/base/mutex.h to include pthread.h.
|
||||
'-DHAVE_PTHREAD',
|
||||
# Allows src/logging.cc to determine the host name.
|
||||
'-DHAVE_SYS_UTSNAME_H',
|
||||
# For src/utilities.cc.
|
||||
'-DHAVE_SYS_SYSCALL_H',
|
||||
'-DHAVE_SYS_TIME_H',
|
||||
'-DHAVE_STDINT_H',
|
||||
'-DHAVE_STRING_H',
|
||||
# Enable dumping stacktrace upon sigaction.
|
||||
'-DHAVE_SIGACTION',
|
||||
# The following 2 Macros are enabled by ray.
|
||||
'-DHAVE_EXECINFO_H',
|
||||
'-DHAVE_SYMBOLIZE',
|
||||
# For logging.cc.
|
||||
'-DHAVE_PREAD',
|
||||
'-DHAVE___ATTRIBUTE__',
|
||||
|
||||
# Include generated header files.
|
||||
'-I%s/glog_internal' % gendir,
|
||||
# The following Macro is enabled by ray.
|
||||
] + select({
|
||||
"@bazel_tools//src/conditions:darwin": ['-DHAVE_DLADDR'],
|
||||
"//conditions:default": [],
|
||||
}) +
|
||||
([
|
||||
# Use gflags to parse CLI arguments.
|
||||
'-DHAVE_LIB_GFLAGS',
|
||||
] if with_gflags else []),
|
||||
deps = [
|
||||
'@com_github_gflags_gflags//:gflags',
|
||||
] if with_gflags else [],
|
||||
**kwargs
|
||||
)
|
||||
|
||||
native.genrule(
|
||||
name = 'gen_sh',
|
||||
outs = [
|
||||
'gen.sh',
|
||||
],
|
||||
cmd = r'''\
|
||||
#!/bin/sh
|
||||
cat > $@ <<"EOF"
|
||||
sed -e 's/@ac_cv_cxx_using_operator@/1/g' \
|
||||
-e 's/@ac_cv_have_unistd_h@/1/g' \
|
||||
-e 's/@ac_cv_have_stdint_h@/1/g' \
|
||||
-e 's/@ac_cv_have_systypes_h@/1/g' \
|
||||
-e 's/@ac_cv_have_libgflags@/{}/g' \
|
||||
-e 's/@ac_cv_have_uint16_t@/1/g' \
|
||||
-e 's/@ac_cv_have___builtin_expect@/1/g' \
|
||||
-e 's/@ac_cv_have_.*@/0/g' \
|
||||
-e 's/@ac_google_start_namespace@/namespace google {{/g' \
|
||||
-e 's/@ac_google_end_namespace@/}}/g' \
|
||||
-e 's/@ac_google_namespace@/google/g' \
|
||||
-e 's/@ac_cv___attribute___noinline@/__attribute__((noinline))/g' \
|
||||
-e 's/@ac_cv___attribute___noreturn@/__attribute__((noreturn))/g' \
|
||||
-e 's/@ac_cv___attribute___printf_4_5@/__attribute__((__format__ (__printf__, 4, 5)))/g'
|
||||
EOF
|
||||
'''.format(int(with_gflags)),
|
||||
)
|
||||
|
||||
native.genrule(
|
||||
name = 'config_h',
|
||||
srcs = [
|
||||
'src/config.h.cmake.in',
|
||||
],
|
||||
outs = [
|
||||
'glog_internal/config.h',
|
||||
],
|
||||
cmd = "awk '{ gsub(/^#cmakedefine/, \"//cmakedefine\"); print; }' $< > $@",
|
||||
)
|
||||
|
||||
[native.genrule(
|
||||
name = '%s_h' % f,
|
||||
srcs = [
|
||||
'src/glog/%s.h.in' % f,
|
||||
],
|
||||
outs = [
|
||||
'src/glog/%s.h' % f,
|
||||
],
|
||||
cmd = '$(location :gen_sh) < $< > $@',
|
||||
tools = [':gen_sh'],
|
||||
) for f in [
|
||||
'vlog_is_on',
|
||||
'stl_logging',
|
||||
'raw_logging',
|
||||
'logging',
|
||||
]
|
||||
]
|
||||
@@ -137,10 +137,12 @@ def ray_deps_setup():
|
||||
|
||||
github_repository(
|
||||
name = "com_github_google_glog",
|
||||
build_file = "@//bazel:BUILD.glog",
|
||||
commit = "96a2f23dca4cc7180821ca5f32e526314395d26a",
|
||||
commit = "925858d9969d8ee22aabc3635af00a37891f4e25",
|
||||
remote = "https://github.com/google/glog",
|
||||
sha256 = "6281aa4eeecb9e932d7091f99872e7b26fa6aacece49c15ce5b14af2b7ec050f",
|
||||
sha256 = "dbe787f2a7cf1146f748a191c99ae85d6b931dd3ebdcc76aa7ccae3699149c67",
|
||||
patches = [
|
||||
"//thirdparty/patches:glog-stack-trace.patch",
|
||||
],
|
||||
)
|
||||
|
||||
github_repository(
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
diff --git bazel/glog.bzl bazel/glog.bzl
|
||||
index 4c11f12..2510ecc 100644
|
||||
--- bazel/glog.bzl
|
||||
+++ bazel/glog.bzl
|
||||
@@ -17,7 +17,6 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
|
||||
"-DGLOG_BAZEL_BUILD",
|
||||
"-DHAVE_STDINT_H",
|
||||
"-DHAVE_STRING_H",
|
||||
- "-DHAVE_UNWIND_H",
|
||||
] + (["-DHAVE_LIB_GFLAGS"] if with_gflags else [])
|
||||
|
||||
linux_or_darwin_copts = [
|
||||
@@ -37,6 +36,8 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
|
||||
"-DHAVE_SYS_TIME_H",
|
||||
# Enable dumping stacktrace upon sigaction.
|
||||
"-DHAVE_SIGACTION",
|
||||
+ "-DHAVE_EXECINFO_H",
|
||||
+ "-DHAVE_SYMBOLIZE",
|
||||
# For logging.cc.
|
||||
"-DHAVE_PREAD",
|
||||
"-DHAVE___ATTRIBUTE__",
|
||||
--
|
||||
Reference in New Issue
Block a user