| load("@io_kythe//tools:build_rules/expand_template.bzl", "expand_template") |
| |
| package( |
| default_visibility = ["//visibility:private"], |
| ) |
| |
| genrule( |
| name = "configure", |
| srcs = ["@io_kythe//third_party:libmemcached.mem_config.h"], |
| outs = ["mem_config.h"], |
| cmd = "cp \"$<\" \"$@\"", |
| ) |
| |
| cc_library( |
| name = "config", |
| hdrs = ["mem_config.h"], |
| ) |
| |
| genrule( |
| name = "hashkitcon", |
| outs = [ |
| "libhashkit/hashkitcon.h", |
| ], |
| cmd = "echo '#include \"mem_config.h\"' > $@", |
| ) |
| |
| cc_library( |
| name = "libmemcachedprotocol", |
| hdrs = glob(["libmemcachedprotocol-0.0/*.h"]), |
| includes = [""], |
| ) |
| |
| cc_library( |
| name = "libhashkit", |
| srcs = [ |
| "libhashkit/aes.cc", |
| "libhashkit/aes.h", |
| "libhashkit/algorithm.cc", |
| "libhashkit/algorithm.h", |
| "libhashkit/behavior.cc", |
| "libhashkit/common.h", |
| "libhashkit/crc32.cc", |
| "libhashkit/digest.cc", |
| "libhashkit/encrypt.cc", |
| "libhashkit/fnv_32.cc", |
| "libhashkit/fnv_64.cc", |
| "libhashkit/function.cc", |
| "libhashkit/has.cc", |
| "libhashkit/hashkit.cc", |
| "libhashkit/hashkitcon.h", |
| "libhashkit/hsieh.cc", |
| "libhashkit/is.h", |
| "libhashkit/jenkins.cc", |
| "libhashkit/ketama.cc", |
| "libhashkit/md5.cc", |
| "libhashkit/murmur.cc", |
| "libhashkit/murmur3.cc", |
| "libhashkit/murmur3.h", |
| "libhashkit/murmur3_api.cc", |
| "libhashkit/one_at_a_time.cc", |
| "libhashkit/rijndael.cc", |
| "libhashkit/rijndael.hpp", |
| "libhashkit/str_algorithm.cc", |
| "libhashkit/strerror.cc", |
| "libhashkit/string.cc", |
| "libhashkit/string.h", |
| ], |
| hdrs = [ |
| "libhashkit-1.0/algorithm.h", |
| "libhashkit-1.0/behavior.h", |
| "libhashkit-1.0/configure.h", |
| "libhashkit-1.0/digest.h", |
| "libhashkit-1.0/function.h", |
| "libhashkit-1.0/has.h", |
| "libhashkit-1.0/hashkit.h", |
| "libhashkit-1.0/hashkit.hpp", |
| "libhashkit-1.0/str_algorithm.h", |
| "libhashkit-1.0/strerror.h", |
| "libhashkit-1.0/string.h", |
| "libhashkit-1.0/types.h", |
| "libhashkit-1.0/visibility.h", |
| "libhashkit/hashkit.h", |
| ], |
| copts = ["-DBUILDING_HASHKIT"], |
| includes = [""], # Force include path into -isystem |
| deps = [":config"], |
| ) |
| |
| LIBMEMCACHED_HEADERS = [ |
| "libmemcached-1.0/alloc.h", |
| "libmemcached-1.0/allocators.h", |
| "libmemcached-1.0/analyze.h", |
| "libmemcached-1.0/auto.h", |
| "libmemcached-1.0/basic_string.h", |
| "libmemcached-1.0/behavior.h", |
| "libmemcached-1.0/callback.h", |
| "libmemcached-1.0/callbacks.h", |
| "libmemcached-1.0/defaults.h", |
| "libmemcached-1.0/delete.h", |
| "libmemcached-1.0/deprecated_types.h", |
| "libmemcached-1.0/dump.h", |
| "libmemcached-1.0/encoding_key.h", |
| "libmemcached-1.0/error.h", |
| "libmemcached-1.0/exception.hpp", |
| "libmemcached-1.0/exist.h", |
| "libmemcached-1.0/fetch.h", |
| "libmemcached-1.0/flush.h", |
| "libmemcached-1.0/flush_buffers.h", |
| "libmemcached-1.0/get.h", |
| "libmemcached-1.0/hash.h", |
| "libmemcached-1.0/limits.h", |
| "libmemcached-1.0/memcached.h", |
| "libmemcached-1.0/memcached.hpp", |
| "libmemcached-1.0/options.h", |
| "libmemcached-1.0/parse.h", |
| "libmemcached-1.0/platform.h", |
| "libmemcached-1.0/quit.h", |
| "libmemcached-1.0/result.h", |
| "libmemcached-1.0/return.h", |
| "libmemcached-1.0/sasl.h", |
| "libmemcached-1.0/server.h", |
| "libmemcached-1.0/server_list.h", |
| "libmemcached-1.0/stats.h", |
| "libmemcached-1.0/storage.h", |
| "libmemcached-1.0/strerror.h", |
| "libmemcached-1.0/struct/allocator.h", |
| "libmemcached-1.0/struct/analysis.h", |
| "libmemcached-1.0/struct/callback.h", |
| "libmemcached-1.0/struct/memcached.h", |
| "libmemcached-1.0/struct/result.h", |
| "libmemcached-1.0/struct/sasl.h", |
| "libmemcached-1.0/struct/server.h", |
| "libmemcached-1.0/struct/stat.h", |
| "libmemcached-1.0/struct/string.h", |
| "libmemcached-1.0/touch.h", |
| "libmemcached-1.0/triggers.h", |
| "libmemcached-1.0/types.h", |
| "libmemcached-1.0/types/behavior.h", |
| "libmemcached-1.0/types/callback.h", |
| "libmemcached-1.0/types/connection.h", |
| "libmemcached-1.0/types/hash.h", |
| "libmemcached-1.0/types/return.h", |
| "libmemcached-1.0/types/server_distribution.h", |
| "libmemcached-1.0/verbosity.h", |
| "libmemcached-1.0/version.h", |
| "libmemcached-1.0/visibility.h", |
| ] |
| |
| expand_template( |
| name = "configure_sans_sasl", |
| out = "headers/libmemcached-1.0/configure.h", |
| substitutions = { |
| "@DEPRECATED@": "", |
| "@LIBMEMCACHED_VERSION_HEX@": "0x01000018", |
| "@LIBMEMCACHED_VERSION_STRING@": "1.0.18", |
| "@LIBMEMCACHED_WITH_SASL_SUPPORT@": "#define LIBMEMCACHED_WITH_SASL_SUPPORT 0", |
| }, |
| template = "libmemcached-1.0/configure.h.in", |
| ) |
| |
| # Copy all of the headers except the pre-generated configure.h to a subdirectory. |
| # Clang/GCC are otherwise inconsistent in which version of the header they choose. |
| # Additionally, Bazel passes included directories such that the pre-generated configure.h |
| # file should always be preferred, which is not what we want. |
| [ |
| genrule( |
| name = "header_{}_copy".format(hdr.replace("/", "_")), |
| srcs = [hdr], |
| outs = ["headers/{}".format(hdr)], |
| cmd = "cp $< $@", |
| ) |
| for hdr in LIBMEMCACHED_HEADERS |
| ] |
| |
| cc_library( |
| name = "libmemcached", |
| srcs = [ |
| "libmemcached/allocators.cc", |
| "libmemcached/allocators.hpp", |
| "libmemcached/analyze.cc", |
| "libmemcached/array.c", |
| "libmemcached/array.h", |
| "libmemcached/assert.hpp", |
| "libmemcached/auto.cc", |
| "libmemcached/backtrace.cc", |
| "libmemcached/backtrace.hpp", |
| "libmemcached/behavior.cc", |
| "libmemcached/behavior.hpp", |
| "libmemcached/byteorder.cc", |
| "libmemcached/byteorder.h", |
| "libmemcached/callback.cc", |
| "libmemcached/common.h", |
| "libmemcached/connect.cc", |
| "libmemcached/connect.hpp", |
| "libmemcached/continuum.hpp", |
| "libmemcached/csl/common.h", |
| "libmemcached/csl/context.cc", |
| "libmemcached/csl/context.h", |
| "libmemcached/csl/parser.cc", |
| "libmemcached/csl/parser.h", |
| "libmemcached/csl/scanner.cc", |
| "libmemcached/csl/scanner.h", |
| "libmemcached/csl/server.h", |
| "libmemcached/csl/symbol.h", |
| "libmemcached/delete.cc", |
| "libmemcached/do.cc", |
| "libmemcached/do.hpp", |
| "libmemcached/dump.cc", |
| "libmemcached/encoding_key.cc", |
| "libmemcached/encoding_key.h", |
| "libmemcached/error.cc", |
| "libmemcached/error.hpp", |
| "libmemcached/exist.cc", |
| "libmemcached/fetch.cc", |
| "libmemcached/flag.cc", |
| "libmemcached/flag.hpp", |
| "libmemcached/flush.cc", |
| "libmemcached/flush_buffers.cc", |
| "libmemcached/get.cc", |
| "libmemcached/hash.cc", |
| "libmemcached/hash.hpp", |
| "libmemcached/hosts.cc", |
| "libmemcached/initialize_query.cc", |
| "libmemcached/initialize_query.h", |
| "libmemcached/instance.cc", |
| "libmemcached/instance.hpp", |
| "libmemcached/internal.h", |
| "libmemcached/io.cc", |
| "libmemcached/io.h", |
| "libmemcached/io.hpp", |
| "libmemcached/is.h", |
| "libmemcached/key.cc", |
| "libmemcached/key.hpp", |
| "libmemcached/libmemcached_probes.h", |
| "libmemcached/memcached.cc", |
| "libmemcached/memcached.h", |
| "libmemcached/memcached.hpp", |
| "libmemcached/memcached/protocol_binary.h", |
| "libmemcached/memcached/vbucket.h", |
| "libmemcached/memory.h", |
| "libmemcached/namespace.cc", |
| "libmemcached/namespace.h", |
| "libmemcached/options.cc", |
| "libmemcached/options.hpp", |
| "libmemcached/parse.cc", |
| "libmemcached/poll.cc", |
| "libmemcached/poll.h", |
| "libmemcached/purge.cc", |
| "libmemcached/quit.cc", |
| "libmemcached/quit.hpp", |
| "libmemcached/response.cc", |
| "libmemcached/response.h", |
| "libmemcached/result.cc", |
| "libmemcached/result.h", |
| "libmemcached/sasl.cc", |
| "libmemcached/sasl.hpp", |
| "libmemcached/server.cc", |
| "libmemcached/server.hpp", |
| "libmemcached/server_instance.h", |
| "libmemcached/server_list.cc", |
| "libmemcached/server_list.hpp", |
| "libmemcached/socket.hpp", |
| "libmemcached/stats.cc", |
| "libmemcached/storage.cc", |
| "libmemcached/strerror.cc", |
| "libmemcached/string.cc", |
| "libmemcached/string.hpp", |
| "libmemcached/touch.cc", |
| "libmemcached/udp.cc", |
| "libmemcached/udp.hpp", |
| "libmemcached/util.h", |
| "libmemcached/verbosity.cc", |
| "libmemcached/version.cc", |
| "libmemcached/version.hpp", |
| "libmemcached/virtual_bucket.c", |
| "libmemcached/virtual_bucket.h", |
| "libmemcached/watchpoint.h", |
| "libmemcached/windows.hpp", |
| "util/string.hpp", |
| ], |
| hdrs = ["headers/{}".format(hdr) for hdr in LIBMEMCACHED_HEADERS] + [ |
| "headers/libmemcached-1.0/configure.h", |
| ], |
| copts = [ |
| "-DBUILDING_MEMCACHED", |
| "-Wno-deprecated-register", |
| ] + select({ |
| "@io_kythe//:darwin": [], |
| "//conditions:default": [ |
| "-DHAVE_MSG_MORE=1", |
| "-DHAVE_MSG_NOSIGNAL=1", |
| "-DSTRERROR_R_CHAR_P=1", |
| ], |
| }), |
| includes = ["headers"], |
| visibility = ["//visibility:public"], |
| deps = [ |
| ":config", |
| ":libhashkit", |
| ":libmemcachedprotocol", |
| ], |
| ) |