Skip to content

Commit f3ac6c8

Browse files
committed
build(bazel): add openshell-vfio and openshell-server-macros targets
openshell-vfio follows the ocsf template: rust_library plus a rust_test for the inline unit tests. openshell-server-macros is the first rust_proc_macro. Consumers build it for the exec platform via proc_macro_deps, but wildcard builds under a musl --platforms flag would also try a standalone musl variant, which cannot link: a proc-macro is always a dylib and the zig musl toolchain ships no shared unwinder (libgcc_s). Mark the target incompatible with musl platforms so //... sweeps skip it. Signed-off-by: Simon Scatton <[email protected]>
1 parent 7d6bc15 commit f3ac6c8

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
load("@crates//:defs.bzl", "all_crate_deps")
5+
load("@rules_rust//rust:defs.bzl", "rust_proc_macro")
6+
7+
# A proc-macro is always a dylib loaded by rustc on the exec platform, and the
8+
# zig musl toolchain ships no shared unwinder (libgcc_s), so a musl build of
9+
# this target is unlinkable and meaningless. Consumers are unaffected:
10+
# proc_macro_deps builds it for the exec platform.
11+
rust_proc_macro(
12+
name = "openshell_server_macros",
13+
srcs = glob(["src/**/*.rs"]),
14+
edition = "2024",
15+
target_compatible_with = select({
16+
"@zig_sdk//libc:musl": ["@platforms//:incompatible"],
17+
"//conditions:default": [],
18+
}),
19+
visibility = ["//visibility:public"],
20+
deps = all_crate_deps(normal = True),
21+
)

‎crates/openshell-vfio/BUILD.bazel‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
load("@crates//:defs.bzl", "all_crate_deps")
5+
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
6+
7+
rust_library(
8+
name = "openshell_vfio",
9+
srcs = glob(["src/**/*.rs"]),
10+
edition = "2024",
11+
visibility = ["//visibility:public"],
12+
deps = all_crate_deps(normal = True),
13+
proc_macro_deps = all_crate_deps(proc_macro = True),
14+
)
15+
16+
rust_test(
17+
name = "openshell_vfio_test",
18+
crate = ":openshell_vfio",
19+
deps = all_crate_deps(normal_dev = True),
20+
)

0 commit comments

Comments
 (0)