2016-06-16 08:52:57 +00:00
|
|
|
# Description:
|
|
|
|
# Brotli is a generic-purpose lossless compression algorithm.
|
|
|
|
|
2021-08-18 17:15:07 +00:00
|
|
|
load(":compiler_config_setting.bzl", "create_msvc_config")
|
|
|
|
|
2016-06-16 08:52:57 +00:00
|
|
|
package(
|
|
|
|
default_visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
licenses(["notice"]) # MIT
|
|
|
|
|
2016-08-24 02:58:51 +00:00
|
|
|
exports_files(["LICENSE"])
|
|
|
|
|
2017-05-29 15:55:14 +00:00
|
|
|
config_setting(
|
|
|
|
name = "darwin",
|
|
|
|
values = {"cpu": "darwin"},
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
config_setting(
|
|
|
|
name = "darwin_x86_64",
|
|
|
|
values = {"cpu": "darwin_x86_64"},
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2017-10-11 20:26:37 +00:00
|
|
|
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"],
|
|
|
|
)
|
|
|
|
|
2019-04-12 11:57:42 +00:00
|
|
|
create_msvc_config()
|
2018-03-29 08:37:07 +00:00
|
|
|
|
|
|
|
STRICT_C_OPTIONS = select({
|
|
|
|
":msvc": [],
|
2023-07-03 19:13:24 +00:00
|
|
|
":clang-cl": [
|
|
|
|
"/W4",
|
|
|
|
"-Wconversion",
|
|
|
|
"-Wlong-long",
|
|
|
|
"-Wmissing-declarations",
|
|
|
|
"-Wmissing-prototypes",
|
|
|
|
"-Wno-strict-aliasing",
|
|
|
|
"-Wshadow",
|
|
|
|
"-Wsign-compare",
|
|
|
|
"-Wno-sign-conversion",
|
|
|
|
],
|
2018-03-29 08:37:07 +00:00
|
|
|
"//conditions:default": [
|
|
|
|
"--pedantic-errors",
|
|
|
|
"-Wall",
|
|
|
|
"-Wconversion",
|
|
|
|
"-Werror",
|
|
|
|
"-Wextra",
|
|
|
|
"-Wlong-long",
|
|
|
|
"-Wmissing-declarations",
|
|
|
|
"-Wmissing-prototypes",
|
|
|
|
"-Wno-strict-aliasing",
|
|
|
|
"-Wshadow",
|
|
|
|
"-Wsign-compare",
|
|
|
|
],
|
|
|
|
})
|
2016-06-16 08:52:57 +00:00
|
|
|
|
2016-08-22 11:28:22 +00:00
|
|
|
filegroup(
|
|
|
|
name = "public_headers",
|
2017-04-23 12:07:08 +00:00
|
|
|
srcs = glob(["c/include/brotli/*.h"]),
|
2016-08-22 11:28:22 +00:00
|
|
|
)
|
|
|
|
|
2016-06-24 13:32:51 +00:00
|
|
|
filegroup(
|
|
|
|
name = "common_headers",
|
2017-04-23 12:07:08 +00:00
|
|
|
srcs = glob(["c/common/*.h"]),
|
2016-06-24 13:32:51 +00:00
|
|
|
)
|
2016-06-16 08:52:57 +00:00
|
|
|
|
2016-06-24 13:32:51 +00:00
|
|
|
filegroup(
|
|
|
|
name = "common_sources",
|
2017-04-23 12:07:08 +00:00
|
|
|
srcs = glob(["c/common/*.c"]),
|
2016-06-24 13:32:51 +00:00
|
|
|
)
|
2016-06-16 08:52:57 +00:00
|
|
|
|
2016-06-24 13:32:51 +00:00
|
|
|
filegroup(
|
|
|
|
name = "dec_headers",
|
2017-04-23 12:07:08 +00:00
|
|
|
srcs = glob(["c/dec/*.h"]),
|
2016-06-24 13:32:51 +00:00
|
|
|
)
|
2016-06-16 08:52:57 +00:00
|
|
|
|
2016-06-24 13:32:51 +00:00
|
|
|
filegroup(
|
|
|
|
name = "dec_sources",
|
2017-04-23 12:07:08 +00:00
|
|
|
srcs = glob(["c/dec/*.c"]),
|
2016-06-24 13:32:51 +00:00
|
|
|
)
|
2016-06-16 08:52:57 +00:00
|
|
|
|
2016-06-24 13:32:51 +00:00
|
|
|
filegroup(
|
|
|
|
name = "enc_headers",
|
2017-04-23 12:07:08 +00:00
|
|
|
srcs = glob(["c/enc/*.h"]),
|
2016-06-24 13:32:51 +00:00
|
|
|
)
|
2016-06-16 08:52:57 +00:00
|
|
|
|
2016-06-24 13:32:51 +00:00
|
|
|
filegroup(
|
|
|
|
name = "enc_sources",
|
2017-04-23 12:07:08 +00:00
|
|
|
srcs = glob(["c/enc/*.c"]),
|
2016-06-24 13:32:51 +00:00
|
|
|
)
|
2016-06-16 08:52:57 +00:00
|
|
|
|
2016-08-23 22:43:07 +00:00
|
|
|
cc_library(
|
2017-05-29 15:55:14 +00:00
|
|
|
name = "brotli_inc",
|
2016-08-23 12:40:33 +00:00
|
|
|
hdrs = [":public_headers"],
|
2016-08-23 22:43:07 +00:00
|
|
|
copts = STRICT_C_OPTIONS,
|
2019-07-16 15:49:14 +00:00
|
|
|
strip_include_prefix = "c/include",
|
2016-08-23 12:40:33 +00:00
|
|
|
)
|
|
|
|
|
2016-06-16 08:52:57 +00:00
|
|
|
cc_library(
|
2016-10-12 16:23:34 +00:00
|
|
|
name = "brotlicommon",
|
2016-06-24 13:32:51 +00:00
|
|
|
srcs = [":common_sources"],
|
2016-08-23 12:40:33 +00:00
|
|
|
hdrs = [":common_headers"],
|
2016-06-16 08:52:57 +00:00
|
|
|
copts = STRICT_C_OPTIONS,
|
2017-05-29 15:55:14 +00:00
|
|
|
deps = [":brotli_inc"],
|
2016-06-16 08:52:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
2016-10-12 16:23:34 +00:00
|
|
|
name = "brotlidec",
|
2016-06-24 13:32:51 +00:00
|
|
|
srcs = [":dec_sources"],
|
2016-08-23 12:40:33 +00:00
|
|
|
hdrs = [":dec_headers"],
|
2016-06-16 08:52:57 +00:00
|
|
|
copts = STRICT_C_OPTIONS,
|
2016-10-12 16:23:34 +00:00
|
|
|
deps = [":brotlicommon"],
|
2016-06-16 08:52:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
2016-10-12 16:23:34 +00:00
|
|
|
name = "brotlienc",
|
2016-06-24 13:32:51 +00:00
|
|
|
srcs = [":enc_sources"],
|
2016-08-23 12:40:33 +00:00
|
|
|
hdrs = [":enc_headers"],
|
2016-06-16 08:52:57 +00:00
|
|
|
copts = STRICT_C_OPTIONS,
|
2020-09-08 14:48:31 +00:00
|
|
|
linkopts = select({
|
2023-07-03 19:13:24 +00:00
|
|
|
":clang-cl": [],
|
2020-09-08 14:48:31 +00:00
|
|
|
":msvc": [],
|
|
|
|
"//conditions:default": ["-lm"],
|
|
|
|
}),
|
2016-10-12 16:23:34 +00:00
|
|
|
deps = [":brotlicommon"],
|
2016-06-16 08:52:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_binary(
|
2017-05-29 15:55:14 +00:00
|
|
|
name = "brotli",
|
|
|
|
srcs = ["c/tools/brotli.c"],
|
2016-06-17 14:24:51 +00:00
|
|
|
copts = STRICT_C_OPTIONS,
|
2016-06-24 13:32:51 +00:00
|
|
|
linkstatic = 1,
|
2016-06-16 08:52:57 +00:00
|
|
|
deps = [
|
2016-10-12 16:23:34 +00:00
|
|
|
":brotlidec",
|
|
|
|
":brotlienc",
|
2016-06-16 08:52:57 +00:00
|
|
|
],
|
|
|
|
)
|
2017-03-22 11:41:19 +00:00
|
|
|
|
2017-06-01 11:51:18 +00:00
|
|
|
filegroup(
|
|
|
|
name = "dictionary",
|
|
|
|
srcs = ["c/common/dictionary.bin"],
|
|
|
|
)
|