|
| 1 | +licenses(["notice"]) |
| 2 | + |
| 3 | +cc_library( |
| 4 | + visibility=["//visibility:public"], |
| 5 | + name="glog", |
| 6 | + includes=[ |
| 7 | + ".", |
| 8 | + "src", |
| 9 | + ], |
| 10 | + copts=[ |
| 11 | + "-D_START_GOOGLE_NAMESPACE_='namespace google {'", |
| 12 | + "-D_END_GOOGLE_NAMESPACE_='}'", |
| 13 | + "-DGOOGLE_NAMESPACE='google'", |
| 14 | + "-DGOOGLE_GLOG_DLL_DECL=''", |
| 15 | + "-DHAVE_DLADDR", |
| 16 | + "-DHAVE_SNPRINTF", |
| 17 | + "-DHAVE_DLFCN_H", |
| 18 | + "-DHAVE_FCNTL", |
| 19 | + "-DHAVE_GLOB_H", |
| 20 | + "-DHAVE_INTTYPES_H", |
| 21 | + "-DHAVE_LIBPTHREAD", |
| 22 | + "-DHAVE_SYS_SYSCALL_H", |
| 23 | + "-DHAVE_MEMORY_H", |
| 24 | + "-DHAVE_NAMESPACES", |
| 25 | + "-DHAVE_PREAD", |
| 26 | + "-DHAVE_PTHREAD", |
| 27 | + "-DHAVE_PWD_H", |
| 28 | + "-DHAVE_PWRITE", |
| 29 | + "-DHAVE_RWLOCK", |
| 30 | + "-DHAVE_SIGACTION", |
| 31 | + "-DHAVE_SIGALTSTACK", |
| 32 | + "-DHAVE_STDINT_H", |
| 33 | + "-DHAVE_STRING_H", |
| 34 | + "-DHAVE_SYS_TIME_H", |
| 35 | + "-DHAVE_SYS_TYPES_H", |
| 36 | + "-DHAVE_SYS_UCONTEXT_H", |
| 37 | + "-DHAVE_SYS_UTSNAME_H", |
| 38 | + "-DHAVE_UNISTD_H", |
| 39 | + "-DHAVE_USING_OPERATOR", |
| 40 | + "-DHAVE_HAVE___ATTRIBUTE___", |
| 41 | + "-DHAVE_HAVE___BUILTIN_EXPECT", |
| 42 | + #"-DNO_FRAME_POINTER", |
| 43 | + "-D_GNU_SOURCE", |
| 44 | + #"-fno-sanitize=thread", |
| 45 | + #"-fno-sanitize=address", |
| 46 | + "-Iexternal/glog/src", |
| 47 | + ], |
| 48 | + srcs=[ |
| 49 | + "src/demangle.cc", |
| 50 | + "src/logging.cc", |
| 51 | + "src/raw_logging.cc", |
| 52 | + "src/signalhandler.cc", |
| 53 | + "src/symbolize.cc", |
| 54 | + "src/utilities.cc", |
| 55 | + "src/vlog_is_on.cc", |
| 56 | + ":config_h", |
| 57 | + ":logging_h", |
| 58 | + ":raw_logging_h", |
| 59 | + ":stl_logging_h", |
| 60 | + ":vlog_is_on_h", |
| 61 | + ], |
| 62 | + hdrs=[ |
| 63 | + "src/demangle.h", |
| 64 | + "src/mock-log.h", |
| 65 | + "src/stacktrace.h", |
| 66 | + "src/symbolize.h", |
| 67 | + "src/utilities.h", |
| 68 | + "src/base/commandlineflags.h", |
| 69 | + "src/base/googleinit.h", |
| 70 | + "src/base/mutex.h", |
| 71 | + "src/glog/log_severity.h", |
| 72 | + ]) |
| 73 | + |
| 74 | +genrule( |
| 75 | + name="config_h", |
| 76 | + srcs=["src/config.h.cmake.in"], |
| 77 | + outs=["config.h"], |
| 78 | + cmd="awk '{ gsub(/^#cmakedefine/, \"//cmakedefine\"); print; }' $(<) > $(@)", |
| 79 | +) |
| 80 | + |
| 81 | +genrule( |
| 82 | + name="logging_h", |
| 83 | + srcs=["src/glog/logging.h.in"], |
| 84 | + outs=["glog/logging.h"], |
| 85 | + cmd="$(location :gen_sh) < $(<) > $(@)", |
| 86 | + tools=[":gen_sh"]) |
| 87 | + |
| 88 | +genrule( |
| 89 | + name="raw_logging_h", |
| 90 | + srcs=["src/glog/raw_logging.h.in"], |
| 91 | + outs=["glog/raw_logging.h"], |
| 92 | + cmd="$(location :gen_sh) < $(<) > $(@)", |
| 93 | + tools=[":gen_sh"]) |
| 94 | + |
| 95 | +genrule( |
| 96 | + name="stl_logging_h", |
| 97 | + srcs=["src/glog/stl_logging.h.in"], |
| 98 | + outs=["glog/stl_logging.h"], |
| 99 | + cmd="$(location :gen_sh) < $(<) > $(@)", |
| 100 | + tools=[":gen_sh"]) |
| 101 | + |
| 102 | +genrule( |
| 103 | + name="vlog_is_on_h", |
| 104 | + srcs=["src/glog/vlog_is_on.h.in"], |
| 105 | + outs=["glog/vlog_is_on.h"], |
| 106 | + cmd="$(location :gen_sh) < $(<) > $(@)", |
| 107 | + tools=[":gen_sh"]) |
| 108 | + |
| 109 | +genrule( |
| 110 | + name="gen_sh", |
| 111 | + outs=["gen.sh"], |
| 112 | + cmd=""" |
| 113 | +cat > $@ <<"EOF" |
| 114 | +#! /bin/sh |
| 115 | +sed -e 's/@ac_cv_have_unistd_h@/1/g' \ |
| 116 | + -e 's/@ac_cv_have_stdint_h@/1/g' \ |
| 117 | + -e 's/@ac_cv_have_systypes_h@/1/g' \ |
| 118 | + -e 's/@ac_cv_have_libgflags_h@/1/g' \ |
| 119 | + -e 's/@ac_cv_have_uint16_t@/1/g' \ |
| 120 | + -e 's/@ac_cv_have___builtin_expect@/1/g' \ |
| 121 | + -e 's/@ac_cv_have_.*@/0/g' \ |
| 122 | + -e 's/@ac_google_start_namespace@/namespace google {/g' \ |
| 123 | + -e 's/@ac_google_end_namespace@/}/g' \ |
| 124 | + -e 's/@ac_google_namespace@/google/g' \ |
| 125 | + -e 's/@ac_cv___attribute___noinline@/__attribute__((noinline))/g' \ |
| 126 | + -e 's/@ac_cv___attribute___noreturn@/__attribute__((noreturn))/g' \ |
| 127 | + -e 's/@ac_cv___attribute___printf_4_5@/__attribute__((__format__ (__printf__, 4, 5)))/g' |
| 128 | +EOF""") |
0 commit comments