build: Add macOS stub compilation support#212
build: Add macOS stub compilation support#212cgwalters wants to merge 1 commit intobootc-dev:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces stub compilation support for macOS by adding conditional compilation attributes (#[cfg(target_os = "linux")]) to Linux-specific modules and dependencies. This is a good approach to enable cross-platform builds while deferring full feature implementation on other platforms. The changes are well-contained and correctly use Rust's conditional compilation features. I have one suggestion regarding the exit call in the main function to align with idiomatic Rust practices.
7d40744 to
8a29bb8
Compare
jeckersb
left a comment
There was a problem hiding this comment.
Needs rebase, but one thing this really wants is something like:
#[cfg(target_os = "linux")]
{
mod arch;
mod images;
// ... etc ...
}Which isn't valid today. We could do something like move all of the linux-only modules to be submodules under a parent linux module, and then:
#[cfg(target_os = "linux")]
mod linux;
#[cfg(target_os = "linux")]
use linux::*;But that's a lot of code-motion to re-home everything.
We could also abuse the #[path] attribute, also kind of ugly.
I guess my point is this is kinda ugly but also all of the valid alternatives are also ugly in their own way.
This is the start of work on bootc-dev#21 Gate Linux-only modules and dependencies with #[cfg(target_os = "linux")] so the crate compiles on macOS. For now only the `ephemeral` verb exists as a stub that errors out, but the idea is we can fill that in. Also replace std::process::exit(0) with Ok(()) for proper cleanup. Assisted-by: OpenCode (Claude claude-opus-4-5@20251101) Assisted-by: OpenCode (Claude claude-opus-4-6) Signed-off-by: Colin Walters <walters@verbum.org>
|
The complex thing here is I think at least some of these things will actually start to build on macos (e.g. qemu). So either way - really it's inevitable that we have conditional churn. Anyways rebased 🏄 |
This is the start of work on #21
For now only the
ephemeralverb exists and it just errors out, but the idea is we can fill that in.Assisted-by: OpenCode (Claude claude-opus-4-5@20251101)