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 42config_setting( 43 name = "msvc", 44 values = {"compiler": "msvc-cl"}, 45 visibility = ["//visibility:public"], 46) 47 48STRICT_C_OPTIONS = select({ 49 ":msvc": [], 50 "//conditions:default": [ 51 "--pedantic-errors", 52 "-Wall", 53 "-Wconversion", 54 "-Werror", 55 "-Wextra", 56 "-Wlong-long", 57 "-Wmissing-declarations", 58 "-Wmissing-prototypes", 59 "-Wno-strict-aliasing", 60 "-Wshadow", 61 "-Wsign-compare", 62 ], 63}) 64 65filegroup( 66 name = "public_headers", 67 srcs = glob(["c/include/brotli/*.h"]), 68) 69 70filegroup( 71 name = "common_headers", 72 srcs = glob(["c/common/*.h"]), 73) 74 75filegroup( 76 name = "common_sources", 77 srcs = glob(["c/common/*.c"]), 78) 79 80filegroup( 81 name = "dec_headers", 82 srcs = glob(["c/dec/*.h"]), 83) 84 85filegroup( 86 name = "dec_sources", 87 srcs = glob(["c/dec/*.c"]), 88) 89 90filegroup( 91 name = "enc_headers", 92 srcs = glob(["c/enc/*.h"]), 93) 94 95filegroup( 96 name = "enc_sources", 97 srcs = glob(["c/enc/*.c"]), 98) 99 100cc_library( 101 name = "brotli_inc", 102 hdrs = [":public_headers"], 103 copts = STRICT_C_OPTIONS, 104 includes = ["c/include"], 105) 106 107cc_library( 108 name = "brotlicommon", 109 srcs = [":common_sources"], 110 hdrs = [":common_headers"], 111 copts = STRICT_C_OPTIONS, 112 deps = [":brotli_inc"], 113) 114 115cc_library( 116 name = "brotlidec", 117 srcs = [":dec_sources"], 118 hdrs = [":dec_headers"], 119 copts = STRICT_C_OPTIONS, 120 deps = [":brotlicommon"], 121) 122 123cc_library( 124 name = "brotlienc", 125 srcs = [":enc_sources"], 126 hdrs = [":enc_headers"], 127 copts = STRICT_C_OPTIONS, 128 linkopts = ["-lm"], 129 deps = [":brotlicommon"], 130) 131 132cc_binary( 133 name = "brotli", 134 srcs = ["c/tools/brotli.c"], 135 copts = STRICT_C_OPTIONS, 136 linkstatic = 1, 137 deps = [ 138 ":brotlidec", 139 ":brotlienc", 140 ], 141) 142 143filegroup( 144 name = "dictionary", 145 srcs = ["c/common/dictionary.bin"], 146) 147