Edit

kc3-lang/brotli/BUILD

Branch :

  • Show log

    Commit

  • Author : Eugene Kliuchnikov
    Date : 2019-04-12 13:57:42
    Hash : 4b2b2d4f
    Message : Update (#749) Update: * Bazel: fix MSVC configuration * C: common: extended documentation and helpers around distance codes * C: common: enable BROTLI_DCHECK in "debug" builds * C: common: fix implicit trailing zero in `kPrefixSuffix` * C: dec: fix possible bit reader discharge for "large-window" mode * C: dec: simplify distance decoding via lookup table * C: dec: reuse decoder state members memory via union with lookup table * C: dec: add decoder state diagram * C: enc: clarify access to static dictionary * C: enc: improve static dictionary hash * C: enc: add "stream offset" parameter for parallel encoding * C: enc: reorganize hasher; now Q2-Q3 require exactly 256KiB to avoid global TCMalloc lock * C: enc: fix rare access to uninitialized data in ring-buffer * C: enc: reorganize logging / checks in `write_bits.h` * Java: dec: add "large-window" support * Java: dec: improve speed * Java: dec: debug and 32-bit mode are now activated via system properties * Java: dec: demystify some state variables (use better names) * Dictionary generator: add single input mode * Java: dec: modernize tests * Bazel: js: pick working commit for closure rules

  • BUILD
  • # Description:
    #   Brotli is a generic-purpose lossless compression algorithm.
    
    package(
        default_visibility = ["//visibility:public"],
    )
    
    licenses(["notice"])  # MIT
    
    exports_files(["LICENSE"])
    
    config_setting(
        name = "darwin",
        values = {"cpu": "darwin"},
        visibility = ["//visibility:public"],
    )
    
    config_setting(
        name = "darwin_x86_64",
        values = {"cpu": "darwin_x86_64"},
        visibility = ["//visibility:public"],
    )
    
    config_setting(
        name = "windows",
        values = {"cpu": "x64_windows"},
        visibility = ["//visibility:public"],
    )
    
    config_setting(
        name = "windows_msvc",
        values = {"cpu": "x64_windows_msvc"},
        visibility = ["//visibility:public"],
    )
    
    config_setting(
        name = "windows_msys",
        values = {"cpu": "x64_windows_msys"},
        visibility = ["//visibility:public"],
    )
    
    load(":compiler_config_setting.bzl", "create_msvc_config")
    
    create_msvc_config()
    
    STRICT_C_OPTIONS = select({
        ":msvc": [],
        "//conditions:default": [
            "--pedantic-errors",
            "-Wall",
            "-Wconversion",
            "-Werror",
            "-Wextra",
            "-Wlong-long",
            "-Wmissing-declarations",
            "-Wmissing-prototypes",
            "-Wno-strict-aliasing",
            "-Wshadow",
            "-Wsign-compare",
        ],
    })
    
    filegroup(
        name = "public_headers",
        srcs = glob(["c/include/brotli/*.h"]),
    )
    
    filegroup(
        name = "common_headers",
        srcs = glob(["c/common/*.h"]),
    )
    
    filegroup(
        name = "common_sources",
        srcs = glob(["c/common/*.c"]),
    )
    
    filegroup(
        name = "dec_headers",
        srcs = glob(["c/dec/*.h"]),
    )
    
    filegroup(
        name = "dec_sources",
        srcs = glob(["c/dec/*.c"]),
    )
    
    filegroup(
        name = "enc_headers",
        srcs = glob(["c/enc/*.h"]),
    )
    
    filegroup(
        name = "enc_sources",
        srcs = glob(["c/enc/*.c"]),
    )
    
    cc_library(
        name = "brotli_inc",
        hdrs = [":public_headers"],
        copts = STRICT_C_OPTIONS,
        includes = ["c/include"],
    )
    
    cc_library(
        name = "brotlicommon",
        srcs = [":common_sources"],
        hdrs = [":common_headers"],
        copts = STRICT_C_OPTIONS,
        deps = [":brotli_inc"],
    )
    
    cc_library(
        name = "brotlidec",
        srcs = [":dec_sources"],
        hdrs = [":dec_headers"],
        copts = STRICT_C_OPTIONS,
        deps = [":brotlicommon"],
    )
    
    cc_library(
        name = "brotlienc",
        srcs = [":enc_sources"],
        hdrs = [":enc_headers"],
        copts = STRICT_C_OPTIONS,
        linkopts = ["-lm"],
        deps = [":brotlicommon"],
    )
    
    cc_binary(
        name = "brotli",
        srcs = ["c/tools/brotli.c"],
        copts = STRICT_C_OPTIONS,
        linkstatic = 1,
        deps = [
            ":brotlidec",
            ":brotlienc",
        ],
    )
    
    filegroup(
        name = "dictionary",
        srcs = ["c/common/dictionary.bin"],
    )