Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove remaining config_settings, now that they're unnecessary and use macOS system libs #260

Merged
merged 4 commits into from
Aug 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions BUILD.bzip2
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
# Description:
# bzip2 is a high-quality data compressor.

load("@bazel_skylib//lib:selects.bzl", "selects")

licenses(["notice"]) # BSD derivative

cc_library(
alias(
name = "bz2lib",
visibility = ["//visibility:public"],
actual = selects.with_or({
("@platforms//os:osx", "@platforms//os:ios", "@platforms//os:watchos", "@platforms//os:tvos"): ":bz2lib_system",
"//conditions:default": ":bz2lib_source",
})
)

cc_library(
name = "bz2lib_source",
srcs = [
"blocksort.c",
"bzlib.c",
Expand All @@ -19,5 +30,10 @@ cc_library(
"bzlib.h",
],
includes = ["."],
visibility = ["//visibility:public"],
)

# For OSs that bundle bz2lib
cc_library(
name = "bz2lib_system",
linkopts = ["-lbz2"],
)
34 changes: 5 additions & 29 deletions BUILD.lzma
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,14 @@ copy_file(
alias(
name = "apple_config",
actual = select({
":aarch64": "config.lzma-ios-arm64.h",
":arm": "config.lzma-ios-armv7.h",
":x86_64": "config.lzma-osx-x86_64.h", # Configuration same as macOS
":x86_32": "config.lzma-ios-i386.h",
"@platforms//cpu:aarch64": "config.lzma-ios-arm64.h",
"@platforms//cpu:arm": "config.lzma-ios-armv7.h",
"@platforms//cpu:x86_64": "config.lzma-osx-x86_64.h", # Configuration same as macOS
"@platforms//cpu:x86_32": "config.lzma-ios-i386.h",
}),
)

# 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 = "aarch64",
constraint_values = ["@platforms//cpu:aarch64"],
)

config_setting(
name = "arm",
constraint_values = ["@platforms//cpu:arm"],
)

config_setting(
name = "x86_64",
constraint_values = ["@platforms//cpu:x86_64"],
)

config_setting(
name = "x86_32",
constraint_values = ["@platforms//cpu:x86_32"],
)
# Note: lzma is bundled with Apple platforms, but sadly, not considered public API because its header is not exposed. lzma is not bundled on Android.

cc_library(
name = "lzma",
Expand Down
36 changes: 1 addition & 35 deletions BUILD.zlib
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,11 @@ alias(
name = "zlib",
visibility = ["//visibility:public"],
actual = selects.with_or({
(":android", ":ios", ":watchos", ":tvos"): ":zlib_system",
("@platforms//os:android", "@platforms//os:osx", "@platforms//os:ios", "@platforms//os:watchos", "@platforms//os: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 = [
Expand Down