[DFAJumpThreading] Remove incoming StartBlock from all phis when unfolding select...
[llvm-project.git] / utils / bazel / third_party_build / zlib-ng.BUILD
blobc41ea450fb1476b0ad1e98e86e00aa59376d240c
1 # This file is licensed under the Apache License v2.0 with LLVM Exceptions.
2 # See https://llvm.org/LICENSE.txt for license information.
3 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4 load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
5 load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
7 package(
8     default_visibility = ["//visibility:public"],
9     # BSD/MIT-like license (for zlib)
10     licenses = ["notice"],
13 bool_flag(
14     name = "llvm_enable_zlib",
15     build_setting_default = True,
18 config_setting(
19     name = "llvm_zlib_enabled",
20     flag_values = {":llvm_enable_zlib": "true"},
23 genrule(
24     # The input template is identical to the CMake output.
25     name = "zconf_gen",
26     srcs = ["zconf.h.in"],
27     outs = ["zconf.h"],
28     cmd = "cp $(SRCS) $(OUTS)",
31 cc_library(
32     name = "zlib",
33     srcs = select({
34         ":llvm_zlib_enabled": [
35             "adler32_p.h",
36             "chunkset_tpl.h",
37             "crc32_p.h",
38             "crc32_tbl.h",
39             "crc32_comb_tbl.h",
40             "deflate.h",
41             "deflate_p.h",
42             "functable.h",
43             "fallback_builtins.h",
44             "inffast.h",
45             "inffixed_tbl.h",
46             "inflate.h",
47             "inflate_p.h",
48             "inftrees.h",
49             "insert_string_tpl.h",
50             "match_tpl.h",
51             "trees.h",
52             "trees_emit.h",
53             "trees_tbl.h",
54             "zbuild.h",
55             "zendian.h",
56             "zutil.h",
57             "adler32.c",
58             "chunkset.c",
59             "compare258.c",
60             "compress.c",
61             "crc32.c",
62             "crc32_comb.c",
63             "deflate.c",
64             "deflate_fast.c",
65             "deflate_medium.c",
66             "deflate_quick.c",
67             "deflate_slow.c",
68             "functable.c",
69             "infback.c",
70             "inffast.c",
71             "inflate.c",
72             "inftrees.c",
73             "insert_string.c",
74             "trees.c",
75             "uncompr.c",
76             "zutil_p.h",
77             "zutil.c",
78         ],
79         "//conditions:default": [],
80     }),
81     hdrs = select({
82         ":llvm_zlib_enabled": [
83             "zlib.h",
84             ":zconf_gen",
85         ],
86         "//conditions:default": [],
87     }),
88     copts = [
89         "-std=c11",
90         "-DZLIB_COMPAT",
91         "-DWITH_GZFILEOP",
92         "-DWITH_OPTIM",
93         "-DWITH_NEW_STRATEGIES",
94         # For local builds you might want to add "-DWITH_NATIVE_INSTRUCTIONS"
95         # here to improve performance. Native instructions aren't enabled in
96         # the default config for reproducibility.
97     ],
98     defines = select({
99         ":llvm_zlib_enabled": [
100             "LLVM_ENABLE_ZLIB=1",
101         ],
102         "//conditions:default": [],
103     }),
104     # Clang includes zlib with angled instead of quoted includes, so we need
105     # strip_include_prefix here.
106     strip_include_prefix = ".",
107     visibility = ["//visibility:public"],