firmware-open/scripts/deps.sh

98 lines
2 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -eE
function msg {
echo -e "\x1B[1m$*\x1B[0m" >&2
}
trap 'msg "\x1B[31mFailed to install dependencies!"' ERR
source /etc/os-release
msg "Installing system build dependencies"
if [[ "${ID}" =~ "debian" ]] || [[ "${ID_LIKE}" =~ "debian" ]]; then
sudo apt-get install \
avr-libc \
avrdude \
bison \
build-essential \
ccache \
cmake \
2020-06-18 14:22:24 -06:00
curl \
dosfstools \
flashrom \
flex \
gcc-avr \
git-lfs \
gnat \
libncurses-dev \
libudev-dev \
mtools \
nasm \
parted \
2020-06-04 09:54:43 -06:00
python \
2019-10-10 21:15:03 -06:00
python3-distutils \
qt5-default \
2020-06-04 09:54:43 -06:00
sdcc \
uuid-dev \
zlib1g-dev
elif [[ "${ID}" =~ "fedora" ]] || [[ "${ID_LIKE}" =~ "fedora" ]]; then
2020-06-18 14:22:24 -06:00
sudo dnf group install c-development
sudo dnf install \
avr-gcc \
avr-libc \
avrdude \
cmake \
2020-06-18 14:22:24 -06:00
curl \
dosfstools \
flashrom \
2020-06-18 14:22:24 -06:00
gcc-gnat \
git-lfs \
libuuid-devel \
mtools \
nasm \
ncurses-devel \
parted \
2020-06-18 14:22:24 -06:00
patch \
qt5-qtbase-devel \
2020-06-18 14:22:24 -06:00
sdcc \
systemd-devel \
2020-06-18 14:22:24 -06:00
zlib-devel
else
msg "Unknown system ID: ${ID}"
msg "Please add support for your distribution to: $0"
exit 1
fi
msg "Installing GIT LFS hooks"
git lfs install
msg "Downloading GIT LFS artifacts"
git lfs pull
msg "Initializing submodules"
git submodule update --init --recursive --progress
msg "Installing coreboot commit hook"
curl -sSf https://review.coreboot.org/tools/hooks/commit-msg \
-o .git/modules/coreboot/hooks/commit-msg && \
chmod +x .git/modules/coreboot/hooks/commit-msg
msg "Installing Rust"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --default-toolchain nightly
msg "Loading Rust environment"
source ~/.cargo/env
msg "Installing pinned Rust toolchain"
rustup toolchain install "$(cat rust-toolchain)"
msg "Installing source for pinned Rust toolchain"
rustup component add --toolchain "$(cat rust-toolchain)" rust-src
msg "\x1B[32mSuccessfully installed dependencies"
echo "Ready to run ./scripts/build.sh [model]" >&2