• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
6set -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.
11mkdir -p $HOME/.cargo
12ln -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.48) available in Debian stable, and pick a specific
19# snapshot from rustup so the compiler doesn't drift on us.
20wget https://sh.rustup.rs -O - | \
21    sh -s -- -y --default-toolchain 1.49.0-2020-12-31
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.
25cat > /root/.cargo/config <<EOF
26[target.armv7-unknown-linux-gnueabihf]
27linker = "arm-linux-gnueabihf-gcc"
28
29[target.aarch64-unknown-linux-gnu]
30linker = "aarch64-linux-gnu-gcc"
31EOF
32