Debian Codegraph @

extra/protobuf/protobuf-24.4/third_party/zlib.BUILD

raw
1 load("@rules_cc//cc:defs.bzl", "cc_library")
2
3 licenses(["notice"]) # BSD/MIT-like license (for zlib)
4
5 exports_files(["zlib.BUILD"])
6
7 _ZLIB_HEADERS = [
8 "crc32.h",
9 "deflate.h",
10 "gzguts.h",
11 "inffast.h",
12 "inffixed.h",
13 "inflate.h",
14 "inftrees.h",
15 "trees.h",
16 "zconf.h",
17 "zlib.h",
18 "zutil.h",
19 ]
20
21 _ZLIB_PREFIXED_HEADERS = ["zlib/include/" + hdr for hdr in _ZLIB_HEADERS]
22
23 # In order to limit the damage from the `includes` propagation
24 # via `:zlib`, copy the public headers to a subdirectory and
25 # expose those.
26 genrule(
27 name = "copy_public_headers",
28 srcs = _ZLIB_HEADERS,
29 outs = _ZLIB_PREFIXED_HEADERS,
30 cmd_bash = "cp $(SRCS) $(@D)/zlib/include/",
31 cmd_bat = " && ".join(
32 ["@copy /Y $(location %s) $(@D)\\zlib\\include\\ >NUL" %
33 s for s in _ZLIB_HEADERS],
34 ),
35 )
36
37 cc_library(
38 name = "zlib",
39 srcs = [
40 "adler32.c",
41 "compress.c",
42 "crc32.c",
43 "deflate.c",
44 "gzclose.c",
45 "gzlib.c",
46 "gzread.c",
47 "gzwrite.c",
48 "infback.c",
49 "inffast.c",
50 "inflate.c",
51 "inftrees.c",
52 "trees.c",
53 "uncompr.c",
54 "zutil.c",
55 # Include the un-prefixed headers in srcs to work
56 # around the fact that zlib isn't consistent in its
57 # choice of <> or "" delimiter when including itself.
58 ] + _ZLIB_HEADERS,
59 hdrs = _ZLIB_PREFIXED_HEADERS,
60 copts = select({
61 "@bazel_tools//src/conditions:windows": [],
62 "//conditions:default": [
63 "-Wno-deprecated-non-prototype",
64 "-Wno-unused-variable",
65 "-Wno-implicit-function-declaration",
66 ],
67 }),
68 includes = ["zlib/include/"],
69 visibility = ["//visibility:public"],
70 )