blob: 7fa6f9044b5f725790945e885096f55cb06b2ac8 [file] [log] [blame]
Zachary Leaf782c54a2024-09-24 14:33:24 +01001#!/usr/bin/env bash
2#
3# Copyright (c) 2024 Arm Limited. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7pre_tf_build() {
Zachary Leaf2a7aebf2024-10-11 15:25:49 +01008 # pre_tf_build() and other call hooks are invoked from within subshells, so
9 # environment variables are lost when calling (except $PATH somehow is
10 # retained)
11 #
12 # rustup is installed by the root user in a non-default location
13 # /usr/local/rustup, so $RUSTUP_HOME is required to access rust config
14 # e.g. default toolchains and run cargo
15 #
16 # leave $CARGO_HOME blank so when this is run by the buildslave user it uses
17 # the default /home/buildslave/.cargo directory which it has write
18 # permissions for - that allows it to download new crates during compilation
19 #
20 # since rust was installed by root, buildslave user does not have write
21 # access to /usr/local/cargo and will error when trying to download new
22 # crates otherwise
23 #
24 # note: $PATH still contains /usr/local/cargo/bin at this point so cargo is
25 # still run via the root installation
26 #
27 # see https://github.com/rust-lang/rustup/issues/1085
28 export RUSTUP_HOME=/usr/local/rustup
Zachary Leaf7937b862024-10-11 12:33:50 +010029 make -C "$tf_root/rust"
30 make -C "$tf_root/rust" clippy
Zachary Leaf782c54a2024-09-24 14:33:24 +010031}