2022-06-02 08:46:16 +03:00
|
|
|
load("@bazel-zig-cc//rules:platform.bzl", "platform_binary")
|
2022-04-13 17:52:25 +03:00
|
|
|
|
|
|
|
cc_binary(
|
|
|
|
name = "which_libc",
|
|
|
|
srcs = ["main.c"],
|
|
|
|
target_compatible_with = [
|
|
|
|
"@platforms//os:linux",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
[
|
|
|
|
(
|
|
|
|
platform_binary(
|
|
|
|
name = "which_libc_{}".format(name),
|
|
|
|
src = "which_libc",
|
2022-10-03 07:22:23 +03:00
|
|
|
env = {"QEMU_LD_PREFIX": "/usr/aarch64-linux-gnu"} if "arm64" in name else {},
|
2022-04-13 17:52:25 +03:00
|
|
|
platform = platform,
|
2022-10-03 07:22:23 +03:00
|
|
|
run_under = "qemu-aarch64-static" if "arm64" in name else "",
|
2022-04-13 17:52:25 +03:00
|
|
|
),
|
|
|
|
sh_test(
|
|
|
|
name = "test_libc_{}".format(name),
|
|
|
|
srcs = ["test.sh"],
|
|
|
|
data = ["which_libc_{}".format(name)],
|
|
|
|
env = {
|
|
|
|
"WANT": want,
|
|
|
|
"BINARY": "$(location which_libc_{})".format(name),
|
|
|
|
},
|
|
|
|
),
|
|
|
|
)
|
2022-10-03 07:22:23 +03:00
|
|
|
for name, platform, want in [
|
|
|
|
("linux_amd64_musl", "//libc_aware/platform:linux_amd64_musl", "non-glibc"),
|
|
|
|
("linux_amd64_gnu.2.19", "//libc_aware/platform:linux_amd64_gnu.2.19", "glibc_2.19"),
|
|
|
|
("linux_amd64_gnu.2.28", "//libc_aware/platform:linux_amd64_gnu.2.28", "glibc_2.28"),
|
|
|
|
("linux_arm64_musl", "//libc_aware/platform:linux_arm64_musl", "non-glibc"),
|
|
|
|
("linux_amd64", "//platform:linux_amd64", "glibc_2.19"),
|
|
|
|
("linux_arm64", "//platform:linux_arm64", "glibc_2.28"),
|
2022-04-13 17:52:25 +03:00
|
|
|
]
|
|
|
|
]
|