From 321b655d1b4235ccf8af973b5aca4fa964761380 Mon Sep 17 00:00:00 2001 From: Diego Pino Garcia Date: Tue, 3 Sep 2024 12:11:22 +0200 Subject: [PATCH] wkdev-sdk: Install Rust --- images/wkdev_sdk/Containerfile | 14 +++++++++++--- .../required_system_packages/04-devtools.lst | 2 +- scripts/container-only/.wkdev-init | 11 +++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/images/wkdev_sdk/Containerfile b/images/wkdev_sdk/Containerfile index cbbd8ac..06fb6c0 100644 --- a/images/wkdev_sdk/Containerfile +++ b/images/wkdev_sdk/Containerfile @@ -51,6 +51,17 @@ RUN ${APT_UPDATE} && \ ${APT_INSTALL} apt-utils dialog libterm-readline-gnu-perl locales && \ ${APT_UPGRADE} && ${APT_AUTOREMOVE} +# Add Rust environment. +ENV RUSTUP_HOME="/opt/rust" \ + CARGO_HOME="/opt/rust" \ + PATH="/root/.cargo/bin:${PATH}" + +RUN rustup default stable && \ + rustup component remove rust-docs && \ + cargo install --root /usr/local --version 0.8.1 --locked sccache && \ + cargo install --root /usr/local cargo-c && \ + rm -rf /root/.cargo + # Disable exclusion of locales / translations / documentation (default in Ubuntu images) RUN yes | /usr/local/sbin/unminimize @@ -127,8 +138,5 @@ RUN export QT_VERSION=$(qmake6 -query QT_VERSION) && \ ln -s ${directory} ${directory}/${QT_VERSION} >/dev/null 2>&1 || true; \ done -# Build custom sccache version (the Ubuntu provided 0.7.7 package is broken) -RUN cargo install --root /usr/local --version 0.8.1 --locked sccache - # Switch back to interactive prompt, when using apt. ENV DEBIAN_FRONTEND dialog diff --git a/images/wkdev_sdk/required_system_packages/04-devtools.lst b/images/wkdev_sdk/required_system_packages/04-devtools.lst index 61ce003..319ae80 100644 --- a/images/wkdev_sdk/required_system_packages/04-devtools.lst +++ b/images/wkdev_sdk/required_system_packages/04-devtools.lst @@ -2,7 +2,7 @@ build-essential cmake ninja-build # Build tools -icecc ccache cargo +icecc ccache rustup # Debugging / profiling / tracing valgrind rr perf-tools-unstable systemd-coredump diff --git a/scripts/container-only/.wkdev-init b/scripts/container-only/.wkdev-init index 47e2b9e..f461706 100755 --- a/scripts/container-only/.wkdev-init +++ b/scripts/container-only/.wkdev-init @@ -206,6 +206,16 @@ try_setup_permissions_jhbuild_directory() { } +try_setup_permissions_rust_directory() { + + echo "" + + local rust_directory="/opt/rust" + echo "[12/13] Setup rust '${rust_directory}' directory permissions..." + + chown --recursive "${container_user_name}:${container_group_name}" "${rust_directory}" &>/dev/null +} + try_firstrun_script() { echo "" @@ -259,6 +269,7 @@ run() { try_setup_run_user_directory try_setup_dockerenv_file try_setup_permissions_jhbuild_directory + try_setup_permissions_rust_directory try_firstrun_script # Reset DEBIAN_FRONTEND again.