Added installation of needed rust files in justfile

This commit is contained in:
Christoffer Martinsson 2025-09-29 20:10:37 +02:00
parent 772986ace3
commit 8d7ec43515

View File

@ -1,8 +1,50 @@
set export := true set export := true
default: check default: deps check
check: # Check and install dependencies via rustup
deps:
@just _setup-rustup
@just _setup-rust-toolchain
@just _setup-targets
@just _setup-cargo-binutils
@just _check-python
_setup-rustup:
@if ! command -v rustup >/dev/null 2>&1; then \
echo "Installing rustup..."; \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y; \
echo "Please run: source ~/.cargo/env"; \
echo "Then run 'just deps' again"; \
exit 1; \
fi
_setup-rust-toolchain:
@if ! rustc -vV >/dev/null 2>&1; then \
echo "Installing stable Rust toolchain..."; \
rustup default stable; \
fi
_setup-targets:
@if ! rustup target list --installed | grep -q "thumbv6m-none-eabi"; then \
echo "Installing thumbv6m-none-eabi target..."; \
rustup target add thumbv6m-none-eabi; \
fi
@if ! rustup component list --installed | grep -q "llvm-tools"; then \
echo "Installing llvm-tools component..."; \
rustup component add llvm-tools; \
fi
_setup-cargo-binutils:
@if ! cargo objcopy --version >/dev/null 2>&1; then \
echo "Installing cargo-binutils..."; \
cargo install cargo-binutils; \
fi
_check-python:
@command -v python3 >/dev/null 2>&1 || (echo "Missing: python3 - please install via nix" && exit 1)
check: deps
cd rp2040 && cargo check --target thumbv6m-none-eabi cd rp2040 && cargo check --target thumbv6m-none-eabi
test: test: