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

Move minimal Rust from riotbuild to static-test-tools #254

Merged
merged 1 commit into from
Oct 2, 2024
Merged
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
17 changes: 2 additions & 15 deletions riotbuild/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ RUN \
ca-certificates \
ccache \
cmake \
curl \
cython3 \
gcc-multilib \
gdb \
Expand Down Expand Up @@ -324,27 +323,15 @@ RUN echo 'Installing python3 packages' >&2 \
&& pip3 install --no-cache-dir -r /tmp/requirements.txt \
&& rm /tmp/requirements.txt

# While sourcing ~/.cargo/env later would have the right short-term effect,
# we'd still need to set the right path even later when HOME is
# /data/riotbuild -- so setting it right away.
ENV PATH ${PATH}:/opt/rustup/.cargo/bin
# Install nightly Rust via rustup; this is needed for Rust-on-RIOT builds and
# contains all CARGO_TARGETs currently recognized for RIOT targets.
# Add Rust components needed for building, adding to installation from static-test-tools
#
# *_HOMEs moved to /opt to make them world readable. RUSTUP_HOME is set
# persistently in case someone in their image wants to do a quick `sudo rustup
# toolchain add` or similar; CARGO_HOME is not because the user will need to
# write there, and all rustup does here is to place some binaries that later
# fan out to RUSTUP_HOME anyway.
# See static-test-tools/Dockerfile for why which variables are set how.
#
# Components: rust-src is needed to run `-Z build-std=core`, which in turn is
# needed on AVR (which thus doesn't need the avr-unknown-gnu-atmega328 target;
# being able to build core might be useful for other targets as well).
ENV RUSTUP_HOME /opt/rustup/.rustup
RUN \
RUSTUP_HOME=/opt/rustup/.rustup \
CARGO_HOME=/opt/rustup/.cargo sh -c "\
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal && \
rustup component add rust-src && \
rustup target add i686-unknown-linux-gnu && \
rustup target add riscv32imac-unknown-none-elf && \
Expand Down
25 changes: 25 additions & 0 deletions static-test-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RUN \
apt-get -y --no-install-recommends install \
coccinelle \
cppcheck \
curl \
doxygen \
graphviz \
less \
Expand All @@ -35,3 +36,27 @@ RUN echo 'Installing python3 packages' >&2 && \

# Install uncrustify
COPY --from=ghcr.io/kaspar030/uncrustify-builder:latest /usr/bin/uncrustify /usr/bin/uncrustify

# Rust base installation

# While sourcing ~/.cargo/env later would have the right short-term effect,
# we'd still need to set the right path even later when HOME is
# /data/riotbuild -- so setting it right away.
ENV PATH ${PATH}:/opt/rustup/.cargo/bin

# Install Rust via rustup; this is needed for Rust-on-RIOT builds and contains
# all CARGO_TARGETs currently recognized for RIOT targets.
#
# *_HOMEs moved to /opt to make them world readable. RUSTUP_HOME is set
# persistently in case someone in their image wants to do a quick `sudo rustup
# toolchain add` or similar; CARGO_HOME is not because the user will need to
# write there, and all rustup does here is to place some binaries that later
# fan out to RUSTUP_HOME anyway.
#
# Components: fmt is needed for the static test tools as those do `cargo fmt`
# checks. More are added for riotbuild.
ENV RUSTUP_HOME /opt/rustup/.rustup
RUN \
CARGO_HOME=/opt/rustup/.cargo sh -c "\
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal && \
rustup component add rustfmt"
Loading