1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/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 and $2 the sysroot to use;
# buck passes both because neither is knowable from inside the script. The
# sysroot is a separate argument rather than something built from a triple
# here: cross-compiling needs two libstds stitched into one directory, and
# that stitching is an artifact of its own (toolchains//dist:android-sysroot).
set -e
dist=$1
sysroot=$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-<triple>/, which is what buck names above. 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 "$sysroot" "$@"
|