brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · 916afe0 Raw
104 lines · plain
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-exception4load("@bazel_skylib//rules:copy_file.bzl", "copy_file")5load("@rules_cc//cc:cc_library.bzl", "cc_library")6 7package(8    default_visibility = ["//visibility:public"],9    # BSD/MIT-like license (for zlib)10    licenses = ["notice"],11)12 13copy_file(14    # The input template is identical to the CMake output.15    name = "zconf_gen",16    src = "zconf.h.in",17    out = "zconf.h",18    allow_symlink = True,19)20 21cc_library(22    name = "zlib",23    srcs = select({24        "@llvm-project//third-party:llvm_zlib_enabled": [25            "adler32.c",26            "adler32_p.h",27            "chunkset.c",28            "chunkset_tpl.h",29            "compare258.c",30            "compress.c",31            "crc32.c",32            "crc32_comb.c",33            "crc32_comb_tbl.h",34            "crc32_p.h",35            "crc32_tbl.h",36            "deflate.c",37            "deflate.h",38            "deflate_fast.c",39            "deflate_medium.c",40            "deflate_p.h",41            "deflate_quick.c",42            "deflate_slow.c",43            "fallback_builtins.h",44            "functable.c",45            "functable.h",46            "infback.c",47            "inffast.c",48            "inffast.h",49            "inffixed_tbl.h",50            "inflate.c",51            "inflate.h",52            "inflate_p.h",53            "inftrees.c",54            "inftrees.h",55            "insert_string.c",56            "insert_string_tpl.h",57            "match_tpl.h",58            "trees.c",59            "trees.h",60            "trees_emit.h",61            "trees_tbl.h",62            "uncompr.c",63            "zbuild.h",64            "zendian.h",65            "zutil.c",66            "zutil.h",67            "zutil_p.h",68        ],69        "//conditions:default": [],70    }),71    hdrs = select({72        "@llvm-project//third-party:llvm_zlib_enabled": [73            "zlib.h",74            ":zconf_gen",75        ],76        "//conditions:default": [],77    }),78    copts = [79        "-std=c11",80        "-DZLIB_COMPAT",81        "-DWITH_GZFILEOP",82        "-DWITH_OPTIM",83        "-DWITH_NEW_STRATEGIES",84        # For local builds you might want to add "-DWITH_NATIVE_INSTRUCTIONS"85        # here to improve performance. Native instructions aren't enabled in86        # the default config for reproducibility.87    ],88    defines = select({89        "@llvm-project//third-party:llvm_zlib_enabled": [90            "LLVM_ENABLE_ZLIB=1",91        ],92        "//conditions:default": [],93    }),94    # Clang includes zlib with angled instead of quoted includes, so we need95    # strip_include_prefix here.96    strip_include_prefix = ".",97    visibility = ["//visibility:public"],98)99 100alias(101    name = "zlib-ng",102    actual = ":zlib",103)104