licenses(["notice"])  # Apache 2

package(default_visibility = ["//visibility:public"])

cc_library(
    name = "ares",
    hdrs = glob(["thirdparty_build/include/ares*.h"]),
    copts = [],
    linkopts = ["-lcares"],
)

cc_library(
    name = "benchmark",
    hdrs = glob(["thirdparty_build/include/benchmark/benchmark.h"]),
    copts = [],
    linkopts = [],
)

cc_library(
    name = "event",
    hdrs = glob(["thirdparty_build/include/event2/**/*.h"]),
    copts = ["-pthread"],
    linkopts = ["-levent_pthreads", "-levent"],
)

cc_library(
    name = "luajit",
    hdrs = glob(["thirdparty_build/include/luajit-5_1-2.1/*"]),
    # TODO(mattklein123): We should strip luajit-2.0 here for consumers. However, if we do that
    # the headers get included using -I vs. -isystem which then causes old-style-cast warnings.
    copts = ["-I/usr/include/luajit-5_1-2.1"],
    linkopts = ["-lluajit-5.1"],
)

cc_library(
    name = "nghttp2",
    hdrs = glob(["thirdparty_build/include/nghttp2/**/*.h"]),
    copts = [],
    linkopts = ["-lnghttp2"],
)

cc_library(
    name = "tcmalloc_and_profiler",
    hdrs = glob(["thirdparty_build/include/gperftools/**/*.h"]),
    copts = [],
    linkopts = ["-ltcmalloc", "-lprofiler"],
)

cc_library(
    name = "yaml_cpp",
    hdrs = glob(["thirdparty_build/include/yaml-cpp/**/*.h"]),
    copts = [],
    linkopts = ["-lyaml-cpp"],
)

cc_library(
    name = "zlib",
    hdrs = glob([
        "thirdparty_build/include/zconf.h",
        "thirdparty_build/include/zlib.h",
    ]),
    copts = [],
    linkopts = ["-lz"],
)

cc_library(
    name = "ssl",
    hdrs = glob([
        "thirdparty_build/include/boringssl/**/*.h",
    ]),
    copts = ["-I/usr/include/boringssl"],
    linkopts = ["-lboringssl_crypto", "-lboringssl_decrepit", "-lboringssl_ssl"],
)

cc_library(
    name = "jwt_verify_lib",
    hdrs = glob(["thirdparty_build/include/jwt_verify_lib/**/*.h"]),
    copts = ["-I/usr/include/jwt_verify_lib"],
    linkopts = ["-ljwt_verify_lib"],
    deps = [":abseil_time"],
)

cc_library(
    name = "openssl",
    hdrs = glob(["thirdparty_build/include/openssl/**/+.h"]),
    copts = ["-DOPENSSL_LOAD_CONF"],
    linkopts = ["-lssl", "-lcrypto"],
)

cc_library(
    name = "abseil_any",
    hdrs = glob(["thirdparty_build/include/absl/**/*.h"]),
    copts = ["-I/usr/include/absl"],
    linkopts = ["-labsl_types_libbad_any_cast_impl"],
)

cc_library(
    name = "abseil_base",
    hdrs = glob(["thirdparty_build/include/absl/**/*.h"]),
    copts = ["-I/usr/include/absl"],
    linkopts = [
        "-labsl_base_libbase",
        "-labsl_base_libdynamic_annotations",
        "-labsl_base_libexception_safety_testing",
        "-labsl_base_libmalloc_internal",
        "-labsl_base_libspinlock_wait",
        "-labsl_base_libthrow_delegate",
        "-lgtest",
    ],
)

cc_library(
    name = "abseil_flat_hash_map",
    hdrs = glob(["thirdparty_build/include/absl/**/*.h"]),
    copts = ["-I/usr/include/absl"],
    linkopts = [
        "-labsl_container_libhash_generator_testing",
        "-labsl_container_libraw_hash_set",
        "-labsl_hash_libcity",
        "-labsl_hash_libhash",
    ],
)

cc_library(
    name = "abseil_flat_hash_set",
    hdrs = glob(["thirdparty_build/include/absl/**/*.h"]),
    copts = ["-I/usr/include/absl"],
    linkopts = [
        "-labsl_container_libhash_generator_testing",
        "-labsl_container_libraw_hash_set",
        "-labsl_hash_libcity",
        "-labsl_hash_libhash",
    ],
)

cc_library(
    name = "abseil_strings",
    hdrs = glob(["thirdparty_build/include/absl/**/*.h"]),
    copts = ["-I/usr/include/absl"],
    linkopts = [
        "-labsl_strings_libinternal",
        "-labsl_strings_libstr_format_internal",
        "-labsl_strings_libstrings",
    ],
)

