#!/bin/sh # zig, as the C toolchain, out of the tarball buck fetched. # # The buck-side twin of scripts/zcc, and the same argument rewriting: cc-rs # builds a `--target=` from the Rust triple, which carries a vendor field — # `x86_64-unknown-linux-gnu`. zig's own triples have no vendor, and it refuses # the whole query rather than ignoring the part it does not want, reporting # "unable to parse target query: UnknownOperatingSystem" as though Linux were # the problem. # # $1 is the directory the tarball unpacked into and $2 the zig subcommand — cc, # c++, ar or ranlib. buck passes both; nothing here can work them out. set -e zig=$1/zig mode=$2 shift 2 for arg do case $arg in --target=*-unknown-linux-*) set -- "$@" "$(printf '%s' "$arg" | sed 's/-unknown-linux-/-linux-/')" shift continue ;; esac set -- "$@" "$arg" shift done exec "$zig" "$mode" "$@"