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

licenses(["notice"])

COMMON_DEFINES = ["ZSTD_MULTITHREAD"]

cc_library(
    name = "zstd",
    srcs = [
        "lib/common/bitstream.h",
        "lib/common/compiler.h",
        "lib/common/cpu.h",
        "lib/common/debug.c",
        "lib/common/debug.h",
        "lib/common/entropy_common.c",
        "lib/common/error_private.c",
        "lib/common/error_private.h",
        "lib/common/fse.h",
        "lib/common/fse_decompress.c",
        "lib/common/huf.h",
        "lib/common/mem.h",
        "lib/common/pool.c",
        "lib/common/pool.h",
        "lib/common/portability_macros.h",
        "lib/common/threading.c",
        "lib/common/threading.h",
        "lib/common/xxhash.c",
        "lib/common/xxhash.h",
        "lib/common/zstd_common.c",
        "lib/common/zstd_deps.h",
        "lib/common/zstd_internal.h",
        "lib/common/zstd_trace.h",
        "lib/compress/clevels.h",
        "lib/compress/fse_compress.c",
        "lib/compress/hist.c",
        "lib/compress/hist.h",
        "lib/compress/huf_compress.c",
        "lib/compress/zstd_compress.c",
        "lib/compress/zstd_compress_internal.h",
        "lib/compress/zstd_compress_literals.c",
        "lib/compress/zstd_compress_literals.h",
        "lib/compress/zstd_compress_sequences.c",
        "lib/compress/zstd_compress_sequences.h",
        "lib/compress/zstd_compress_superblock.c",
        "lib/compress/zstd_compress_superblock.h",
        "lib/compress/zstd_cwksp.h",
        "lib/compress/zstd_double_fast.c",
        "lib/compress/zstd_double_fast.h",
        "lib/compress/zstd_fast.c",
        "lib/compress/zstd_fast.h",
        "lib/compress/zstd_lazy.c",
        "lib/compress/zstd_lazy.h",
        "lib/compress/zstd_ldm.c",
        "lib/compress/zstd_ldm.h",
        "lib/compress/zstd_ldm_geartab.h",
        "lib/compress/zstd_opt.c",
        "lib/compress/zstd_opt.h",
        "lib/compress/zstdmt_compress.c",
        "lib/compress/zstdmt_compress.h",
        "lib/decompress/huf_decompress.c",
        "lib/decompress/zstd_ddict.c",
        "lib/decompress/zstd_ddict.h",
        "lib/decompress/zstd_decompress.c",
        "lib/decompress/zstd_decompress_block.c",
        "lib/decompress/zstd_decompress_block.h",
        "lib/decompress/zstd_decompress_internal.h",
        "lib/dictBuilder/cover.c",
        "lib/dictBuilder/cover.h",
        "lib/dictBuilder/divsufsort.c",
        "lib/dictBuilder/divsufsort.h",
        "lib/dictBuilder/fastcover.c",
        "lib/dictBuilder/zdict.c",
        "lib/legacy/zstd_legacy.h",
        "lib/legacy/zstd_v01.c",
        "lib/legacy/zstd_v01.h",
        "lib/legacy/zstd_v02.c",
        "lib/legacy/zstd_v02.h",
        "lib/legacy/zstd_v03.c",
        "lib/legacy/zstd_v03.h",
        "lib/legacy/zstd_v04.c",
        "lib/legacy/zstd_v04.h",
        "lib/legacy/zstd_v05.c",
        "lib/legacy/zstd_v05.h",
        "lib/legacy/zstd_v06.c",
        "lib/legacy/zstd_v06.h",
        "lib/legacy/zstd_v07.c",
        "lib/legacy/zstd_v07.h",
    ] + select({
        "@//tools:windows": [],
        "//conditions:default": ["lib/decompress/huf_decompress_amd64.S"],
    }),
    hdrs = [
        "lib/zdict.h",
        "lib/zstd.h",
        "lib/zstd_errors.h",
    ],
    defines = COMMON_DEFINES,
    includes = ["lib"],
)
