| Make the C toolchain a dependency too, so zig travels with the action 6391496 nandi 19d ago | 1 | #!/bin/sh |
| 2 | # zig, as the C toolchain, out of the tarball buck fetched. |
| 3 | # |
| 4 | # The buck-side twin of scripts/zcc, and the same argument rewriting: cc-rs |
| 5 | # builds a `--target=` from the Rust triple, which carries a vendor field — |
| 6 | # `x86_64-unknown-linux-gnu`. zig's own triples have no vendor, and it refuses |
| 7 | # the whole query rather than ignoring the part it does not want, reporting |
| 8 | # "unable to parse target query: UnknownOperatingSystem" as though Linux were |
| 9 | # the problem. |
| 10 | # |
| 11 | # $1 is the directory the tarball unpacked into and $2 the zig subcommand — cc, |
| 12 | # c++, ar or ranlib. buck passes both; nothing here can work them out. |
| 13 | set -e |
| 14 | zig=$1/zig |
| 15 | mode=$2 |
| 16 | shift 2 |
| 17 | |
| 18 | for arg do |
| 19 | case $arg in |
| 20 | --target=*-unknown-linux-*) |
| 21 | set -- "$@" "$(printf '%s' "$arg" | sed 's/-unknown-linux-/-linux-/')" |
| 22 | shift |
| 23 | continue |
| 24 | ;; |
| 25 | esac |
| 26 | set -- "$@" "$arg" |
| 27 | shift |
| 28 | done |
| 29 | |
| 30 | exec "$zig" "$mode" "$@" |