From 97e96ee831df637e2a02ca6aab688879e0daf0d9 Mon Sep 17 00:00:00 2001 From: suchintan <3853670+suchintan@users.noreply.github.com> Date: Sun, 23 Aug 2026 23:13:48 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20synced=20local=20'tools/'=20with?= =?UTF-8?q?=20remote=20'tools/'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/Skyvern-AI/rustwright-cloud/pull/229 --- tools/zig-cc | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 tools/zig-cc diff --git a/tools/zig-cc b/tools/zig-cc new file mode 100755 index 0000000..227737f --- /dev/null +++ b/tools/zig-cc @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +set -euo pipefail + +: "${CARGO_ZIG_TARGET:?CARGO_ZIG_TARGET must be set}" +zig_target="${CARGO_ZIG_TARGET/unknown-/}" # Zig omits Rust's `unknown-` component. +if command -v zig >/dev/null 2>&1; then + zig_command=(zig) +elif command -v python-zig >/dev/null 2>&1; then + zig_command=(python-zig) +else + printf '%s\n' "tools/zig-cc: neither zig nor python-zig was found on PATH" >&2 + exit 127 +fi + +args=() +skip=0 +for arg in "$@"; do + if ((skip)); then + skip=0 + continue + fi + + case "$arg" in + --target=*) + # cc-rs may add the Rust target; use the pinned Zig target instead. + continue + ;; + -target) + skip=1 + continue + ;; + -Wl,--fix-cortex-a53-843419) + # Rust's aarch64 GNU target enables this GNU-ld workaround by default. + # Zig 0.14 rejects the linker arg before invoking its linker. Filter only + # this known target-specific incompatibility; preserve every other arg. + continue + ;; + *) + args+=("$arg") + ;; + esac +done + +exec "${zig_command[@]}" cc -target "$zig_target" "${args[@]}"