diff --git a/gpio/Cargo.toml b/gpio/Cargo.toml index 28ae5c2..07cc8b2 100644 --- a/gpio/Cargo.toml +++ b/gpio/Cargo.toml @@ -24,6 +24,7 @@ virtio-queue = "0.2" vm-memory = "0.7" vmm-sys-util = "=0.9.0" +[target.'cfg(target_env = "gnu")'.dependencies] libgpiod = { git = "https://github.com/vireshk/libgpiod" } [dev-dependencies] diff --git a/gpio/src/main.rs b/gpio/src/main.rs index 3531af3..045cea3 100644 --- a/gpio/src/main.rs +++ b/gpio/src/main.rs @@ -5,10 +5,21 @@ // // SPDX-License-Identifier: Apache-2.0 +#[cfg(target_env = "gnu")] mod backend; +#[cfg(target_env = "gnu")] mod gpio; +#[cfg(target_env = "gnu")] mod vhu_gpio; +#[cfg(target_env = "gnu")] fn main() -> backend::Result<()> { backend::gpio_init() } + +// Rust vmm container (https://github.com/rust-vmm/rust-vmm-container) doesn't +// have tools to do a musl build at the moment, and adding that support is +// tricky as well to the container. Skip musl builds until the time pre-built +// libgpiod library is available for musl. +#[cfg(target_env = "musl")] +fn main() {}