BUILD.libz.bazel 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License in the LICENSE file at the
  6. # root of this repository, or online at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. """
  16. Builds zlib.
  17. Derived from: <https://github.com/rust-lang/libz-sys/blob/8462d47d51e36c8cd7fa83db3cbcc2b725385650/build.rs>
  18. """
  19. cc_library(
  20. name = "zlib",
  21. srcs = [
  22. "src/zlib/adler32.c",
  23. "src/zlib/compress.c",
  24. "src/zlib/crc32.c",
  25. "src/zlib/deflate.c",
  26. "src/zlib/infback.c",
  27. "src/zlib/inffast.c",
  28. "src/zlib/inflate.c",
  29. "src/zlib/inftrees.c",
  30. "src/zlib/trees.c",
  31. "src/zlib/uncompr.c",
  32. "src/zlib/zutil.c",
  33. ],
  34. hdrs = [
  35. "src/zlib/crc32.h",
  36. "src/zlib/deflate.h",
  37. "src/zlib/inffast.h",
  38. "src/zlib/inffixed.h",
  39. "src/zlib/inflate.h",
  40. "src/zlib/inftrees.h",
  41. "src/zlib/trees.h",
  42. "src/zlib/zconf.h",
  43. "src/zlib/zlib.h",
  44. "src/zlib/zutil.h",
  45. ],
  46. copts = select({
  47. "//conditions:default": [
  48. "-Wno-unused-variable",
  49. "-Wno-implicit-function-declaration",
  50. "-Wno-deprecated-non-prototype",
  51. "-Wno-macro-redefined",
  52. "-fvisibility=hidden",
  53. ],
  54. }),
  55. includes = ["src/zlib"],
  56. local_defines = [
  57. "Z_SOLO",
  58. "STDC",
  59. "_LARGEFILE64_SOURCE",
  60. "_POSIX_SOURCE",
  61. ] + select({
  62. "@platforms//os:macos": [
  63. "_C99_SOURCE",
  64. ],
  65. "//conditions:default": [],
  66. }),
  67. visibility = ["//visibility:public"],
  68. )