From 72078e001abcecaf8ab3c40e08d39f872b6e4605 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Wed, 12 Aug 2026 11:16:26 +0200 Subject: [PATCH 1/3] feat: add macOS (Apple silicon) support The slint crate was only declared for Linux and Windows targets, so on macOS i-slint-backend-winit compiled without any renderer feature and the build failed. Fold macOS into the shared native slint target (winit backend with the Skia renderer). Embed an Info.plist generated from CARGO_PKG_VERSION into the __TEXT,__info_plist section of the binary so the About panel shows the application name, version, copyright and project URL without an .app bundle, the macOS counterpart of the winresource metadata on Windows. Detect the default Podman machine API socket in $TMPDIR so a running Podman machine is found without DOCKER_HOST or the Podman system helper; DOCKER_HOST, CONTAINER_HOST and the Docker socket defaults still apply otherwise. Verified end-to-end on macOS 26 (arm64) with Podman: engine autodetection, image builder download and a firmware build for mvebu/cortexa9. Co-Authored-By: George Sapkin Co-Authored-By: Claude Fable 5 --- Cargo.toml | 4 ++-- build.rs | 37 +++++++++++++++++++++++++++++++++++++ src/containers.rs | 11 +++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a3ac247..bb4ccdf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,8 +30,8 @@ tokio = { version = "1", features = [ ] } ureq = { version = "3", features = ["json"] } -# Native Linux or Windows -[target.'cfg(any(target_os = "linux", target_env = "msvc"))'.dependencies] +# Native Linux, macOS, or Windows +[target.'cfg(any(target_os = "linux", target_os = "macos", target_env = "msvc"))'.dependencies] slint = { version = "1.17", default-features = false, features = ["backend-winit", "compat-1-2", "renderer-skia"] } # Cross-compile Windows from Linux diff --git a/build.rs b/build.rs index 1bfba17..805120d 100644 --- a/build.rs +++ b/build.rs @@ -3,6 +3,8 @@ // SPDX-License-Identifier: GPL-3.0-only use std::env; +use std::fs; +use std::path::PathBuf; use winresource::WindowsResource; @@ -16,4 +18,39 @@ fn main() { res.set_icon("./assets/logo.ico"); res.compile().expect("Failed to compile Windows resources"); } + + if env::var("CARGO_CFG_TARGET_OS").is_ok_and(|os| os == "macos") { + embed_macos_info_plist(); + } +} + +/// Embeds an Info.plist into the binary so macOS can show the app name, +/// version and copyright in the About panel without an .app bundle. +fn embed_macos_info_plist() { + let version = env::var("CARGO_PKG_VERSION").unwrap(); + let plist = format!( + r#" + + + + CFBundleIdentifier + in.sapk.bouwer + CFBundleName + Bouwer + CFBundleShortVersionString + {version} + NSHumanReadableCopyright + Copyright © 2026 George Sapkin +https://github.com/GeorgeSapkin/bouwer + + +"# + ); + + let path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("Info.plist"); + fs::write(&path, plist).expect("Failed to write Info.plist"); + println!( + "cargo:rustc-link-arg=-Wl,-sectcreate,__TEXT,__info_plist,{}", + path.display() + ); } diff --git a/src/containers.rs b/src/containers.rs index 8311d10..72e1564 100644 --- a/src/containers.rs +++ b/src/containers.rs @@ -101,6 +101,17 @@ impl Containers { Docker::connect_with_host(&host)? } else { cfg_select! { + target_os = "macos" => { + // Check for the default Podman machine API socket + let socket = env::temp_dir().join("podman/podman-machine-default-api.sock"); + + if socket.exists() { + Docker::connect_with_socket(&socket.to_string_lossy(), 120, bollard::API_DEFAULT_VERSION)? + } else { + // Fallback to defaults + Docker::connect_with_local_defaults()? + } + } unix => { // Check for rootless Podman socket let socket = env::var("XDG_RUNTIME_DIR").map_or_else( From f7f1486c374b5550dd71f3ac021bdb09cc35cd88 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Wed, 12 Aug 2026 11:16:26 +0200 Subject: [PATCH 2/3] docs: mark macOS on Apple silicon as supported Document the container engine setup on macOS (automatic detection of the default Podman machine socket, DOCKER_HOST for custom setups) and that image builder images live inside the Podman/Docker VM there, as on Windows. Co-Authored-By: Claude Fable 5 --- README.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8a0538d..2c8eb9d 100644 --- a/README.md +++ b/README.md @@ -39,17 +39,24 @@ A working internet connection. A working installation of [Podman](https://podman.io/docs/installation) or [Docker](https://www.docker.com/products/docker-desktop/). Bouwer uses these container engines to run OpenWrt image builder containers. On Linux use your -package manager, on Windows - the official websites to install either of them. +package manager, on macOS - e.g. Homebrew (`brew install podman`), on Windows - +the official websites to install either of them. Additionally, on Linux, Docker must be accessible _without_ super user privileges, by e.g. adding your user to the `docker` group. +On macOS, the default Podman machine socket is detected automatically. For a +custom machine name, or for Docker, either make the default Docker API socket +available (e.g. via `sudo podman-mac-helper install` or Docker Desktop) or +point `DOCKER_HOST` at the right socket before starting Bouwer. + 1 to 3 gigabytes of free disk space for each target and free disk space for the -firmware images. On Windows, image builder images are stored as part of Podman -or Docker VMs, so you need to account for that when allocating space for them. +firmware images. On Windows and macOS, image builder images are stored as part +of Podman or Docker VMs, so you need to account for that when allocating space +for them. -Currently, modern Linux and Windows running on x86/64 are supported. macOS on -aarch64 is doable, but there's no practical way for me to test this at the -moment, although the basic macOS-specific hooks are there. +Currently, modern Linux and Windows running on x86/64, and macOS running on +Apple silicon (aarch64) are supported. macOS support was tested on macOS 26 +with Podman. ## Installation From 535e09a6f5392d1545596cb94d3b5fcbc36ae338 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Wed, 12 Aug 2026 11:16:26 +0200 Subject: [PATCH 3/3] ci: build and release macOS binaries Add macos-latest (Apple silicon) to the build matrix and package the binary as a macos-aarch64 release asset. Unlike Linux and Windows, the binary is not compressed with upx: UPX-packed Mach-O binaries are not reliable on modern macOS; the release profile already strips symbols. Co-Authored-By: Claude Fable 5 --- .github/workflows/release.yml | 5 +++++ .github/workflows/reusable-build.yml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c12bc3..6c13b58 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,6 +32,11 @@ jobs: -C artifacts/bouwer-ubuntu-latest bouwer \ -C ${{ github.workspace }} LICENSE + chmod +x artifacts/bouwer-macos-latest/bouwer + tar -czf dist/bouwer-${{ github.ref_name }}-macos-aarch64.tar.gz \ + -C artifacts/bouwer-macos-latest bouwer \ + -C ${{ github.workspace }} LICENSE + zip -j dist/bouwer-${{ github.ref_name }}-windows-x86_64.zip \ artifacts/bouwer-windows-latest/bouwer.exe \ LICENSE diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index a68144e..15ee799 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -6,7 +6,7 @@ jobs: build: strategy: matrix: - os: [windows-latest, ubuntu-latest] + os: [windows-latest, ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - name: Checkout