| # Copyright 2022 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| """zlib is a general purpose data compression library.""" |
| |
| ZLIB_COPTS = [ |
| "-Wno-implicit-function-declaration", |
| "-Wno-conversion", |
| "-Wno-implicit-fallthrough", |
| "-Wno-strict-prototypes", |
| ] |
| |
| # This library exposes the headers both as the google3-preferred |
| # "third_party/zlib/zlib.h" as well as externally-typical <zlib.h>. |
| cc_library( |
| name = "zlibonly", |
| hdrs = [ |
| "zconf.h", |
| "zlib.h", |
| ], |
| copts = ZLIB_COPTS, |
| include_prefix = "third_party/zlib", |
| includes = ["."], |
| visibility = ["//visibility:public"], |
| deps = [":zlibonlyimpl"], |
| ) |
| |
| alias( |
| name = "zlibsystem", |
| actual = ":zlibonly", |
| visibility = ["//visibility:public"], |
| ) |
| |
| # If you add or remove source files from this list, you should make the |
| # same change in zlib.gyp. |
| ZLIB_SOURCES = [ |
| "adler32.c", |
| "compress.c", |
| "crc32.c", |
| "deflate.c", |
| "gzclose.c", |
| "gzlib.c", |
| "gzread.c", |
| "gzwrite.c", |
| "infback.c", |
| "inffast.c", |
| "inftrees.c", |
| "trees.c", |
| "uncompr.c", |
| "zutil.c", |
| ] + select({ |
| "//build/bazel/platforms/arch:arm64": glob([ |
| "contrib/optimizations/*.c", |
| ]), |
| "//conditions:default": ["inflate.c"], |
| }) |
| |
| ZLIB_HEADERS = glob( |
| [ |
| "*.h", |
| "contrib/optimizations/*.h", |
| ], |
| ) |
| |
| ZLIB_DEFINES = ["ZLIB_IMPLEMENTATION"] |
| |
| cc_library( |
| name = "zlibonlyimpl", |
| srcs = ZLIB_SOURCES, |
| copts = [ |
| "-Wno-implicit-function-declaration", |
| ] + ZLIB_COPTS, |
| includes = ["src"], |
| local_defines = ZLIB_DEFINES, |
| deps = [":zlibonly_internal_hdrs"], |
| ) |
| |
| cc_library( |
| name = "zlibonly_internal_hdrs", |
| textual_hdrs = ZLIB_HEADERS, |
| visibility = ["//visibility:private"], |
| ) |