cc_library(
    name = "abseil_int128",
    hdrs = glob(["thirdparty_build/include/absl/**/*.h"]),
    copts = ["-I/usr/include/absl"],
    linkopts = ["-labsl_numeric_libint128"],
)

cc_library(
    name = "abseil_optional",
    hdrs = glob(["thirdparty_build/include/absl/**/*.h"]),
    copts = ["-I/usr/include/absl"],
    linkopts = ["-labsl_types_libbad_optional_access", "-labsl_types_liboptional"],
)

cc_library(
    name = "abseil_synchronization",
    hdrs = glob(["thirdparty_build/include/absl/**/*.h"]),
    copts = ["-I/usr/include/absl"],
    linkopts = [
        "-labsl_synchronization_libgraphcycles_internal",
        "-labsl_synchronization_libper_thread_sem_test_common",
        "-labsl_synchronization_libsynchronization",
        "-lgtest",
    ],
)

cc_library(
    name = "abseil_symbolize",
    hdrs = glob(["thirdparty_build/include/absl/**/*.h"]),
    copts = ["-I/usr/include/absl"],
    linkopts = [
        "-labsl_debugging_libdebugging_internal",
        "-labsl_debugging_libdemangle_internal",
        "-labsl_debugging_libstacktrace",
        "-labsl_debugging_libsymbolize",
    ],
)

cc_library(
    name = "abseil_time",
    hdrs = glob(["thirdparty_build/include/absl/**/*.h"]),
    copts = ["-I/usr/include/absl"],
    linkopts = [
        "-labsl_time_internal_cctz_libcivil_time",
        "-labsl_time_internal_cctz_libtime_zone",
        "-labsl_time_libtest_util",
        "-labsl_time_libtime",
    ],
)

cc_library(
    name = "fmtlib",
    hdrs = glob(["thirdparty_build/include/fmt/**/*.h"]),
    copts = ["-I/usr/include/fmt"],
    linkopts = ["-lfmt"],
    defines = ["FMT_HEADER_ONLY"],
)

cc_library(
    name = "spdlog",
    hdrs = glob(["thirdparty_build/include/spdlog/**/*.h"]),
    copts = ["-I/usr/include/spdlog"],
    linkopts = [],
    deps = [":fmtlib"],
    defines = ["SPDLOG_FMT_EXTERNAL"],
)

cc_library(
    name = "backward",
    hdrs = glob(["thirdparty_build/include/backward.hpp"]),
    copts = [],
    linkopts = [],
)

cc_library(
    name = "dd_opentracing_cpp",
    hdrs = glob(["thirdparty_build/include/datadog/**/*.h"]),
    copts = ["-I/usr/include/datadog"],
    linkopts = ["-ldd_opentracing"],
)

cc_library(
    name = "http_parser",
    hdrs = glob(["thirdparty_build/include/http_parser.h"]),
    copts = [],
    linkopts = ["-lhttp_parser"],
)

cc_library(
    name = "libprotobuf_mutator",
    hdrs = glob(["thirdparty_build/include/libprotobuf-mutator"]),
    copts = ["-I/usr/include/libprotobuf-mutator"],
    linkopts = ["-lprotobuf-mutator", "-lprotobuf-mutator-libfuzzer"],
)

cc_library(
    name = "rapidjson",
    hdrs = glob(["thirdparty_build/include/rapidjson/**/*.h"]),
    copts = ["-I/usr/include/rapidjson"],
    linkopts = [],
)

cc_library(
    name = "tclap",
    hdrs = glob(["thirdparty_build/include/tclap/**/*.h"]),
    copts = ["-I/usr/include/tclap"],
    linkopts = [],
)

cc_library(
    name = "xxhash",
    hdrs = glob(["thirdparty_build/include/xxhash.h"]),
    copts = [],
    linkopts = ["-lxxhash"],
)

cc_library(
    name = "libcircllhist",
    hdrs = glob(["thirdparty_build/include/circllhist.h"]),
    copts = [],
    linkopts = ["-lcircllhist"],
)

cc_library(
    name = "googletest",
    hdrs = glob([
        "thirdparty_build/include/gmock/**/*.h",
        "thirdparty_build/include/gtest/**/*.h",
    ]),
    copts = ["-I/usr/include/gtest"],
    linkopts = [
        "-lgmock",
        "-lgmock_main",
        "-lgtest",
        "-lgtest_main",
    ],
)

py_library(
    name = "six",
)
