gstreamer/ci/scripts/install-rust.sh
Jordan Petridis 9c5523d529 ci: Make it easier to run the build scripts locally
* Move the exported PATH variables into a script so
we can source it in all the wrapper scripts.

* Add a guard to only copy over the cache when the
SUBPROJECTS_CACHE_DIR variable is set, which only
happens on CI by default

* Make it possible to run the scripts with default
values for some of the variables, like WERROR and MESON_ARGS.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7591>
2024-10-28 13:47:18 +00:00

31 lines
776 B
Bash

#! /bin/bash
set -eux
# Install Rust
RUSTUP_VERSION=1.27.1
RUST_VERSION=1.82.0
RUST_ARCH="x86_64-unknown-linux-gnu"
RUSTUP_URL=https://static.rust-lang.org/rustup/archive/$RUSTUP_VERSION/$RUST_ARCH/rustup-init
curl -o rustup-init $RUSTUP_URL
export RUSTUP_HOME="/usr/local/rustup"
export CARGO_HOME="/usr/local/cargo"
export PATH="/usr/local/cargo/bin:$PATH"
chmod +x rustup-init;
./rustup-init -y --no-modify-path --default-toolchain $RUST_VERSION;
rm rustup-init;
chmod -R a+w $RUSTUP_HOME $CARGO_HOME
cargo install --locked cargo-c --version 0.10.5+cargo-0.83.0
rustup --version
cargo --version
rustc --version
cargo cinstall --version
# Cleanup the registry after install
# so we don't have to save 200mb of the index in the ci image
rm -rf "$CARGO_HOME/registry"