Fossil SCM

fossil-scm / compat / zlib / BUILD.bazel
Source Blame History 134 lines
6ea30fb… florian 1 # Copied from https://github.com/bazelbuild/bazel-central-registry/tree/main/modules/zlib/1.3.1.bcr.4/patches
6ea30fb… florian 2 # Adapted from https://github.com/protocolbuffers/protobuf/blob/master/third_party/zlib.BUILD
6ea30fb… florian 3
6ea30fb… florian 4 # Copyright 2008 Google Inc. All rights reserved.
6ea30fb… florian 5 #
6ea30fb… florian 6 # Redistribution and use in source and binary forms, with or without
6ea30fb… florian 7 # modification, are permitted provided that the following conditions are
6ea30fb… florian 8 # met:
6ea30fb… florian 9 #
6ea30fb… florian 10 # * Redistributions of source code must retain the above copyright
6ea30fb… florian 11 # notice, this list of conditions and the following disclaimer.
6ea30fb… florian 12 # * Redistributions in binary form must reproduce the above
6ea30fb… florian 13 # copyright notice, this list of conditions and the following disclaimer
6ea30fb… florian 14 # in the documentation and/or other materials provided with the
6ea30fb… florian 15 # distribution.
6ea30fb… florian 16 # * Neither the name of Google Inc. nor the names of its
6ea30fb… florian 17 # contributors may be used to endorse or promote products derived from
6ea30fb… florian 18 # this software without specific prior written permission.
6ea30fb… florian 19 #
6ea30fb… florian 20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6ea30fb… florian 21 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6ea30fb… florian 22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6ea30fb… florian 23 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
6ea30fb… florian 24 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
6ea30fb… florian 25 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
6ea30fb… florian 26 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
6ea30fb… florian 27 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
6ea30fb… florian 28 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
6ea30fb… florian 29 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
6ea30fb… florian 30 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6ea30fb… florian 31 #
6ea30fb… florian 32 # Code generated by the Protocol Buffer compiler is owned by the owner
6ea30fb… florian 33 # of the input file used when generating it. This code is not
6ea30fb… florian 34 # standalone and requires a support library to be linked with it. This
6ea30fb… florian 35 # support library is itself covered by the above license.
6ea30fb… florian 36
6ea30fb… florian 37 load("@rules_cc//cc:defs.bzl", "cc_library")
6ea30fb… florian 38 load("@rules_license//rules:license.bzl", "license")
6ea30fb… florian 39
6ea30fb… florian 40 package(
6ea30fb… florian 41 default_applicable_licenses = [":license"],
6ea30fb… florian 42 )
6ea30fb… florian 43
6ea30fb… florian 44 license(
6ea30fb… florian 45 name = "license",
6ea30fb… florian 46 license_kinds = ["@rules_license//licenses/spdx:Zlib"],
6ea30fb… florian 47 license_text = "LICENSE",
6ea30fb… florian 48 )
6ea30fb… florian 49
6ea30fb… florian 50 exports_files([
6ea30fb… florian 51 "LICENSE",
6ea30fb… florian 52 ])
6ea30fb… florian 53
6ea30fb… florian 54 _ZLIB_HEADERS = [
6ea30fb… florian 55 "crc32.h",
6ea30fb… florian 56 "deflate.h",
6ea30fb… florian 57 "gzguts.h",
6ea30fb… florian 58 "inffast.h",
6ea30fb… florian 59 "inffixed.h",
6ea30fb… florian 60 "inflate.h",
6ea30fb… florian 61 "inftrees.h",
6ea30fb… florian 62 "trees.h",
6ea30fb… florian 63 "zconf.h",
6ea30fb… florian 64 "zlib.h",
6ea30fb… florian 65 "zutil.h",
6ea30fb… florian 66 ]
6ea30fb… florian 67
6ea30fb… florian 68 _ZLIB_PREFIXED_HEADERS = ["zlib/include/" + hdr for hdr in _ZLIB_HEADERS]
6ea30fb… florian 69
6ea30fb… florian 70 # In order to limit the damage from the `includes` propagation
6ea30fb… florian 71 # via `:zlib`, copy the public headers to a subdirectory and
6ea30fb… florian 72 # expose those.
6ea30fb… florian 73 genrule(
6ea30fb… florian 74 name = "copy_public_headers",
6ea30fb… florian 75 srcs = _ZLIB_HEADERS,
6ea30fb… florian 76 outs = _ZLIB_PREFIXED_HEADERS,
6ea30fb… florian 77 cmd_bash = "cp $(SRCS) $(@D)/zlib/include/",
6ea30fb… florian 78 cmd_bat = " && ".join(
6ea30fb… florian 79 ["@copy /Y \"$(location %s)\" \"$(@D)\\zlib\\include\\\" >NUL" %
6ea30fb… florian 80 s for s in _ZLIB_HEADERS],
6ea30fb… florian 81 ),
6ea30fb… florian 82 )
6ea30fb… florian 83
6ea30fb… florian 84 config_setting(
6ea30fb… florian 85 name = "mingw_gcc_compiler",
6ea30fb… florian 86 flag_values = {
6ea30fb… florian 87 "@bazel_tools//tools/cpp:compiler": "mingw-gcc",
6ea30fb… florian 88 },
6ea30fb… florian 89 visibility = [":__subpackages__"],
6ea30fb… florian 90 )
6ea30fb… florian 91
6ea30fb… florian 92 cc_library(
6ea30fb… florian 93 name = "z",
6ea30fb… florian 94 srcs = [
6ea30fb… florian 95 "adler32.c",
6ea30fb… florian 96 "compress.c",
6ea30fb… florian 97 "crc32.c",
6ea30fb… florian 98 "deflate.c",
6ea30fb… florian 99 "gzclose.c",
6ea30fb… florian 100 "gzlib.c",
6ea30fb… florian 101 "gzread.c",
6ea30fb… florian 102 "gzwrite.c",
6ea30fb… florian 103 "infback.c",
6ea30fb… florian 104 "inffast.c",
6ea30fb… florian 105 "inflate.c",
6ea30fb… florian 106 "inftrees.c",
6ea30fb… florian 107 "trees.c",
6ea30fb… florian 108 "uncompr.c",
6ea30fb… florian 109 "zutil.c",
6ea30fb… florian 110 # Include the un-prefixed headers in srcs to work
6ea30fb… florian 111 # around the fact that zlib isn't consistent in its
6ea30fb… florian 112 # choice of <> or "" delimiter when including itself.
6ea30fb… florian 113 ] + _ZLIB_HEADERS,
6ea30fb… florian 114 hdrs = _ZLIB_PREFIXED_HEADERS,
6ea30fb… florian 115 copts = select({
6ea30fb… florian 116 ":mingw_gcc_compiler": [
6ea30fb… florian 117 "-fpermissive",
6ea30fb… florian 118 ],
6ea30fb… florian 119 "@platforms//os:windows": [],
6ea30fb… florian 120 "//conditions:default": [
6ea30fb… florian 121 "-Wno-deprecated-non-prototype",
6ea30fb… florian 122 "-Wno-unused-variable",
6ea30fb… florian 123 "-Wno-implicit-function-declaration",
6ea30fb… florian 124 ],
6ea30fb… florian 125 }),
6ea30fb… florian 126 includes = ["zlib/include/"],
6ea30fb… florian 127 visibility = ["//visibility:public"],
6ea30fb… florian 128 )
6ea30fb… florian 129
6ea30fb… florian 130 alias(
6ea30fb… florian 131 name = "zlib",
6ea30fb… florian 132 actual = ":z",
6ea30fb… florian 133 visibility = ["//visibility:public"],
6ea30fb… florian 134 )

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button