mirror of
https://github.com/google/brotli.git
synced 2024-11-09 21:50:07 +00:00
1e7ea1d8e6
* Inverse bazel workspace tree. Now each subproject directly depends on root (c) project. This helps to mitigate Bazel bug bazelbuild/bazel#2391; short summary: Bazel does not work if referenced subproject `WORKSPACE` uses any repositories that embedding project does not. Bright side: building C project is much faster; no need to download closure, go and JDK...
147 lines
2.7 KiB
Python
147 lines
2.7 KiB
Python
# 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"],
|
|
)
|
|
|
|
config_setting(
|
|
name = "msvc",
|
|
values = {"compiler": "msvc-cl"},
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
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"],
|
|
)
|