github.com/stackb/rules_proto@v0.0.0-20240221195024-5428336c51f1/third_party/zlib.BUILD (about)

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