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