Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use distro provided rustup #505

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/dev-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ toolset.

A complete list of dependencies can be seen in `scripts/deps.sh`.

### Cargo
### Cargo (Rust)

rustup manages the [Rust] toolchain, which includes cargo. Cargo is required
for building the tools. It is the only part of the development toolset that is
not installed through distro packages.
for building the tools.

### GNU Make

Expand Down
36 changes: 18 additions & 18 deletions scripts/deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,43 @@ source /etc/os-release
msg "Installing system build dependencies"
if [[ "${ID}" =~ "debian" ]] || [[ "${ID_LIKE}" =~ "debian" ]]; then
sudo apt-get update
sudo apt-get install \
--no-install-recommends \
--yes \
sudo apt-get install --no-install-recommends --yes \
avr-libc \
avrdude \
curl \
gcc \
gcc-avr \
libc-dev \
libhidapi-dev \
libudev-dev \
make \
pkgconf \
rustup \
sdcc \
shellcheck \
uncrustify \
xxd
elif [[ "${ID}" =~ "fedora" ]] || [[ "${ID_LIKE}" =~ "fedora" ]]; then
sudo dnf install \
--assumeyes \
sudo dnf install --assumeyes \
avr-gcc \
avr-libc \
avrdude \
curl \
gcc \
make \
rustup \
sdcc \
ShellCheck \
systemd-devel \
uncrustify \
vim-common
elif [[ "${ID}" =~ "arch" ]] || [[ "${ID_LIKE}" =~ "arch" ]]; then
sudo pacman -S \
--noconfirm \
sudo pacman -S --noconfirm \
avr-gcc \
avr-libc \
avrdude \
curl \
gcc \
make \
pkgconf \
rustup \
sdcc \
shellcheck \
systemd-libs \
Expand All @@ -74,17 +70,21 @@ make git-config

RUSTUP_NEW_INSTALL=0
if ! command -v rustup >/dev/null 2>&1; then
RUSTUP_NEW_INSTALL=1
msg "Installing Rust"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --default-toolchain none

msg "Loading Rust environment"
source "${HOME}/.cargo/env"
# Fedora "rustup" package really just installs "rustup-init"
if command -v rustup-init >/dev/null 2>&1; then
RUSTUP_NEW_INSTALL=1
msg "Installing Rust"
rustup-init -y \
--default-toolchain none \
--profile minimal \
--no-update-default-toolchain
. "${HOME}/.cargo/env"
fi
fi

msg "Installing pinned Rust toolchain and components"
rustup show
# Ref: https://github.com/rust-lang/rustup/issues/3635
rustup show active-toolchain || rustup toolchain install

if [[ $RUSTUP_NEW_INSTALL = 1 ]]; then
msg "rustup was just installed. Ensure cargo is on the PATH with:"
Expand Down
Loading