1
hermetic_cc_toolchain/test/c/BUILD
Motiejus Jakštys 27fe6c9ffb wip macos
motiejus@mtwork:/code/bazel-zig-cc$ bazel build  --spawn_strategy=local  --platforms @zig_sdk//libc_aware/platform:macos_aarch64_sdk.13.1 test/c:which_libc
    INFO: Analyzed target //test/c:which_libc (0 packages loaded, 0 targets configured).
    INFO: Found 1 target...
    Target //test/c:which_libc up-to-date:
      bazel-bin/test/c/which_libc
    INFO: Elapsed time: 0.071s, Critical Path: 0.00s
    INFO: 1 process: 1 internal.
    INFO: Build completed successfully, 1 total action
    motiejus@mtwork:/code/bazel-zig-cc$ file bazel-bin/test/c/which_libc
    bazel-bin/test/c/which_libc: Mach-O 64-bit arm64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE>
    motiejus@mtwork:/code/bazel-zig-cc$
2023-03-29 13:22:10 +03:00

32 lines
960 B
Python

load("@bazel-zig-cc//rules:platform.bzl", "platform_binary")
cc_binary(
name = "which_libc",
srcs = ["main.c"],
)
[
(
platform_binary(
name = "which_libc_{}".format(name),
src = "which_libc",
platform = platform,
),
sh_test(
name = "test_libc_{}".format(name),
srcs = ["test.sh"],
data = ["which_libc_{}".format(name)],
env = {
"WANT": want,
"BINARY": "$(location which_libc_{})".format(name),
},
),
)
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_amd64", "//platform:linux_amd64", "glibc_2.19"),
]
]