#!/bin/sh # rustc out of the dist tarball buck fetched, with the sysroot stitched on. # # The same job scripts/rustc does, said in a way buck can ship: the wrapper and # the tarball are both inputs to every action that runs it, so the compiler's # identity is part of the action's cache digest and a remote worker can be # handed the whole thing. # # $1 is the directory the tarball unpacked into, $2 the target triple; buck # passes both because neither is knowable from inside the script. set -e dist=$1 triple=$2 shift 2 # The dist tarball keeps its components in sibling directories, so the # compiler's own default sysroot (rustc/) holds no libstd — it lives under # rust-std-/. The codegen libraries are found by rpath relative to the # binary, so only the sysroot has to be named. # # Callers that set their own win: buck's rustc_cfg action passes an empty # --sysroot, and rustc refuses the option twice. for arg do case $arg in --sysroot|--sysroot=*) exec "$dist/rustc/bin/rustc" "$@" ;; esac done exec "$dist/rustc/bin/rustc" --sysroot "$dist/rust-std-$triple" "$@"