Eric Anholt | bf29daa | 2020-10-29 10:29:28 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Note that this script is not actually "building" rust, but build- is the |
| 4 | # convention for the shared helpers for putting stuff in our containers. |
| 5 | |
| 6 | set -ex |
| 7 | |
| 8 | # cargo (and rustup) wants to store stuff in $HOME/.cargo, and binaries in |
| 9 | # $HOME/.cargo/bin. Make bin a link to a public bin directory so the commands |
| 10 | # are just available to all build jobs. |
| 11 | mkdir -p $HOME/.cargo |
| 12 | ln -s /usr/local/bin $HOME/.cargo/bin |
| 13 | |
| 14 | # For rust in Mesa, we use rustup to install. This lets us pick an arbitrary |
| 15 | # version of the compiler, rather than whatever the container's Debian comes |
| 16 | # with. |
| 17 | # |
| 18 | # Pick the rust compiler (1.41) available in Debian stable, and pick a specific |
| 19 | # snapshot from rustup so the compiler doesn't drift on us. |
| 20 | wget https://sh.rustup.rs -O - | \ |
| 21 | sh -s -- -y --default-toolchain 1.41.1-2020-02-27 |
| 22 | |
| 23 | # Set up a config script for cross compiling -- cargo needs your system cc for |
| 24 | # linking in cross builds, but doesn't know what you want to use for system cc. |
| 25 | cat > /root/.cargo/config <<EOF |
| 26 | [target.armv7-unknown-linux-gnueabihf] |
| 27 | linker = "arm-linux-gnueabihf-gcc" |
| 28 | |
| 29 | [target.aarch64-unknown-linux-gnu] |
| 30 | linker = "aarch64-linux-gnu-gcc" |
| 31 | EOF |