You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.3 KiB
Bash

3 years ago
#!/usr/bin/env bash
# this script installs https://github.com/riscv-collab/riscv-gnu-toolchain
set -eu
if ! command -v apt &> /dev/null
then
echo "This script was written for Debian based Linux Systems. It seems like \
you are using something else. Please change this script to work with your OS."
echo "You can find further infos at https://github.com/riscv-collab/riscv-gnu-toolchain"
exit 1
fi
function print_step {
echo "==========="
echo -e ">>> \033[0;36m $@\033[0m"
echo "==========="
}
if test -d riscv-gnu-toolchain; then
echo "Skipping steps 1..3"
cd riscv-gnu-toolchain
else
print_step "[1] Installing dependencies"
sudo apt-get install -y autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev git
print_step "[2] Cloning repository"
git clone --depth 1 https://github.com/riscv-collab/riscv-gnu-toolchain
print_step "[3] Configuring build"
cd riscv-gnu-toolchain
./configure --prefix=$(pwd)/../toolchain/ --with-arch=rv32ima --disable-linux --disable-gdb --disable-multilib
fi
print_step "[4] Compiling"
echo "This might take up to an hour! Be patient!"
# call make with as many threads as the system has available
make -j $(grep -c ^processor /proc/cpuinfo)