Move readme commands to scripts/deps.sh
This commit is contained in:
36
README.md
36
README.md
@@ -6,46 +6,14 @@ System76 Open Source Firmware
|
|||||||
|
|
||||||
### Install toolchain
|
### Install toolchain
|
||||||
```
|
```
|
||||||
sudo apt-get install \
|
./scripts/deps.sh
|
||||||
build-essential \
|
|
||||||
bison \
|
|
||||||
ccache \
|
|
||||||
flex \
|
|
||||||
git-lfs \
|
|
||||||
gnat \
|
|
||||||
mtools \
|
|
||||||
nasm \
|
|
||||||
uuid-dev \
|
|
||||||
zlib1g-dev
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Make sure git lfs is set up
|
### Load Rust environment (or optionally reboot)
|
||||||
```
|
|
||||||
git lfs install
|
|
||||||
git lfs pull
|
|
||||||
```
|
|
||||||
|
|
||||||
### Install rust
|
|
||||||
```
|
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
|
|
||||||
| sh -s -- -y --default-toolchain nightly
|
|
||||||
```
|
|
||||||
|
|
||||||
### Load cargo environment (or optionally reboot)
|
|
||||||
```
|
```
|
||||||
source ~/.cargo/env
|
source ~/.cargo/env
|
||||||
```
|
```
|
||||||
|
|
||||||
### Ensure rust source is installed for current toolchain
|
|
||||||
```
|
|
||||||
rustup component add --toolchain "$(cat rust-toolchain)" rust-src
|
|
||||||
```
|
|
||||||
|
|
||||||
### Install cargo-xbuild
|
|
||||||
```
|
|
||||||
cargo install cargo-xbuild
|
|
||||||
```
|
|
||||||
|
|
||||||
### Build firmware, replace darp5 with your model (look in the models directory for examples)
|
### Build firmware, replace darp5 with your model (look in the models directory for examples)
|
||||||
```
|
```
|
||||||
./scripts/build.sh darp5
|
./scripts/build.sh darp5
|
||||||
|
57
scripts/deps.sh
Executable file
57
scripts/deps.sh
Executable file
@@ -0,0 +1,57 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eE
|
||||||
|
|
||||||
|
function msg {
|
||||||
|
echo -e "\x1B[1m$*\x1B[0m" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
trap 'msg "\x1B[31mFailed to install dependencies!"' ERR
|
||||||
|
|
||||||
|
if which apt-get > /dev/null
|
||||||
|
then
|
||||||
|
msg "Installing system build dependencies"
|
||||||
|
sudo apt-get install \
|
||||||
|
build-essential \
|
||||||
|
bison \
|
||||||
|
ccache \
|
||||||
|
flex \
|
||||||
|
git-lfs \
|
||||||
|
gnat \
|
||||||
|
mtools \
|
||||||
|
nasm \
|
||||||
|
uuid-dev \
|
||||||
|
zlib1g-dev
|
||||||
|
else
|
||||||
|
msg "Please add support for your distribution to:"
|
||||||
|
msg "scripts/deps.sh"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg "Installing GIT LFS hooks"
|
||||||
|
git lfs install
|
||||||
|
|
||||||
|
msg "Downloading GIT LFS artifacts"
|
||||||
|
git lfs pull
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
if ! which cargo-xbuild > /dev/null
|
||||||
|
then
|
||||||
|
msg "Installing cargo-xbuild"
|
||||||
|
cargo +nightly install cargo-xbuild
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg "\x1B[32mSuccessfully installed dependencies"
|
||||||
|
echo "Ready to run ./scripts/build.sh [model]" >&2
|
Reference in New Issue
Block a user