1# Description: 2# Brotli is a generic-purpose lossless compression algorithm. 3 4package( 5 default_visibility = ["//visibility:public"], 6) 7 8licenses(["notice"]) # MIT 9 10exports_files(["LICENSE"]) 11 12config_setting( 13 name = "darwin", 14 values = {"cpu": "darwin"}, 15 visibility = ["//visibility:public"], 16) 17 18config_setting( 19 name = "darwin_x86_64", 20 values = {"cpu": "darwin_x86_64"}, 21 visibility = ["//visibility:public"], 22) 23 24config_setting( 25 name = "windows", 26 values = {"cpu": "x64_windows"}, 27 visibility = ["//visibility:public"], 28) 29 30config_setting( 31 name = "windows_msvc", 32 values = {"cpu": "x64_windows_msvc"}, 33 visibility = ["//visibility:public"], 34) 35 36config_setting( 37 name = "windows_msys", 38 values = {"cpu": "x64_windows_msys"}, 39 visibility = ["//visibility:public"], 40) 41 42load(":compiler_config_setting.bzl", "create_msvc_config") 43 44create_msvc_config() 45 46STRICT_C_OPTIONS = select({ 47 ":msvc": [], 48 "//conditions:default": [ 49 "--pedantic-errors", 50 "-Wall", 51 "-Wconversion", 52 "-Werror", 53 "-Wextra", 54 "-Wlong-long", 55 "-Wmissing-declarations", 56 "-Wmissing-prototypes", 57 "-Wno-strict-aliasing", 58 "-Wshadow", 59 "-Wsign-compare", 60 ], 61}) 62 63filegroup( 64 name = "public_headers", 65 srcs = glob(["c/include/brotli/*.h"]), 66) 67 68filegroup( 69 name = "common_headers", 70 srcs = glob(["c/common/*.h"]), 71) 72 73filegroup( 74 name = "common_sources", 75 srcs = glob(["c/common/*.c"]), 76) 77 78filegroup( 79 name = "dec_headers", 80 srcs = glob(["c/dec/*.h"]), 81) 82 83filegroup( 84 name = "dec_sources", 85 srcs = glob(["c/dec/*.c"]), 86) 87 88filegroup( 89 name = "enc_headers", 90 srcs = glob(["c/enc/*.h"]), 91) 92 93filegroup( 94 name = "enc_sources", 95 srcs = glob(["c/enc/*.c"]), 96) 97 98cc_library( 99 name = "brotli_inc", 100 hdrs = [":public_headers"], 101 copts = STRICT_C_OPTIONS, 102 strip_include_prefix = "c/include", 103) 104 105cc_library( 106 name = "brotlicommon", 107 srcs = [":common_sources"], 108 hdrs = [":common_headers"], 109 copts = STRICT_C_OPTIONS, 110 deps = [":brotli_inc"], 111) 112 113cc_library( 114 name = "brotlidec", 115 srcs = [":dec_sources"], 116 hdrs = [":dec_headers"], 117 copts = STRICT_C_OPTIONS, 118 deps = [":brotlicommon"], 119) 120 121cc_library( 122 name = "brotlienc", 123 srcs = [":enc_sources"], 124 hdrs = [":enc_headers"], 125 copts = STRICT_C_OPTIONS, 126 linkopts = ["-lm"], 127 deps = [":brotlicommon"], 128) 129 130cc_binary( 131 name = "brotli", 132 srcs = ["c/tools/brotli.c"], 133 copts = STRICT_C_OPTIONS, 134 linkstatic = 1, 135 deps = [ 136 ":brotlidec", 137 ":brotlienc", 138 ], 139) 140 141filegroup( 142 name = "dictionary", 143 srcs = ["c/common/dictionary.bin"], 144) 145