2016-06-16 08:52:57 +00:00
|
|
|
# Description:
|
|
|
|
# Brotli is a generic-purpose lossless compression algorithm.
|
|
|
|
|
|
|
|
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
|
|
|
# >>> JNI headers
|
|
|
|
|
|
|
|
config_setting(
|
|
|
|
name = "darwin",
|
|
|
|
values = {"cpu": "darwin"},
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
config_setting(
|
|
|
|
name = "darwin_x86_64",
|
|
|
|
values = {"cpu": "darwin_x86_64"},
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "copy_link_jni_header",
|
|
|
|
srcs = ["@openjdk_linux//:jni_h"],
|
|
|
|
outs = ["jni/jni.h"],
|
|
|
|
cmd = "cp -f $< $@",
|
|
|
|
)
|
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "copy_link_jni_md_header",
|
|
|
|
srcs = select({
|
|
|
|
":darwin": ["@openjdk_macos//:jni_md_h"],
|
|
|
|
":darwin_x86_64": ["@openjdk_macos//:jni_md_h"],
|
|
|
|
"//conditions:default": ["@openjdk_linux//:jni_md_h"],
|
|
|
|
}),
|
|
|
|
outs = ["jni/jni_md.h"],
|
|
|
|
cmd = "cp -f $< $@",
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "jni_inc",
|
2017-06-01 11:51:18 +00:00
|
|
|
hdrs = [
|
|
|
|
":jni/jni.h",
|
|
|
|
":jni/jni_md.h",
|
|
|
|
],
|
2017-05-29 15:55:14 +00:00
|
|
|
includes = ["jni"],
|
|
|
|
)
|
|
|
|
|
|
|
|
# <<< JNI headers
|
|
|
|
|
2016-06-17 14:24:51 +00:00
|
|
|
STRICT_C_OPTIONS = [
|
2016-06-16 08:52:57 +00:00
|
|
|
"--pedantic-errors",
|
|
|
|
"-Wall",
|
|
|
|
"-Wconversion",
|
|
|
|
"-Werror",
|
|
|
|
"-Wextra",
|
|
|
|
"-Wlong-long",
|
|
|
|
"-Wmissing-declarations",
|
2016-06-17 14:24:51 +00:00
|
|
|
"-Wmissing-prototypes",
|
2016-06-16 08:52:57 +00:00
|
|
|
"-Wno-strict-aliasing",
|
|
|
|
"-Wshadow",
|
|
|
|
"-Wsign-compare",
|
|
|
|
]
|
|
|
|
|
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,
|
2017-04-23 12:07:08 +00:00
|
|
|
includes = ["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,
|
2016-08-29 09:32:12 +00:00
|
|
|
linkopts = ["-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
|
|
|
########################################################
|
|
|
|
# WARNING: do not (transitively) depend on this target!
|
|
|
|
########################################################
|
2017-10-09 15:07:34 +00:00
|
|
|
cc_binary(
|
|
|
|
name = "brotli_jni.dll",
|
2017-06-01 11:51:18 +00:00
|
|
|
srcs = [
|
2017-10-09 15:07:34 +00:00
|
|
|
":common_headers",
|
2017-06-01 11:51:18 +00:00
|
|
|
":common_sources",
|
2017-10-09 15:07:34 +00:00
|
|
|
":dec_headers",
|
2017-06-01 11:51:18 +00:00
|
|
|
":dec_sources",
|
2017-10-09 15:07:34 +00:00
|
|
|
":enc_headers",
|
2017-06-01 11:51:18 +00:00
|
|
|
":enc_sources",
|
|
|
|
"//java/org/brotli/wrapper/common:jni_src",
|
|
|
|
"//java/org/brotli/wrapper/dec:jni_src",
|
|
|
|
"//java/org/brotli/wrapper/enc:jni_src",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":brotli_inc",
|
|
|
|
":jni_inc",
|
|
|
|
],
|
2017-10-09 15:07:34 +00:00
|
|
|
linkshared = 1,
|
2017-06-01 11:51:18 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
########################################################
|
|
|
|
# WARNING: do not (transitively) depend on this target!
|
|
|
|
########################################################
|
2017-10-09 15:07:34 +00:00
|
|
|
cc_binary(
|
|
|
|
name = "brotli_jni_no_dictionary_data.dll",
|
2017-06-01 11:51:18 +00:00
|
|
|
srcs = [
|
2017-10-09 15:07:34 +00:00
|
|
|
":common_headers",
|
2017-06-01 11:51:18 +00:00
|
|
|
":common_sources",
|
2017-10-09 15:07:34 +00:00
|
|
|
":dec_headers",
|
2017-06-01 11:51:18 +00:00
|
|
|
":dec_sources",
|
2017-10-09 15:07:34 +00:00
|
|
|
":enc_headers",
|
2017-06-01 11:51:18 +00:00
|
|
|
":enc_sources",
|
|
|
|
"//java/org/brotli/wrapper/common:jni_src",
|
|
|
|
"//java/org/brotli/wrapper/dec:jni_src",
|
|
|
|
"//java/org/brotli/wrapper/enc:jni_src",
|
|
|
|
],
|
|
|
|
defines = [
|
|
|
|
"BROTLI_EXTERNAL_DICTIONARY_DATA=",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":brotli_inc",
|
|
|
|
":jni_inc",
|
|
|
|
],
|
2017-10-09 15:07:34 +00:00
|
|
|
linkshared = 1,
|
2017-06-01 11:51:18 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
filegroup(
|
|
|
|
name = "dictionary",
|
|
|
|
srcs = ["c/common/dictionary.bin"],
|
|
|
|
)
|
|
|
|
|
2017-03-22 11:41:19 +00:00
|
|
|
load("@io_bazel_rules_go//go:def.bzl", "go_prefix")
|
|
|
|
|
|
|
|
go_prefix("github.com/google/brotli")
|