brotli/BUILD

225 lines
4.6 KiB
Python
Raw Normal View History

# Description:
# Brotli is a generic-purpose lossless compression algorithm.
package(
default_visibility = ["//visibility:public"],
)
licenses(["notice"]) # MIT
exports_files(["LICENSE"])
# >>> 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"],
)
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"],
)
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"],
":windows_msys": ["@openjdk_win//:jni_md_h"],
":windows_msvc": ["@openjdk_win//:jni_md_h"],
":windows": ["@openjdk_win//: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",
],
includes = ["jni"],
)
# <<< JNI headers
STRICT_C_OPTIONS = [
"--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"]),
)
2016-06-24 13:32:51 +00:00
filegroup(
name = "common_headers",
srcs = glob(["c/common/*.h"]),
2016-06-24 13:32:51 +00:00
)
2016-06-24 13:32:51 +00:00
filegroup(
name = "common_sources",
srcs = glob(["c/common/*.c"]),
2016-06-24 13:32:51 +00:00
)
2016-06-24 13:32:51 +00:00
filegroup(
name = "dec_headers",
srcs = glob(["c/dec/*.h"]),
2016-06-24 13:32:51 +00:00
)
2016-06-24 13:32:51 +00:00
filegroup(
name = "dec_sources",
srcs = glob(["c/dec/*.c"]),
2016-06-24 13:32:51 +00:00
)
2016-06-24 13:32:51 +00:00
filegroup(
name = "enc_headers",
srcs = glob(["c/enc/*.h"]),
2016-06-24 13:32:51 +00:00
)
2016-06-24 13:32:51 +00:00
filegroup(
name = "enc_sources",
srcs = glob(["c/enc/*.c"]),
2016-06-24 13:32:51 +00:00
)
cc_library(
name = "brotli_inc",
2016-08-23 12:40:33 +00:00
hdrs = [":public_headers"],
copts = STRICT_C_OPTIONS,
includes = ["c/include"],
2016-08-23 12:40:33 +00:00
)
cc_library(
name = "brotlicommon",
2016-06-24 13:32:51 +00:00
srcs = [":common_sources"],
2016-08-23 12:40:33 +00:00
hdrs = [":common_headers"],
copts = STRICT_C_OPTIONS,
deps = [":brotli_inc"],
)
cc_library(
name = "brotlidec",
2016-06-24 13:32:51 +00:00
srcs = [":dec_sources"],
2016-08-23 12:40:33 +00:00
hdrs = [":dec_headers"],
copts = STRICT_C_OPTIONS,
deps = [":brotlicommon"],
)
cc_library(
name = "brotlienc",
2016-06-24 13:32:51 +00:00
srcs = [":enc_sources"],
2016-08-23 12:40:33 +00:00
hdrs = [":enc_headers"],
copts = STRICT_C_OPTIONS,
linkopts = ["-lm"],
deps = [":brotlicommon"],
)
cc_binary(
name = "brotli",
srcs = ["c/tools/brotli.c"],
copts = STRICT_C_OPTIONS,
2016-06-24 13:32:51 +00:00
linkstatic = 1,
deps = [
":brotlidec",
":brotlienc",
],
)
2017-06-01 11:51:18 +00:00
########################################################
# WARNING: do not (transitively) depend on this target!
########################################################
cc_binary(
name = "brotli_jni.dll",
2017-06-01 11:51:18 +00:00
srcs = [
":common_headers",
2017-06-01 11:51:18 +00:00
":common_sources",
":dec_headers",
2017-06-01 11:51:18 +00:00
":dec_sources",
":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",
],
linkshared = 1,
2017-06-01 11:51:18 +00:00
)
########################################################
# WARNING: do not (transitively) depend on this target!
########################################################
cc_binary(
name = "brotli_jni_no_dictionary_data.dll",
2017-06-01 11:51:18 +00:00
srcs = [
":common_headers",
2017-06-01 11:51:18 +00:00
":common_sources",
":dec_headers",
2017-06-01 11:51:18 +00:00
":dec_sources",
":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",
],
linkshared = 1,
2017-06-01 11:51:18 +00:00
)
filegroup(
name = "dictionary",
srcs = ["c/common/dictionary.bin"],
)
load("@io_bazel_rules_go//go:def.bzl", "go_prefix")
go_prefix("github.com/google/brotli")