-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBUILD.zlib
93 lines (84 loc) · 2.18 KB
/
BUILD.zlib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
load("@bazel_skylib//lib:selects.bzl", "selects")
licenses(["notice"]) # BSD/MIT-like license (for zlib)
alias(
name = "zlib",
visibility = ["//visibility:public"],
actual = selects.with_or({
(":android", ":ios", ":watchos", ":tvos"): ":zlib_system",
"//conditions:default": ":zlib_source",
})
)
# Longer term TODO: Blocked until at least after Bazel 5.1 has been released.
# config_setting()s wrappers for constraint_values are necessary for alias rules in Bazel because of a bug in 5.0
# Needs release of fix to https://github.com/bazelbuild/bazel/issues/13047, which will likely happen in 5.1
# At that time, remove these config settings below and update their use in the alias above to the raw @platforms//os constraint_value()s
# Note: There are other instances of this message to update or resolve in sync.
config_setting(
name = "android",
constraint_values = [
"@platforms//os:android",
],
)
config_setting(
name = "ios",
constraint_values = [
"@platforms//os:ios",
],
)
config_setting(
name = "watchos",
constraint_values = [
"@platforms//os:watchos",
],
)
config_setting(
name = "tvos",
constraint_values = [
"@platforms//os:tvos",
],
)
cc_library(
name = "zlib_source",
srcs = [
"adler32.c",
"compress.c",
"crc32.c",
"crc32.h",
"deflate.c",
"deflate.h",
"gzclose.c",
"gzguts.h",
"gzlib.c",
"gzread.c",
"gzwrite.c",
"infback.c",
"inffast.c",
"inffast.h",
"inffixed.h",
"inflate.c",
"inflate.h",
"inftrees.c",
"inftrees.h",
"trees.c",
"trees.h",
"uncompr.c",
"zconf.h",
"zutil.c",
"zutil.h",
],
hdrs = ["zlib.h"],
copts = select({
"@platforms//os:windows": [],
"//conditions:default": ["-Wno-shift-negative-value"],
}),
includes = ["."],
local_defines = select({
"@platforms//os:windows": [],
"//conditions:default": ["Z_HAVE_UNISTD_H"],
}),
)
# For OSs that bundle libz
cc_library(
name = "zlib_system",
linkopts = ["-lz"],
)