Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion architecture/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ Binary staging is driven by `tasks/scripts/stage-prebuilt-binaries.sh`. Gateway
binaries use `cargo zigbuild` with GNU targets pinned to glibc 2.31, including
native-architecture builds, so the gateway image, standalone tarballs, and Linux
packages share the same host portability floor. Supervisor binaries remain
static musl. Local Docker image tasks infer the target architecture from
static musl and use `cargo zigbuild` when available, including native CPU
architectures, so C dependencies are compiled for the musl target instead of the
host GNU libc target. Local Docker image tasks infer the target architecture from
`DOCKER_PLATFORM` when set, otherwise from the container engine host metadata
with the kernel architecture as the fallback. CI invokes the same staging step
via the `rust-native-build.yml` workflow (per-architecture, per-component) and
Expand Down
10 changes: 8 additions & 2 deletions tasks/scripts/stage-prebuilt-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ host_os() {
uname -s
}

has_cargo_zigbuild() {
command -v cargo-zigbuild >/dev/null 2>&1 || mise which cargo-zigbuild >/dev/null 2>&1
}

detect_arches() {
if [[ -n "${PREBUILT_ARCH:-}" ]]; then
normalize_arch "${PREBUILT_ARCH}"
Expand Down Expand Up @@ -159,15 +163,17 @@ build_component_for_arch() {
build_target="$target"

if [[ "$component" == "gateway" ]]; then
if command -v cargo-zigbuild >/dev/null 2>&1 || mise which cargo-zigbuild >/dev/null 2>&1; then
if has_cargo_zigbuild; then
cargo_subcommand=(cargo zigbuild)
build_target="${target}.2.31"
else
echo "Error: cargo-zigbuild + zig are required to build ${binary} with the glibc 2.31 floor." >&2
exit 1
fi
elif [[ "$target_libc" == "musl" ]] && has_cargo_zigbuild; then
cargo_subcommand=(cargo zigbuild)
elif [[ "$current_host_os" != "Linux" || "$current_host_arch" != "$arch" ]]; then
if command -v cargo-zigbuild >/dev/null 2>&1 || mise which cargo-zigbuild >/dev/null 2>&1; then
if has_cargo_zigbuild; then
cargo_subcommand=(cargo zigbuild)
else
echo "Error: cannot build ${binary} for linux/${arch} on ${current_host_os}/${current_host_arch}." >&2
Expand Down
Loading