1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-01-19 05:49:14 +02:00
ripgrep/ci/install.sh

53 lines
973 B
Bash
Raw Normal View History

#!/bin/bash
# install stuff needed for the `script` phase
# Where rustup gets installed.
export PATH="$PATH:$HOME/.cargo/bin"
2016-09-05 20:08:46 -04:00
set -ex
. "$(dirname $0)/utils.sh"
2016-09-05 20:08:46 -04:00
install_rustup() {
curl https://sh.rustup.rs -sSf \
| sh -s -- -y --default-toolchain="$TRAVIS_RUST_VERSION"
2016-09-05 20:08:46 -04:00
rustc -V
cargo -V
}
install_targets() {
2016-09-05 20:08:46 -04:00
if [ $(host) != "$TARGET" ]; then
rustup target add $TARGET
fi
}
configure_cargo() {
local prefix=$(gcc_prefix)
if [ -n "${prefix}" ]; then
local gcc_suffix=
if [ -n "$GCC_VERSION" ]; then
gcc_suffix="-$GCC_VERSION"
fi
local gcc="${prefix}gcc${gcc_suffix}"
2016-09-05 20:08:46 -04:00
# information about the cross compiler
"${gcc}" -v
2016-09-05 20:08:46 -04:00
# tell cargo which linker to use for cross compilation
mkdir -p .cargo
cat >>.cargo/config <<EOF
[target.$TARGET]
linker = "${gcc}"
2016-09-05 20:08:46 -04:00
EOF
fi
}
main() {
install_rustup
install_targets
2016-09-05 20:08:46 -04:00
configure_cargo
}
main